[RFC] xfullpath and new regression test xfullpath.exp

Eli Zaretskii eliz@is.elta.co.il
Thu Apr 4 23:44:00 GMT 2002


> Date: Wed, 3 Apr 2002 15:19:09 +0200
> From: Joel Brobecker <brobecker@ACT-Europe.FR>
> 
> > >    if (IS_DIR_SEPARATOR (real_path[strlen (real_path) - 1]))
> > >      result = concat (real_path, base_name, NULL);
> > >    else
> > >      result = concat (real_path, SLASH_STRING, base_name, NULL);
> > 
> > Yes, I think this is better, thanks.
> > 
> > > (can I consider that SLASH_STRING will always be one character long?):
> > 
> > Where does the code assume it's a single character?  `concat' conses
> > up a new string, right?  If so, the length of SLASH_STRING shouldn't
> > matter, I think.  Or am I missing something?
> 
> I implicitely make this assumption when I use the IS_DIR_SEPARATOR
> macro to check the value of the last character in the real_path string,
> and then use SLASH_STRING during the concat.

You don't need to worry about that: it's IS_DIR_SEPARATOR's job to
DTRT for each platform, even if the directory separator is not a
single character.

> If all is fine, I'll resubmit a new patch shortly.

Please do.  Thanks.



More information about the Gdb-patches mailing list