Re: g_concat_dir_and_file does bad thing with "" for dir
- From: George <jirka 5z com>
- To: Darin Adler <darin eazel com>
- Cc: Gnome Developers <gnome-devel-list gnome org>,Miguel de Icaza <miguel gnu org>, George <jirka 5z com>
- Subject: Re: g_concat_dir_and_file does bad thing with "" for dir
- Date: Thu, 6 Jul 2000 15:20:37 -0700
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
prepend.
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
--
George <jirka@5z.com>
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]