Re: g_strplit break? [Re: bonobo-storage-memory.c]
- From: Darin Adler <darin bentspoon com>
- To: ERDI Gergo <cactus cactus rulez org>, Gtk Developers <gtk-devel-list gnome org>
- Cc: Michael Meeks <michael ximian com>
- Subject: Re: g_strplit break? [Re: bonobo-storage-memory.c]
- Date: Wed, 07 Nov 2001 08:26:49 -0800
on 11/7/01 3:48 AM, ERDI Gergo at cactus cactus rulez org wrote:
> here's a code snippet from bonobo-storage-memory.c:
>
> path_parts = g_strsplit (path, "/", 1);
>
> Back in July, this used to return (imho, correctly) the following (path is
> "/foo/bar/baz")
>
> path_parts[0] "foo"
> path_parts[1] "bar/baz"
> path_parts[2] NULL
>
> however, now that I look at it with gdb, I see the following:
>
> path_parts[0] "foo"
> path_parts[1] "bar"
> path_parts[2] "baz"
> path_parts[3] NULL
>
> So how do I get the "old" g_strsplit funcionality?
Change the 1 to a 2. The old g_strsplit didn't match the documentation or
the split function in perl, which is why Owen changed it.
As a separate issue, the behavior when you pass a 1 is incorrect. It
shouldn't split at all if you pass a 1. I'm submitting a patch for that bug.
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]