summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
commit536c1ec32a37eb221182aaace9c8a6abe960dda1 (patch)
tree6c201ad124f60d68f93ee05c4ca77d6c37ced79c
parent6fee4ca6255ad5ffe3be98c11e7822166e2d4510 (diff)
parent50533135622a80b0326c7e93067e136072bef5eb (diff)
downloadgit-536c1ec32a37eb221182aaace9c8a6abe960dda1.tar.gz
Merge branch 'rs/urlmatch-cleanup'
Code cleanup. * rs/urlmatch-cleanup: urlmatch: use hex2chr() in append_normalized_escapes()
-rw-r--r--urlmatch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/urlmatch.c b/urlmatch.c
index 4bbde924e8..3e42bd7504 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -42,12 +42,12 @@ static int append_normalized_escapes(struct strbuf *buf,
from_len--;
if (ch == '%') {
- if (from_len < 2 ||
- !isxdigit(from[0]) ||
- !isxdigit(from[1]))
+ if (from_len < 2)
return 0;
- ch = hexval(*from++) << 4;
- ch |= hexval(*from++);
+ ch = hex2chr(from);
+ if (ch < 0)
+ return 0;
+ from += 2;
from_len -= 2;
was_esc = 1;
}