From 763a6b83518450289e49499e3cbc7c8151806be8 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 18 May 2006 23:00:39 +1000 Subject: [PATCH] Minor cleanup darcs-hash:20060518130039-ac50b-c17e794113c38909d90be840fce36c7727c628b4.gz --- doc_src/doc.hdr | 3 ++- event.c | 12 +++++++----- exec.c | 19 +++---------------- exec.h | 11 ----------- main.c | 10 ++++++---- parser.c | 6 +++--- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 1e3ad9105..b5b8c6d58 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -1200,8 +1200,9 @@ g++, javac, java, gcj, lpr, doxygen, whois, find) - The jobs builtin should be able to give information on a specific job, such as the pids of the processes in the job - Syntax highlighting should mark cd to non-existing directories as an error - wait shellscript -- Signal handler to save the history file before exiting from a signal - Support for the screen clipboard +- The -a string sent to complete should be validated +- Fish should detect improper variable expansion when validating, e.g. strings such as 'foo$' and 'a${}' should be detected as invalid \subsection todo-possible Possible features diff --git a/event.c b/event.c index 88eaac5b1..dc274bd14 100644 --- a/event.c +++ b/event.c @@ -57,7 +57,7 @@ typedef struct active, which is the one that new events is written to. The inactive one contains the events that are currently beeing performed. */ -static signal_list_t sig_list[2]; +static signal_list_t sig_list[]={{0,0},{0,0}}; /** The index of sig_list that is the list of signals currently written to @@ -273,9 +273,12 @@ void event_remove( event_t *criterion ) event_t e; /* - Because of concurrency issues, env_remove does not actually free - any events - instead it simply moves all events that should be - removed from the event list to the killme list. + Because of concurrency issues (env_remove could remove an event + that is currently being executed), env_remove does not actually + free any events - instead it simply moves all events that should + be removed from the event list to the killme list, and the ones + that shouldn't be killed to new_list, and then drops the empty + events-list. */ if( !events ) @@ -617,7 +620,6 @@ void event_fire( event_t *event ) void event_init() { - sig_list[active_list].count=0; } void event_destroy() diff --git a/exec.c b/exec.c index 455af2697..91e66f4bf 100644 --- a/exec.c +++ b/exec.c @@ -126,7 +126,7 @@ int exec_pipe( int fd[2]) if( open_fds == 0 ) { - open_fds = al_new(); + open_fds = al_halloc( global_context ); } al_push( open_fds, (void *)(long)fd[0] ); @@ -164,7 +164,8 @@ static int use_fd_in_pipe( int fd, io_data_t *io ) the redirection list io. This should make sure that there are no stray opened file descriptors in the child. - \param io the list of io redirections for this job. Pipes mentioned here should not be closed. + \param io the list of io redirections for this job. Pipes mentioned + here should not be closed. */ static void close_unused_internal_pipes( io_data_t *io ) { @@ -185,20 +186,6 @@ static void close_unused_internal_pipes( io_data_t *io ) } } -void exec_init() -{ -} - -void exec_destroy() -{ - if( open_fds ) - { - al_destroy( open_fds ); - free( open_fds ); - } -} - - /** Make sure the fd used by this redirection is not used by i.e. a pipe. */ diff --git a/exec.h b/exec.h index aa4e93fb5..97345e981 100644 --- a/exec.h +++ b/exec.h @@ -18,17 +18,6 @@ */ #define PIPE_ERROR _(L"An error occurred while setting up pipe") -/** - Initialize the exec library -*/ -void exec_init(); - -/** - Destroy dynamically allocated data and other resources used by the - exec library -*/ -void exec_destroy(); - /** Execute the processes specified by j. diff --git a/main.c b/main.c index f3324ebf0..596461a96 100644 --- a/main.c +++ b/main.c @@ -63,6 +63,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "halloc_util.h" #include "history.h" +/** + The string describing the single-character options accepted by the main fish binary +*/ +#define GETOPT_STRING "hilnvc:p:d:" /** Parse init files @@ -165,14 +169,14 @@ int main( int argc, char **argv ) int opt = getopt_long( argc, argv, - "hilnvc:p:d:", + GETOPT_STRING, long_options, &opt_index ); #else int opt = getopt( argc, argv, - "hilnvc:p:d:" ); + GETOPT_STRING ); #endif if( opt == -1 ) break; @@ -259,7 +263,6 @@ int main( int argc, char **argv ) proc_init(); event_init(); - exec_init(); wutil_init(); parser_init(); builtin_init(); @@ -348,7 +351,6 @@ int main( int argc, char **argv ) reader_destroy(); parser_destroy(); wutil_destroy(); - exec_destroy(); event_destroy(); common_destroy(); diff --git a/parser.c b/parser.c index 4d08a4b41..68a3c19d6 100644 --- a/parser.c +++ b/parser.c @@ -2102,15 +2102,15 @@ static int parse_job( process_t *p, } tok_destroy( &subtok ); } - + if( make_sub_block ) { - + int end_pos = end-tok_string( tok ); wchar_t *sub_block= halloc_wcsndup( j, tok_string( tok ) + current_tokenizer_pos, end_pos - current_tokenizer_pos); - + p->type = INTERNAL_BLOCK; al_set( args, 0, sub_block );