Re: gstrfuncs.c && g_strsplit()
- From: Owen Taylor <otaylor redhat com>
- To: Evrim ULU <evrim core gen tr>
- Cc: gtk-devel-list gnome org
- Subject: Re: gstrfuncs.c && g_strsplit()
- Date: 09 Mar 2003 14:38:03 -0500
On Sun, 2003-03-09 at 08:46, Evrim ULU wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> hi,
>
> first post to the list ..
>
> gstrfuncs.c
> g_strsplit()
> - --line 2171--
> ~ if (*string)
> ~ {
> ~ n++;
> ~ string_list = g_slist_prepend (string_list, g_strdup (remainder));
> ~ }
> - ---------------
>
> I didn't understand why this is "if (*string)".. won't it be "if
> (*remainder)"?
Not directly answering your question, but:
- The docs for g_strsplit() were carefully written to _exactly_ specify
how it works.
- There are 30-40 tests for g_strsplit() in tests/test-strfuncs.c
(This was after we found a bunch of bugs and undefined behavior.)
My guess offhand is that the if (*string) test relates to the sentence
in the documentation:
"As a special case, the result of splitting the empty string "" is
an empty vector, not a vector containing a single string."
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]