From 1abadee3fd1c15f3720003c411ec6043c29d7c09 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 22 Jun 2018 09:23:30 -0400 Subject: Extract key string manipulation functions into a new library. --- src/common/util_format.c | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'src/common/util_format.c') diff --git a/src/common/util_format.c b/src/common/util_format.c index 713e87129c..8b299725a4 100644 --- a/src/common/util_format.c +++ b/src/common/util_format.c @@ -465,39 +465,6 @@ base16_encode(char *dest, size_t destlen, const char *src, size_t srclen) *cp = '\0'; } -/** Helper: given a hex digit, return its value, or -1 if it isn't hex. */ -static inline int -hex_decode_digit_(char c) -{ - switch (c) { - case '0': return 0; - case '1': return 1; - case '2': return 2; - case '3': return 3; - case '4': return 4; - case '5': return 5; - case '6': return 6; - case '7': return 7; - case '8': return 8; - case '9': return 9; - case 'A': case 'a': return 10; - case 'B': case 'b': return 11; - case 'C': case 'c': return 12; - case 'D': case 'd': return 13; - case 'E': case 'e': return 14; - case 'F': case 'f': return 15; - default: - return -1; - } -} - -/** Helper: given a hex digit, return its value, or -1 if it isn't hex. */ -int -hex_decode_digit(char c) -{ - return hex_decode_digit_(c); -} - /** Given a hexadecimal string of srclen bytes in src, decode * it and store the result in the destlen-byte buffer at dest. * Return the number of bytes decoded on success, -1 on failure. If @@ -520,8 +487,8 @@ base16_decode(char *dest, size_t destlen, const char *src, size_t srclen) end = src+srclen; while (src