Thread (72 messages) 72 messages, 8 authors, 2024-02-29

Re: [RFC PATCH 2/8] hex-ll: split out functionality from hex

flat view

From: Phillip Wood <hidden>
Date: 2023-06-28 13:15:18

Hi Calvin

On 27/06/2023 20:52, Calvin Wan wrote:
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help