]> git.ipfire.org Git - thirdparty/git.git/commitdiff
use isxdigit() for checking if a character is a hexadecimal digit
authorRené Scharfe <l.s.r@web.de>
Mon, 9 Mar 2015 22:46:54 +0000 (23:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Mar 2015 22:44:41 +0000 (15:44 -0700)
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>
sha1_name.c
transport.c

index c2c938c4e161fc6849a87a7a19336712f36f74ff..dc85aafeca28ad7c1948d2017e06f69a4105065e 100644 (file)
@@ -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--) {
                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 325f03e1eef97df296bb1cc9f7d2d33c218dde26..7ac0df21ead112b1e2b98117c13a5516d16a4bbd 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')