mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Minor code tweaks
darcs-hash:20070416201053-ac50b-99d3ee51ef2b3642c737c3809bc2a4bfbe103b67.gz
This commit is contained in:
parent
778b6a31ad
commit
5c9570eb56
7 changed files with 52 additions and 16 deletions
|
@ -283,14 +283,12 @@ static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
|
|||
*/
|
||||
|
||||
pos = str;
|
||||
for( i=0; i<4; i++ )
|
||||
for( i=0; (i<4) && pos && *pos; i++ )
|
||||
{
|
||||
pos = wcschr( pos+1, L'\n' );
|
||||
if( !pos )
|
||||
break;
|
||||
}
|
||||
|
||||
if( pos )
|
||||
if( pos && *pos )
|
||||
{
|
||||
|
||||
/*
|
||||
|
|
6
event.h
6
event.h
|
@ -97,6 +97,9 @@ void event_remove( event_t *event );
|
|||
/**
|
||||
Return all events which match the specified event class
|
||||
|
||||
This function is safe to call from a signal handler _ONLY_ if the
|
||||
out parameter is null.
|
||||
|
||||
\param criterion Is the class of events to return. If the criterion has a non-null function_name, only events which trigger the specified function will return.
|
||||
\param out the list to add events to. May be 0, in which case no events will be added, but the result count will still be valid
|
||||
|
||||
|
@ -111,6 +114,9 @@ int event_get( event_t *criterion, array_list_t *out );
|
|||
called. If event is a null-pointer, all pending events are
|
||||
dispatched.
|
||||
|
||||
This function is safe to call from a signal handler _ONLY_ if the
|
||||
event parameter is for a signal.
|
||||
|
||||
\param event the specific event whose handlers should fire
|
||||
*/
|
||||
void event_fire( event_t *event );
|
||||
|
|
2
io.h
2
io.h
|
@ -68,7 +68,7 @@ io_data_t *io_remove( io_data_t *list, io_data_t *element );
|
|||
io_data_t *io_duplicate( void *context, io_data_t *l );
|
||||
|
||||
/**
|
||||
Return the last io redirection in ht e chain for the specified file descriptor.
|
||||
Return the last io redirection in the chain for the specified file descriptor.
|
||||
*/
|
||||
io_data_t *io_get( io_data_t *io, int fd );
|
||||
|
||||
|
|
6
proc.c
6
proc.c
|
@ -1033,7 +1033,10 @@ void job_continue (job_t *j, int cont)
|
|||
got_signal = 0;
|
||||
quit = job_is_stopped( j ) || job_is_completed( j );
|
||||
}
|
||||
while( got_signal && !quit );
|
||||
|
||||
while( got_signal && !quit )
|
||||
;
|
||||
|
||||
if( !quit )
|
||||
{
|
||||
|
||||
|
@ -1077,7 +1080,6 @@ void job_continue (job_t *j, int cont)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
3
signal.c
3
signal.c
|
@ -450,7 +450,8 @@ static void handle_winch( int sig, siginfo_t *info, void *context )
|
|||
}
|
||||
|
||||
/**
|
||||
Respond to a winch signal by checking the terminal size
|
||||
Respond to a hup signal by exiting, unless it is vcaught by a
|
||||
shellscript function, in which case we do nothing.
|
||||
*/
|
||||
static void handle_hup( int sig, siginfo_t *info, void *context )
|
||||
{
|
||||
|
|
30
util.c
30
util.c
|
@ -1316,15 +1316,31 @@ void sb_destroy( string_buffer_t * b )
|
|||
|
||||
void sb_clear( string_buffer_t * b )
|
||||
{
|
||||
wchar_t c=0;
|
||||
|
||||
CHECK( b, );
|
||||
|
||||
b->used=0;
|
||||
b_append( b, &c, sizeof( wchar_t));
|
||||
b->used -= sizeof(wchar_t);
|
||||
sb_truncate( b, 0 );
|
||||
assert( !wcslen( b->buff) );
|
||||
}
|
||||
|
||||
void sb_truncate( string_buffer_t *b, int chars_left )
|
||||
{
|
||||
wchar_t *arr;
|
||||
|
||||
CHECK( b, );
|
||||
|
||||
b->used = (chars_left)*sizeof( wchar_t);
|
||||
arr = (wchar_t *)b->buff;
|
||||
arr[chars_left] = 0;
|
||||
|
||||
}
|
||||
|
||||
ssize_t sb_length( string_buffer_t *b )
|
||||
{
|
||||
CHECK( b, -1 );
|
||||
return (b->used-1)/sizeof( wchar_t);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void b_init( buffer_t *b)
|
||||
{
|
||||
|
|
15
util.h
15
util.h
|
@ -642,10 +642,23 @@ int sb_vprintf( string_buffer_t *buffer, const wchar_t *format, va_list va_orig
|
|||
void sb_destroy( string_buffer_t * );
|
||||
|
||||
/**
|
||||
Truncate the buffer. This will not deallocate the memory used, it will only set the contents of the string to L"\\0".
|
||||
Completely truncate the buffer. This will not deallocate the memory
|
||||
used, it will only set the contents of the string to L"\\0".
|
||||
*/
|
||||
void sb_clear( string_buffer_t * );
|
||||
|
||||
/**
|
||||
Truncate the string to the specified number of characters. This
|
||||
will not deallocate the memory used.
|
||||
*/
|
||||
void sb_truncate( string_buffer_t *, int chars_left );
|
||||
|
||||
/**
|
||||
Return the number of characters in the string
|
||||
*/
|
||||
ssize_t sb_length( string_buffer_t * );
|
||||
|
||||
|
||||
/*
|
||||
Buffer functions
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue