[Opensrf-commits] r1031 - trunk/src/srfsh

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 13 10:57:24 EDT 2007


Author: miker
Date: 2007-07-13 10:52:20 -0400 (Fri, 13 Jul 2007)
New Revision: 1031

Modified:
   trunk/src/srfsh/srfsh.c
Log:
changing back to an array, from calloc.  more straight-forward, and avoids memset overhead

Modified: trunk/src/srfsh/srfsh.c
===================================================================
--- trunk/src/srfsh/srfsh.c	2007-07-13 03:15:51 UTC (rev 1030)
+++ trunk/src/srfsh/srfsh.c	2007-07-13 14:52:20 UTC (rev 1031)
@@ -203,8 +203,8 @@
 	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 @@
 	if( cur_tok == NULL )
 	{
 		free( original_request );
-		free( words );
 		return 0;
 	}
 
@@ -230,7 +229,6 @@
 		} else {
 			fprintf( stderr, "Too many tokens in command\n" );
 			free( original_request );
-			free( words );
 			return 1;
 		}
 	}
@@ -275,15 +273,12 @@
 		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;
 }
 
 



More information about the opensrf-commits mailing list