mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-23 04:56:54 +00:00
util: add git__ishex
git__ishex allows to check if a string is a hexadecimal representation. Signed-off-by: schu <schu-github@schulog.org>
This commit is contained in:
parent
b4b79ac3db
commit
905919e63b
@ -169,4 +169,13 @@ GIT_INLINE(int) git__fromhex(char h)
|
|||||||
return from_hex[(unsigned char) h];
|
return from_hex[(unsigned char) h];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GIT_INLINE(int) git__ishex(const char *str)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for (i=0; i<strlen(str); i++)
|
||||||
|
if (git__fromhex(str[i]) < 0)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* INCLUDE_util_h__ */
|
#endif /* INCLUDE_util_h__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user