From: miker Date: Fri, 13 Jul 2007 14:52:20 +0000 (+0000) Subject: changing back to an array, from calloc. more straight-forward, and avoids memset... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8f633a512eb0c54d0646a2c9d898b278fa992a5c;p=working%2FOpenSRF.git changing back to an array, from calloc. more straight-forward, and avoids memset overhead git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1031 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index 872e87c..29b8bbf 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -203,8 +203,8 @@ static int parse_request( char* request ) { if( request == NULL ) return 0; - char* original_request = strdup( request ); - char** words = calloc(COMMAND_BUFSIZE, sizeof(char*)); + char* original_request = strdup( request ); + char* words[COMMAND_BUFSIZE]; int ret_val = 0; int i = 0; @@ -216,7 +216,6 @@ static int parse_request( char* request ) { if( cur_tok == NULL ) { free( original_request ); - free( words ); return 0; } @@ -230,7 +229,6 @@ static int parse_request( char* request ) { } else { fprintf( stderr, "Too many tokens in command\n" ); free( original_request ); - free( words ); return 1; } } @@ -275,15 +273,12 @@ static int parse_request( char* request ) { ret_val = 1; } + free( original_request ); if(!ret_val) - ret_val = parse_error( words ); + return parse_error( words ); else - ret_val = 1; - - free( original_request ); - free( words ); - return ret_val; + return 1; }