[PATCH 1/4] Reduce url_len variable scope

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

 



Signed-off-by: Vasyl' Vavrychuk <vvavrychuk@xxxxxxxxx>
---
 builtin/fetch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 357f3cd..2b0b11e 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -385,6 +385,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 		url_len = i + 1;
 		if (4 < i && !strncmp(".git", url + i - 3, 4))
 			url_len = i - 3;
+		url[url_len] = '\0';
 
 		note_len = 0;
 		if (*what) {
@@ -399,7 +400,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 				    rm->old_sha1),
 			rm->merge ? "" : "not-for-merge",
 			note);
-		for (i = 0; i < url_len; ++i)
+		for (i = 0; url[i]; ++i)
 			if ('\n' == url[i])
 				fputs("\\n", fp);
 			else
@@ -415,8 +416,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 				 REFCOL_WIDTH, *what ? what : "HEAD");
 		if (*note) {
 			if (verbosity >= 0 && !shown_url) {
-				fprintf(stderr, "From %.*s\n",
-						url_len, url);
+				fprintf(stderr, "From %s\n", url);
 				shown_url = 1;
 			}
 			if (verbosity >= 0)
-- 
1.7.1

--
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]