# HG changeset patch # User arpi # Date 1033000112 0 # Node ID f0888351bd466db3e4ef3e318419175ad06f7080 # Parent 6a2b6f3d619cc748913a6b05a142f391122a6163 accept empty strings too for STRING_LIST (example: "-xyz 1,2.5,,4," ) diff -r 6a2b6f3d619c -r f0888351bd46 cfgparser.c --- a/cfgparser.c Wed Sep 25 23:45:34 2002 +0000 +++ b/cfgparser.c Thu Sep 26 00:28:32 2002 +0000 @@ -612,7 +612,7 @@ last_ptr = ptr; ptr = strchr(ptr,LIST_SEPARATOR); if(!ptr) { - if(strlen(last_ptr) > 0) +// if(strlen(last_ptr) > 0) n++; break; } @@ -630,11 +630,13 @@ res = malloc((n+1)*sizeof(char*)); ptr = param; n = 0; - while(ptr[0] != '\0') { +// while(ptr[0] != '\0') { + while(1) { last_ptr = ptr; ptr = strchr(ptr,LIST_SEPARATOR); if(!ptr) { - if(strlen(last_ptr) > 0) { + //if(strlen(last_ptr) > 0) + { res[n] = strdup(last_ptr); n++; } @@ -642,7 +644,7 @@ } len = ptr - last_ptr; res[n] = (char*)malloc(len + 1); - strncpy(res[n],last_ptr,len); + if(len) strncpy(res[n],last_ptr,len); res[n][len] = '\0'; ptr++; n++;