-rw-r--r-- | shared.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -110,6 +110,19 @@ void *cgit_free_commitinfo(struct commitinfo *info) free(info->committer); free(info->committer_email); free(info->subject); free(info); return NULL; } + +int hextoint(char c) +{ + if (c >= 'a' && c <= 'f') + return 10 + c - 'a'; + else if (c >= 'A' && c <= 'F') + return 10 + c - 'A'; + else if (c >= '0' && c <= '9') + return c - '0'; + else + return -1; +} + |