This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] gdb_realpath causes problems with GVD


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]