Skip to content

Commit

Permalink
Minor cleanups, mostly of code comments
Browse files Browse the repository at this point in the history
darcs-hash:20061111105452-ac50b-24ab7965f6208ecdfced738e08cdb4cb4a565458.gz
  • Loading branch information
liljencrantz committed Nov 11, 2006
1 parent 63732a9 commit 5005c67
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
15 changes: 9 additions & 6 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extern wchar_t *program_name;
This macro is used to check that an input argument is not null. It
is a bit lika a non-fatal form of assert. Instead of exit-ing on
failiure, the current function is ended at once. The second
parameter is the exit status of the current function on failiure.
parameter is the return value of the current function on failiure.
*/
#define CHECK( arg, retval ) \
if( !(arg) ) \
Expand All @@ -88,7 +88,7 @@ extern wchar_t *program_name;
}

/**
Exit program at once, leaving an error message about running out of memory
Exit program at once, leaving an error message about running out of memory.
*/
#define DIE_MEM() \
{ \
Expand All @@ -100,7 +100,8 @@ extern wchar_t *program_name;
}

/**
Cause fish to crash. This should only be usd for debugging.
Cause fish to crash. This should only be used for debugging. If
this function is ever called in shipped code, this is a bug.
*/
#define CRASH() \
{ \
Expand All @@ -109,7 +110,8 @@ extern wchar_t *program_name;
}

/**
Check if signals are blocked
Check if signals are blocked. If so, print an error message and
return from the function performing this check.
*/
#define CHECK_BLOCK( retval ) \
if( signal_is_blocked() ) \
Expand All @@ -120,7 +122,7 @@ extern wchar_t *program_name;
L"If you can reproduce it, please send a bug report to %s.", \
__func__, \
PACKAGE_BUGREPORT ); \
return retval; \
return retval; \
}

/**
Expand All @@ -129,7 +131,8 @@ extern wchar_t *program_name;
#define _(wstr) wgettext(wstr)

/**
Noop, used to tell xgettext that a string should be translated, even though it is not directly sent to wgettext.
Noop, used to tell xgettext that a string should be translated,
even though it is not directly sent to wgettext.
*/
#define N_(wstr) wstr

Expand Down
5 changes: 0 additions & 5 deletions complete.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
*/
#define PROG_COMPLETE_SEP L'\t'

/**
Terminator for completions sent to the fish_pager
*/
#define COMPLETE_TERMINATOR L'\006'

/**
Add a completion.
Expand Down
9 changes: 6 additions & 3 deletions history.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ static void history_populate_from_mmap( history_mode_t *m )
if( (i_orig=hash_get( &current_mode->session_item, i ) ) )
{
/*
This item comes from this session. Insert the original item at the end of the item list.
This item comes from this session. Insert the
original item at the end of the item list.
*/
al_push( &session_item_list, i_orig );
}
Expand Down Expand Up @@ -608,7 +609,8 @@ static void history_save_mode( void *n, history_mode_t *m )
wchar_t *tmp_name;

/*
First check if there are any new entries to save. If not, thenm we can just return
First check if there are any new entries to save. If not, then
we can just return
*/
for( i=0; i<al_get_count(&m->item); i++ )
{
Expand All @@ -628,7 +630,8 @@ static void history_save_mode( void *n, history_mode_t *m )
signal_block();

/*
Set up on_disk variable to describe the current contents of the history file
Set up on_disk variable to describe the current contents of the
history file
*/
on_disk = history_create_mode( m->name );
history_load( on_disk );
Expand Down
2 changes: 2 additions & 0 deletions intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ static hash_table_t *intern_static_table=0;
const wchar_t *intern( const wchar_t *in )
{
const wchar_t *res=0;

// debug( 0, L"intern %ls", in );

if( !in )
return 0;
Expand Down
13 changes: 9 additions & 4 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ static int try_sequence( char *seq, wchar_t *str )
return 0;
}

static int next_tab_stop( int in )
{
if( init_tabs <= 0 )
init_tabs = 8;

return ( (in/init_tabs)+1 )*init_tabs;
}

/**
Calculate the width of the specified prompt. Does some clever magic
to detect common escape sequences that may be embeded in a prompt,
Expand Down Expand Up @@ -184,10 +192,7 @@ static int calc_prompt_width( wchar_t *prompt )
/*
Assume tab stops every 8 characters if undefined
*/
if( init_tabs <= 0 )
init_tabs = 8;

res=( (res/init_tabs)+1 )*init_tabs;
res = next_tab_stop( res );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion share/functions/__fish_use_subcommand.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

function __fish_use_subcommand -d "Test if a non-switch argument has been given in the current commandline"
set -l -- cmd (commandline -poc)
set -l cmd (commandline -poc)
set -e cmd[1]
for i in $cmd
switch $i
Expand Down

0 comments on commit 5005c67

Please sign in to comment.