diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-08-07 01:03:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-08-07 01:03:33 +0000 |
commit | 380f32f07db89b94a93f755af9a5a77b81b9dab9 (patch) | |
tree | 6c506b4055da8369dd6ccf079a84ebb13d50c3e0 /src/common | |
parent | 9952b37456c03b09e5768aaf7e3cf8baa2353d84 (diff) | |
download | tor-380f32f07db89b94a93f755af9a5a77b81b9dab9.tar tor-380f32f07db89b94a93f755af9a5a77b81b9dab9.tar.gz |
hex_encode is obsoleted by base16_encode, and never actually worked in the first place. (Thanks to Timo Lindfors for noticing the never-actually-worked part.)
svn:r2175
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 18 | ||||
-rw-r--r-- | src/common/util.h | 1 |
2 files changed, 1 insertions, 18 deletions
diff --git a/src/common/util.c b/src/common/util.c index 252f566de..717285bab 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -234,22 +234,6 @@ void set_uint32(char *cp, uint32_t v) } #endif -/** Encode the first <b>fromlen</b> bytes stored at <b>from</b> in hexidecimal; - * write the result as a NUL-terminated string to <b>to</b>. <b>to</b> must - * have at least (2*fromlen)+1 bytes of free space. - */ -void hex_encode(const char *from, int fromlen, char *to) -{ - const unsigned char *fp = from; - static const char TABLE[] = "0123456789abcdef"; - tor_assert(from && fromlen>=0 && to); - while (fromlen--) { - *to++ = TABLE[*fp >> 4]; - *to++ = TABLE[*fp & 7]; - ++fp; - } - *to = '\0'; -} /** Return a pointer to a NUL-terminated hexidecimal string encoding * the first <b>fromlen</b> bytes of <b>from</b>. (fromlen must be \<= 32.) The @@ -261,7 +245,7 @@ const char *hex_str(const char *from, int fromlen) static char buf[65]; if (fromlen>(sizeof(buf)-1)/2) fromlen = (sizeof(buf)-1)/2; - hex_encode(from,fromlen,buf); + base16_encode(buf,64,from,fromlen); return buf; } diff --git a/src/common/util.h b/src/common/util.h index 8ee05b2fc..4dafccc52 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -133,7 +133,6 @@ void set_uint32(char *cp, uint32_t v); #endif #endif -void hex_encode(const char *from, int fromlen, char *to); const char *hex_str(const char *from, int fromlen); /** Generic resizeable array. */ |