Re: [RFC] gdb_realpath causes problems with GVD

Joel Brobecker
2002-03-19T22:28:04Z

> I think gdb_realpath() needs a re-name - it no longer implements
> realpath() semantics. xfullpath() comes to mind (`x' for `xmalloc',
> `fullpath' cos it is close to realpath :-) (Better ideas? Does libiberty
> already provide an equivalent?)

I agree. I will wait to make sure everybody agrees to the change, and
to see if any other suggestion arises. I'll then perform the name
change.

> I don't think trying to rewriting the gdb_realpath() autoconfigury magic
> is a good idea (the rewrite as two comile errors). Instead just assume
> that gdb_realpath() works and use that, concat() and xfree().

Here is how I understand your suggestion: Rewrite gdb_realpath which
will always "work", ie return a path.

And then implement xfullpath to use it in all cases:

char *
xfullpath (const char *filename)
{
const char *base_name = [...];
char *dir_name;
char *rp;
char *temp_result;
char *result;

dir_name = [...];
rp = gdb_realpath (dir_name); /* rp will always be non-null */
temp_result = concat (rp, SLASH_CHAR, base_name);
result = xstrdup (temp_result);

xfree (rp);
xfree (temp_result);

return result;
}

--
Joel