From: Phillip Wood Date: Wed, 28 Jun 2023 13:15:08 GMT Subject: Re: [RFC PATCH 2/8] hex-ll: split out functionality from hex Message-ID: In-Reply-To: <20230627195251.1973421-3-calvinwan@google.com> Hi Calvin On 27/06/2023 20:52, Calvin Wan wrote: > Separate out hex functionality that doesn't require a hash algo into > hex-ll.[ch]. Since the hash algo is currently a global that sits in > repository, this separation removes that dependency for files that only > need basic hex manipulation functions. > > diff --git a/hex.h b/hex.h > index 7df4b3c460..c07c8b34c2 100644 > --- a/hex.h > +++ b/hex.h > @@ -2,22 +2,7 @@ > #define HEX_H > > #include "hash-ll.h" > - > -extern const signed char hexval_table[256]; > -static inline unsigned int hexval(unsigned char c) > -{ > - return hexval_table[c]; > -} > - > -/* > - * Convert two consecutive hexadecimal digits into a char. Return a > - * negative value on error. Don't run over the end of short strings. > - */ > -static inline int hex2chr(const char *s) > -{ > - unsigned int val = hexval(s[0]); > - return (val & ~0xf) ? val : (val << 4) | hexval(s[1]); > -} > +#include "hex-ll.h" I don't think any of the remaining declarations in hex.h depend on the ones that are moved to "hex-ll.h" so this include should probably be in "hex.c" rather than "hex.h" Best Wishes Phillip