Merge branch 'rs/use-isxdigit'
authorJunio C Hamano <gitster@pobox.com>
Fri, 20 Mar 2015 20:11:52 +0000 (13:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Mar 2015 20:11:52 +0000 (13:11 -0700)
Code cleanup.

* rs/use-isxdigit:
use isxdigit() for checking if a character is a hexadecimal digit

sha1_name.c
transport.c
index 95f9f8fa1a72693757bbafe0f2a7773d8ae2de05..6d10f052b5050c64de5589733c2a8600e2ddb3dc 100644 (file)
@@ -757,7 +757,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
 
        for (cp = name + len - 1; name + 2 <= cp; cp--) {
                char ch = *cp;
-               if (hexval(ch) & ~0377) {
+               if (!isxdigit(ch)) {
                        /* We must be looking at g in "SOMETHING-g"
                         * for it to be describe output.
                         */
index 0694a7cf3e4a8bd7bec9fefcd440d65423021a1b..00f39d9f5ba8c024ec2b9c6c2a054a0045eadbbb 100644 (file)
@@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
                        return;
                }
 
-               if (hexval(buffer[0]) > 0xf)
+               if (!isxdigit(buffer[0]))
                        continue;
                len = strlen(buffer);
                if (len && buffer[len - 1] == '\n')