Subject: Re: [PATCH] Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c

From: Johannes Sixt <[email-masked]>
Date: Mon, 26 Nov 2007 08:45:21 +0100

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