Skip to content

Commit 6f75d45

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 282616c commit 6f75d45

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sha1_name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
749749

750750
for (cp = name + len - 1; name + 2 <= cp; cp--) {
751751
char ch = *cp;
752-
if (hexval(ch) & ~0377) {
752+
if (!isxdigit(ch)) {
753753
/* We must be looking at g in "SOMETHING-g"
754754
* for it to be describe output.
755755
*/

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
117117
return;
118118
}
119119

120-
if (hexval(buffer[0]) > 0xf)
120+
if (!isxdigit(buffer[0]))
121121
continue;
122122
len = strlen(buffer);
123123
if (len && buffer[len - 1] == '\n')

0 commit comments

Comments
 (0)