-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/21/2010 05:42 AM, Dmitri Pal wrote:
Hello,
This patch allows proper parsing of values like this:
fruit=apple,,orange
The added function would return the list of three items:
apple
<empty>
orange
Previously existing parsing functions in this case could only return
apple
orange
This is used in the ELAPI configuration to provide alternative names for
the column headers.
This is the last of the non ELAPI patche that I have in my repo.
The only functional problem I see is that the implementation does not
strip leading whitespace, i.e. " foo, bar " would become { " foo",
"bar"
}. Otherwise seems to work fine. Some comments below:
Is there any reason to arbitrarily limit the number of separators?
Also, maybe it would be nicer to use strpbrk() instead of
for(j = 0; j < lensep; j++) {
if(buff[i] == locsep[j])
..one less loop.
Instead of:
while ((i < dlen) && (isspace(*start)))
maybe you could use:
while (*start && (isspace(*start)))
as the data will be null-terminated strings anyway. That way you could
avoid doing i++ before the loop and i-- immediatelly after it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org/
iEYEARECAAYFAktYcgMACgkQHsardTLnvCWWPwCgh2nHA4qHWJw/taNTr8jG7ne8
V7IAmwcnkzRtJxmg9/f4FtAKfQCHceXq
=UxJt
-----END PGP SIGNATURE-----