sorry I missed this earlier. Comments inline below... Michael Hunter wrote: > On Fri, 16 Oct 2009 13:37:28 +0100 > Alan Maguire <Alan.Maguire at Sun.COM> wrote: > > >> ...at: >> >> http://zhadum.east.sun.com/export/ws/amaguire/nwam1-cr/webrev/ >> > > comments on the current implementation in case you don't like my other idea |: > > strsep() might be easier then strtok_r(). > > Run over the string once counting spaces so you can allocate the right > length of argv and you can't ditch the realloc() logic. >
What about using the strategy we use in a few places in libnwam - we calloc as much memory as we'd conceivably need (in this case NWAM_MAX_VALUE_LEN/2 char * pointers is the maximum number of arguments we can cram into a string property), then we realloc to shrink down the block of char * pointers when we've parsed the string and determined the number of arguments? > numargs is a weird variable name for an index > > I'll change that. I'll roll these changes into the webrev I sent out earlier for 12084/12115. Thanks! Alan
