X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/05b13194b4b40a2614692125d5037ef20c5fb20e..52e605caf573fa20fdd4fbac5e1cc69b7740b1f5:/shared.c diff --git a/shared.c b/shared.c index 7def51a..e4595fa 100644 --- a/shared.c +++ b/shared.c @@ -113,3 +113,16 @@ void *cgit_free_commitinfo(struct commitinfo *info) 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; +} +