{"thread":{"id":"38769","subject":"[PATCH] use isxdigit() for checking if a character is a hexadecimal digit","startedAt":"2015-03-09T22:46:54Z","lastAt":"2015-03-09T22:46:54Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"257434","messageId":"54FE22DE.8090007@web.de","threadId":"38769","inReplyTo":null,"subject":"[PATCH] use isxdigit() for checking if a character is a hexadecimal digit","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2015-03-09T22:46:54Z","receivedAt":"2015-03-09T22:46:54Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use the standard function isxdigit() to make the intent clearer and\navoid using magic constants.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n sha1_name.c | 2 +-\n transport.c | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 95f9f8f..6d10f05 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -757,7 +757,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)\n \n \tfor (cp = name + len - 1; name + 2 <= cp; cp--) {\n \t\tchar ch = *cp;\n-\t\tif (hexval(ch) & ~0377) {\n+\t\tif (!isxdigit(ch)) {\n \t\t\t/* We must be looking at g in \"SOMETHING-g\"\n \t\t\t * for it to be describe output.\n \t\t\t */\ndiff --git a/transport.c b/transport.c\nindex 0694a7c..00f39d9 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)\n \t\t\treturn;\n \t\t}\n \n-\t\tif (hexval(buffer[0]) > 0xf)\n+\t\tif (!isxdigit(buffer[0]))\n \t\t\tcontinue;\n \t\tlen = strlen(buffer);\n \t\tif (len && buffer[len - 1] == '\\n')\n-- \n2.3.1\n"}]}