On Tuesday 08 July 2008 05:47, Denys Vlasenko wrote:
> [CC: [EMAIL PROTECTED]
> 
> On Monday 07 July 2008 21:31, [EMAIL PROTECTED] wrote:
> > Please, comment and consider applying.

Another comment: the return value should be NULL
if file can't be opened; should contain at least one
element (NULL) if file was opened but no tokens
are found; else as usual.

Trimming it at the end with xrealloc to not take
space after terminating NULL might be not a bad idea too.
BTW... that data[] needs this even worse - config files tend
to have largish comments. Move stuff "to the left" in the data
as you parse it? a-la

dst = data;

...
...
*dst++ = *data++;
    and
dst = stpcpy(dst, data);

and then xrealloc it at the end. Much less of memory usage.

Ah crap, xrealloc can move it then... the trick may be
to store in token[] _indexes_ into data, not pointers,
and convert them to pointers after final shrinking xrealloc(data).
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to