use isxdigit() for checking if a character is a hexadecimal digit
Use the standard function isxdigit() to make the intent clearer and avoid using magic constants. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Mar 9, 2015 at 23:46 UTC
6f75d45b2412c646b74300f360361b319689e554
2 files changed
+2
-2
sha1_name.c
+1
-1
@@ -749,7 +749,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
749
750
for (cp = name + len - 1; name + 2 <= cp; cp--) {
751
char ch = *cp;
752
- if (hexval(ch) & ~0377) {
752
+ if (!isxdigit(ch)) {
753
/* We must be looking at g in "SOMETHING-g"
754
* for it to be describe output.
755
*/
transport.c
+1
-1
@@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
117
return;
118
}
119
120
- if (hexval(buffer[0]) > 0xf)
120
+ if (!isxdigit(buffer[0]))
121
continue;
122
len = strlen(buffer);
123
if (len && buffer[len - 1] == '\n')