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>
This commit is contained in:
parent
282616c72d
commit
6f75d45b24
@ -749,7 +749,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
|
|||||||
|
|
||||||
for (cp = name + len - 1; name + 2 <= cp; cp--) {
|
for (cp = name + len - 1; name + 2 <= cp; cp--) {
|
||||||
char ch = *cp;
|
char ch = *cp;
|
||||||
if (hexval(ch) & ~0377) {
|
if (!isxdigit(ch)) {
|
||||||
/* We must be looking at g in "SOMETHING-g"
|
/* We must be looking at g in "SOMETHING-g"
|
||||||
* for it to be describe output.
|
* for it to be describe output.
|
||||||
*/
|
*/
|
||||||
|
@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hexval(buffer[0]) > 0xf)
|
if (!isxdigit(buffer[0]))
|
||||||
continue;
|
continue;
|
||||||
len = strlen(buffer);
|
len = strlen(buffer);
|
||||||
if (len && buffer[len - 1] == '\n')
|
if (len && buffer[len - 1] == '\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user