damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 54d40f7ffd163a593a009c5dcd34cdddc409facd
parent 2053033b257593519237fe3734e401a2cae58a59
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 25 Jul 2023 15:16:24 -0700

ndb: move hexchar into header

since it's used in a few places

Diffstat:
Mdamus-c/hex.c | 9---------
Mdamus-c/hex.h | 11+++++++++++
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/damus-c/hex.c b/damus-c/hex.c @@ -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; diff --git a/damus-c/hex.h b/damus-c/hex.h @@ -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 */