Skip to content

Commit 536c1ec

Browse files
committed
Merge branch 'rs/urlmatch-cleanup'
Code cleanup. * rs/urlmatch-cleanup: urlmatch: use hex2chr() in append_normalized_escapes()
2 parents 6fee4ca + 5053313 commit 536c1ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

urlmatch.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ static int append_normalized_escapes(struct strbuf *buf,
4242

4343
from_len--;
4444
if (ch == '%') {
45-
if (from_len < 2 ||
46-
!isxdigit(from[0]) ||
47-
!isxdigit(from[1]))
45+
if (from_len < 2)
4846
return 0;
49-
ch = hexval(*from++) << 4;
50-
ch |= hexval(*from++);
47+
ch = hex2chr(from);
48+
if (ch < 0)
49+
return 0;
50+
from += 2;
5151
from_len -= 2;
5252
was_esc = 1;
5353
}

0 commit comments

Comments
 (0)