git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Nov 26, 2007, 07:45 UTC
Message-ID
<474A7991.5010202@viscovery.net>
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.
Show 11 quoted lines
> --- 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
Previous: Steffen Prohaska
Message 4 of 4 in “Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c”
  1. Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.cSteffen Prohaska, Nov 25, 2007
  2. Junio C HamanoNov 26, 2007
  3. Steffen ProhaskaNov 26, 2007
  4. Johannes SixtNov 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.