Re: g_strplit break? [Re: bonobo-storage-memory.c]



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]