git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Steffen Prohaska <prohaska@zib.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c
Date: Mon, 26 Nov 2007 08:45:21 +0100	[thread overview]
Message-ID: <474A7991.5010202@viscovery.net> (raw)
In-Reply-To: <11960297431954-git-send-email-prohaska@zib.de>

Steffen Prohaska schrieb:
> Using the helper function to test for absolute paths makes porting easier.

The patch looks good.

> --- a/setup.c
> +++ b/setup.c
> @@ -59,7 +59,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
>  const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
>  {
>  	static char path[PATH_MAX];
> -	if (!pfx || !*pfx || arg[0] == '/')
> +	if (!pfx || !*pfx || is_absolute_path(arg))
>  		return arg;
>  	memcpy(path, pfx, pfx_len);
>  	strcpy(path + pfx_len, arg);

This instance, however, will be reworked for Windows anyway because we must 
do '\\' to '/' conversion even if the path is absolute (and, hence, we 
cannot just return the input).

But disregarding this note, the change makes the code more readable, IMO, so 
I'm all for it.

-- Hannes

      parent reply	other threads:[~2007-11-26  7:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-25 22:29 [PATCH] Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c Steffen Prohaska
2007-11-26  3:54 ` Junio C Hamano
2007-11-26  6:45   ` Steffen Prohaska
2007-11-26  7:45 ` Johannes Sixt [this message]

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=474A7991.5010202@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=prohaska@zib.de \
    /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;
as well as URLs for NNTP newsgroup(s).