Re: [RFA] New substitute-path commands

Daniel Jacobowitz
2006-07-11T12:47:44Z

On Thu, Jul 06, 2006 at 10:22:19PM -0700, Joel Brobecker wrote:
> +/* If the user specified a source path substitution rule, then
> + try applying it on PATH, and return the new path. This new
> + path must be deallocated afterwards.
> +
> + Return NULL if no substitution rule was specified by the user,
> + or of this rule didn't apply to the given PATH. */
> +
> +static char *
> +xrewrite_source_path (const char *path)

Why the x? Is it because it allocates? I believe we actually use the
x to indicate replacements for system functionality which have a more
reliable error behavior; so please don't use it here.

> + /* Search for the first occurence of SUBSTITUTE_PATH_FROM.
> + No substitution needed of not found. */

If not found.

> + from_start = strstr (path, substitute_path_from);

This is the part of the patch I'm not sure about. I have two
questions.

1. Should the substitution rule be anchored to the beginning of the
pathname?

2. Should the end of the rule be anchored to end of string or
directory separator?

I think #1 should be yes, and #2 should probably be yes, but I'm less
certain about it. What do you think?

Otherwise the code looks good.

--
Daniel Jacobowitz
CodeSourcery