Minor cleanups, mostly of code comments

darcs-hash:20061111105452-ac50b-24ab7965f6208ecdfced738e08cdb4cb4a565458.gz
This commit is contained in:
axel 2006-11-11 20:54:52 +10:00
parent 63732a99e9
commit 5005c67d76
6 changed files with 27 additions and 19 deletions

View file

@ -72,7 +72,7 @@ extern wchar_t *program_name;
This macro is used to check that an input argument is not null. It 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 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 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 ) \ #define CHECK( arg, retval ) \
if( !(arg) ) \ if( !(arg) ) \
@ -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() \ #define DIE_MEM() \
{ \ { \
@ -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() \ #define CRASH() \
{ \ { \
@ -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 ) \ #define CHECK_BLOCK( retval ) \
if( signal_is_blocked() ) \ if( signal_is_blocked() ) \
@ -129,7 +131,8 @@ extern wchar_t *program_name;
#define _(wstr) wgettext(wstr) #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 #define N_(wstr) wstr

View file

@ -66,11 +66,6 @@
*/ */
#define PROG_COMPLETE_SEP L'\t' #define PROG_COMPLETE_SEP L'\t'
/**
Terminator for completions sent to the fish_pager
*/
#define COMPLETE_TERMINATOR L'\006'
/** /**
Add a completion. Add a completion.

View file

@ -503,7 +503,8 @@ static void history_populate_from_mmap( history_mode_t *m )
if( (i_orig=hash_get( &current_mode->session_item, i ) ) ) 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 ); al_push( &session_item_list, i_orig );
} }
@ -608,7 +609,8 @@ static void history_save_mode( void *n, history_mode_t *m )
wchar_t *tmp_name; 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++ ) for( i=0; i<al_get_count(&m->item); i++ )
{ {
@ -628,7 +630,8 @@ static void history_save_mode( void *n, history_mode_t *m )
signal_block(); 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 ); on_disk = history_create_mode( m->name );
history_load( on_disk ); history_load( on_disk );

View file

@ -32,6 +32,8 @@ const wchar_t *intern( const wchar_t *in )
{ {
const wchar_t *res=0; const wchar_t *res=0;
// debug( 0, L"intern %ls", in );
if( !in ) if( !in )
return 0; return 0;

View file

@ -80,6 +80,14 @@ static int try_sequence( char *seq, wchar_t *str )
return 0; 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 Calculate the width of the specified prompt. Does some clever magic
to detect common escape sequences that may be embeded in a prompt, to detect common escape sequences that may be embeded in a prompt,
@ -184,10 +192,7 @@ static int calc_prompt_width( wchar_t *prompt )
/* /*
Assume tab stops every 8 characters if undefined Assume tab stops every 8 characters if undefined
*/ */
if( init_tabs <= 0 ) res = next_tab_stop( res );
init_tabs = 8;
res=( (res/init_tabs)+1 )*init_tabs;
} }
else else
{ {

View file

@ -1,6 +1,6 @@
function __fish_use_subcommand -d "Test if a non-switch argument has been given in the current commandline" 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] set -e cmd[1]
for i in $cmd for i in $cmd
switch $i switch $i