Re: [PATCH v14 04/16] Refactor quote_path_relative, remove unused params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jiang Xin <worldhello.net@xxxxxxxxx> writes:

> After substitute path_relative() in quote.c with relative_path() from
> path.c, parameters (such as len and prefix_len) are obsolete in function
> quote_path_relative(). Remove unused parameters and change the order of
> parameters for quote_path_relative() function.
> ...
> diff --git a/builtin/clean.c b/builtin/clean.c
> index 04e39..f77f95 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -262,7 +262,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>  				if (remove_dirs(&directory, prefix, rm_flags, dry_run, quiet, &gone))
>  					errors++;
>  				if (gone && !quiet) {
> -					qname = quote_path_relative(directory.buf, directory.len, &buf, prefix);
> +					qname = quote_path_relative(directory.buf, prefix, &buf);
>  					printf(dry_run ? _(msg_would_remove) : _(msg_remove), qname);

This one needed a bit closer look to make sure directory.len is
already pointing at the end of directory.buf (it is) to verify that
this is a safe conversion.  Everywhere else we lost either -1 or
strlen() of the string we feed quote_path() and quote_path_relative()
so they look fine.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]