From 39598f9983f759b5e38b9e762c695bad6c89a1b3 Mon Sep 17 00:00:00 2001 From: Jiang Xin Date: Tue, 25 Jun 2013 23:53:45 +0800 Subject: quote_path_relative(): remove redundant parameter quote_path_relative() used to take a counted string as its parameter (the string to be quoted). With an earlier change, it now uses relative_path() that does not take a counted string, and we have been passing only the pointer to the string since then. Remove the length parameter from quote_path_relative() to show that this parameter was redundant. All the changed lines show that the caller passed either -1 (to ask the function run strlen() on the string), or the length of the string, so the earlier conversion was safe. All the callers of quote_path_relative() that used to take counted string have been audited to make sure that they are passing length of the actual string (or -1 to ask the callee run strlen()) Signed-off-by: Jiang Xin Signed-off-by: Junio C Hamano --- quote.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'quote.c') diff --git a/quote.c b/quote.c index 64ff344158..ebb835923f 100644 --- a/quote.c +++ b/quote.c @@ -325,8 +325,8 @@ void write_name_quoted_relative(const char *name, size_t len, } /* quote path as relative to the given prefix */ -char *quote_path_relative(const char *in, int len, - struct strbuf *out, const char *prefix) +char *quote_path_relative(const char *in, const char *prefix, + struct strbuf *out) { struct strbuf sb = STRBUF_INIT; const char *rel = relative_path(in, prefix, &sb); @@ -334,9 +334,6 @@ char *quote_path_relative(const char *in, int len, quote_c_style_counted(rel, strlen(rel), out, NULL, 0); strbuf_release(&sb); - if (!out->len) - strbuf_addstr(out, "./"); - return out->buf; } -- cgit v1.2.3