1
0
mirror of git://jb55.com/damus synced 2024-09-29 16:30:44 +00:00

ndb: move hexchar into header

since it's used in a few places
This commit is contained in:
William Casarin 2023-07-25 15:16:24 -07:00
parent 2053033b25
commit 54d40f7ffd
2 changed files with 11 additions and 9 deletions

View File

@ -39,15 +39,6 @@ bool hex_decode(const char *str, size_t slen, void *buf, size_t bufsize)
return slen == 0 && bufsize == 0;
}
static char hexchar(unsigned int val)
{
if (val < 10)
return '0' + val;
if (val < 16)
return 'a' + val - 10;
abort();
}
bool hex_encode(const void *buf, size_t bufsize, char *dest, size_t destsize)
{
size_t i;

View File

@ -70,4 +70,15 @@ static inline size_t hex_data_size(size_t strlen)
{
return strlen / 2;
}
static inline char hexchar(unsigned int val)
{
if (val < 10)
return '0' + val;
if (val < 16)
return 'a' + val - 10;
abort();
}
#endif /* CCAN_HEX_H */