From: Orjan Friberg <orjan.friberg@axis.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC]: Solib search (Was: Re: Cross solib support; continued)
Date: Sat, 17 Nov 2001 04:03:00 -0000 [thread overview]
Message-ID: <3C052245.8C02668E@axis.com> (raw)
Message-ID: <20011117040300.wQ61lWEoAricdqlRE8TtwApLVkjXYjdkKpnec-TjCpk@z> (raw)
In-Reply-To: <7458-Wed28Nov2001183554+0200-eliz@is.elta.co.il>
Eli Zaretskii wrote:
>
> > Date: Wed, 28 Nov 2001 11:00:09 +0100
> > From: Orjan Friberg <orjan.friberg@axis.com>
>
> > That will only get rid of the first dir separator.
>
> But that's what your original code did on Unix: it would test if the
> first character is a slash, and if so, step over that one slash. Did
> I miss something?
No, you didn't miss anything ;) . I forgot to explain something.
> Since we are under the if clause, we _know_ that the file name begins
> with either "/foo" or "d:/foo". In the first case, IS_DIR_SEPARATOR
> returns 1, so the while loop is terminated immediately, but
> in_pathname was already bumped to point after the slash--that's what
> your original code did. In the second code, the loop will march over
> the drive letter and the colon and terminate on the slash that
> follows, and again in_pathname will be incremented by the last
> iteration to point right after the slash.
I was trying to address the situation where in_pathname contains several
leading slashes; then your suggested code (and my original code also)
would terminate too early. I guess we don't normally care about
multiple leading slashes since it's a valid path, but in this case we
need to get rid of all of them to make it a relative path.
This code should cut it:
if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname))
{
/* First, get rid of any drive letters etc. */
while (!IS_DIR_SEPARATOR (*in_pathname))
in_pathname++;
/* Next, get rid of all leading dir separators. */
while (IS_DIR_SEPARATOR (*in_pathname))
in_pathname++;
}
(The first while loop could have been written like your original
suggestion, to have it consume the first dir separator also, but for
consistency I did them both in the same style.)
--
Orjan Friberg
Axis Communications AB
next prev parent reply other threads:[~2001-11-28 17:43 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3BEAA3A0.586B3046@axis.com>
[not found] ` <20011108110955.A12240@nevyn.them.org>
2001-11-06 10:49 ` Cross solib support; continued Orjan Friberg
2001-11-06 11:57 ` Kevin Buettner
2001-11-27 7:03 ` [RFC]: Solib search (Was: Re: Cross solib support; continued) Orjan Friberg
2001-11-14 12:49 ` Orjan Friberg
2001-11-27 7:12 ` Daniel Jacobowitz
2001-11-14 12:59 ` Daniel Jacobowitz
2001-11-14 13:21 ` Orjan Friberg
2001-11-14 13:53 ` Daniel Jacobowitz
2001-11-14 18:20 ` Orjan Friberg
2001-11-27 10:26 ` Orjan Friberg
2001-11-27 10:45 ` Daniel Jacobowitz
2001-11-14 18:28 ` Daniel Jacobowitz
2001-11-14 18:33 ` Orjan Friberg
2001-11-27 11:15 ` Orjan Friberg
2001-11-27 11:29 ` Daniel Jacobowitz
2001-11-14 18:55 ` Daniel Jacobowitz
2001-11-16 13:47 ` Orjan Friberg
2001-11-28 1:03 ` Orjan Friberg
2001-11-27 15:44 ` Kevin Buettner
2001-11-15 8:00 ` Kevin Buettner
2001-11-15 8:00 ` Daniel Jacobowitz
2001-11-15 9:16 ` Kevin Buettner
2001-11-27 16:00 ` Kevin Buettner
2001-11-27 15:47 ` Daniel Jacobowitz
2001-11-27 7:43 ` Daniel Jacobowitz
2001-11-27 7:36 ` Orjan Friberg
2001-11-27 8:00 ` Eli Zaretskii
2001-11-14 15:22 ` Eli Zaretskii
2001-11-27 10:16 ` Orjan Friberg
2001-11-14 18:14 ` Orjan Friberg
2001-11-14 20:58 ` Eli Zaretskii
2001-11-27 12:42 ` Eli Zaretskii
2001-11-28 0:55 ` Orjan Friberg
2001-11-16 13:24 ` Orjan Friberg
2001-11-28 2:00 ` Orjan Friberg
2001-11-16 14:02 ` Orjan Friberg
2001-11-17 2:18 ` Eli Zaretskii
2001-11-28 8:37 ` Eli Zaretskii
2001-11-28 9:43 ` Orjan Friberg [this message]
2001-11-17 4:03 ` Orjan Friberg
2001-11-17 12:37 ` Eli Zaretskii
2001-11-29 5:52 ` Orjan Friberg
2001-11-19 11:44 ` Orjan Friberg
2001-12-03 17:19 ` Kevin Buettner
2001-12-04 1:35 ` Orjan Friberg
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=3C052245.8C02668E@axis.com \
--to=orjan.friberg@axis.com \
--cc=eliz@is.elta.co.il \
--cc=gdb-patches@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