Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb@sources.redhat.com
Subject: basename() troubles
Date: Sun, 13 May 2001 06:59:00 -0000	[thread overview]
Message-ID: <200105131359.f4DDxh301103@delius.kettenis.local> (raw)

Eli's latest patch to symtab.c:

2001-05-06  Eli Zaretskii  <eliz@is.elta.co.il>

	* symtab.c (lookup_symtab_1, lookup_partial_symtab): Use basename
	instead of non-portable search for `/'.  Use FILENAME_CMP instead
	of STREQ, to account for case-insensitive filesystems.
	(top-level): #include "filenames.h".

uses the following bit of code:

  if (basename (name) == name)
    ...

in a couple of places.  Unfortunately the FreeBSD basename() always
returns a pointer to internal static storage space.  Therefore the
check will always fail.  There are basically two ways to solve this
problem:

 * Use strcmp() to compare the strings.

 * Use lbasename() from libiberty which has well defined semantics.

The latter is probably a bit more efficient, and has the additional
advantage of removing our dependence on whatever broken basename()
implementation the host supplies.  Do people agree?

Another question is, wheter we should replace the other basename() calls with
lbasename() as well.

Mark


             reply	other threads:[~2001-05-13  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-13  6:59 Mark Kettenis [this message]
2001-05-13  8:41 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200105131359.f4DDxh301103@delius.kettenis.local \
    --to=kettenis@wins.uva.nl \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox