aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-28 14:53:31 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-29 08:00:32 (GMT)
commitc86bf160a7f47998b39aace6bdaf2a0d35909f11 (patch)
treed5c2d6a7c480595c54261494df67bde6f2a434d8 /src
parentbff3ac5b3cff45ee37805458c34028070144391a (diff)
downloadhostap-c86bf160a7f47998b39aace6bdaf2a0d35909f11.zip
hostap-c86bf160a7f47998b39aace6bdaf2a0d35909f11.tar.gz
hostap-c86bf160a7f47998b39aace6bdaf2a0d35909f11.tar.bz2
Replace unnecessary hex_value() with hex2byte()
There is no need to maintain two functions for doing the same type of hex-to-binary conversion. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r--src/wps/httpread.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/wps/httpread.c b/src/wps/httpread.c
index ad4f4a1..e2f7c7c 100644
--- a/src/wps/httpread.c
+++ b/src/wps/httpread.c
@@ -129,19 +129,6 @@ static int word_eq(char *s1, char *s2)
}
-/* convert hex to binary
- * Requires that c have been previously tested true with isxdigit().
- */
-static int hex_value(int c)
-{
- if (isdigit(c))
- return c - '0';
- if (islower(c))
- return 10 + c - 'a';
- return 10 + c - 'A';
-}
-
-
static void httpread_timeout_handler(void *eloop_data, void *user_ctx);
/* httpread_destroy -- if h is non-NULL, clean up
@@ -295,8 +282,7 @@ static int httpread_hdr_analyze(struct httpread *h)
int c = *rawuri;
if (c == '%' &&
isxdigit(rawuri[1]) && isxdigit(rawuri[2])) {
- *uri++ = (hex_value(rawuri[1]) << 4) |
- hex_value(rawuri[2]);
+ *uri++ = hex2byte(rawuri + 1);
rawuri += 3;
} else {
*uri++ = c;