Re: g_concat_dir_and_file does bad thing with "" for dir

On Thu, Jul 06, 2000 at 08:31:59AM -0700, Darin Adler wrote:
> > if (dir [strlen(dir) - 1] != PATH_SEP)
> The above code won't work right if the dir is "".
> We can either add:
>     g_return_val_if_fail (dir [0] != '\0', NULL);
> Or change the if to:
>     if (dir [0] != '\0' && dir [strlen(dir) - 1] != PATH_SEP)

I'm for the second part.  I think "" should not be an error.  Perhaps even
NULL should not be an error, as it just might mean there is no directory to

Miguel has the final say, but I'd say this is a good change.  There was some
talk about putting the g_* functions from gnome-libs into glib, so it might
be relevant in that respect as well.


George <>
   As long as people will accept crap, 
   it will be financially profitable to dispense it.
                       -- Dick Cavett, in "Playboy", 1971

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]