From f10cc81cf3e1d6cffdb36d9c094a544463ae1adf Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 25 Aug 2011 12:25:57 -0400 Subject: Dependency reduction. No logic changes. All regression tests pass. --- hex.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'hex.c') diff --git a/hex.c b/hex.c index 991673ff..5b7a673f 100644 --- a/hex.c +++ b/hex.c @@ -46,28 +46,8 @@ char /*@ observer @*/ *gpsd_hexdump(char *binbuf, size_t binbuflen) } } -int gpsd_hexpack( /*@in@*/ const char *src, /*@out@ */ char *dst, size_t len) -{ -/* hex2bin source string to destination - destination can be same as source */ - int i, k, l; - - /*@ -mustdefine @*/ - l = (int)(strlen(src) / 2); - if ((l < 1) || ((size_t) l > len)) - return -2; - - for (i = 0; i < l; i++) - if ((k = hex2bin(src + i * 2)) != -1) - dst[i] = (char)(k & 0xff); - else - return -1; - (void)memset(dst + i, '\0', (size_t) (len - i)); - return l; - /*@ +mustdefine @*/ -} - /*@ +charint -shiftimplementation @*/ -int hex2bin(const char *s) +static int hex2bin(const char *s) { int a, b; @@ -95,6 +75,26 @@ int hex2bin(const char *s) return ((a << 4) + b); } +int gpsd_hexpack( /*@in@*/ const char *src, /*@out@ */ char *dst, size_t len) +/* hex2bin source string to destination - destination can be same as source */ +{ + int i, k, l; + + /*@ -mustdefine @*/ + l = (int)(strlen(src) / 2); + if ((l < 1) || ((size_t) l > len)) + return -2; + + for (i = 0; i < l; i++) + if ((k = hex2bin(src + i * 2)) != -1) + dst[i] = (char)(k & 0xff); + else + return -1; + (void)memset(dst + i, '\0', (size_t) (len - i)); + return l; + /*@ +mustdefine @*/ +} + /*@ -charint +shiftimplementation @*/ ssize_t hex_escapes( /*@out@*/ char *cooked, const char *raw) -- cgit v1.2.1