diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-12-02 21:29:05 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-12-02 21:29:05 +0000 |
commit | ac3a7458a867b32024e08aac0bf574a5f8f0d47c (patch) | |
tree | 4ac86caa7355355a42efd5ba04f1e2640c979651 | |
parent | 921ac8d6dde6df60cce9346232762794fb9efa05 (diff) | |
download | rockbox-ac3a7458a867b32024e08aac0bf574a5f8f0d47c.tar.gz rockbox-ac3a7458a867b32024e08aac0bf574a5f8f0d47c.zip |
Fix reds, inclusion of C files into plugins is tricky.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28724 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/libc/sscanf.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/firmware/libc/sscanf.c b/firmware/libc/sscanf.c index 5bb08d8268..1bbb5abcbf 100644 --- a/firmware/libc/sscanf.c +++ b/firmware/libc/sscanf.c @@ -1,7 +1,22 @@ #include <stdarg.h> #include <string.h> #include <stdbool.h> -#include <ctype.h> + +static inline bool my_isspace(char c) +{ + return (c == ' ') || (c == '\t') || (c == '\n'); +} + +static inline bool my_isdigit(char c) +{ + return (c >= '0') && (c <= '9'); +} + +static inline bool my_isxdigit(char c) +{ + return ((c >= '0') && (c <= '9')) + || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F')); +} static int parse_dec(int (*peek)(void *userp), void (*pop)(void *userp), @@ -21,7 +36,7 @@ static int parse_dec(int (*peek)(void *userp), } ch = (*peek)(userp); - if (!isdigit(ch)) + if (!my_isdigit(ch)) return -1; do @@ -30,7 +45,7 @@ static int parse_dec(int (*peek)(void *userp), (*pop)(userp); n++; ch = (*peek)(userp); - } while (isdigit(ch)); + } while (my_isdigit(ch)); *vp = minus ? -v : v; return n; @@ -46,7 +61,7 @@ static int parse_chars(int (*peek)(void *userp), char *pt=vp; - while (!isspace((*peek)(userp))) + while (!my_isspace((*peek)(userp))) { if(fake==false) *(pt++) = (*peek)(userp); @@ -71,7 +86,7 @@ static int parse_hex(int (*peek)(void *userp), char ch; ch = (*peek)(userp); - if (!isxdigit(ch)) + if (!my_isxdigit(ch)) return -1; do @@ -86,7 +101,7 @@ static int parse_hex(int (*peek)(void *userp), (*pop)(userp); n++; ch = (*peek)(userp); - } while (isxdigit(ch)); + } while (my_isxdigit(ch)); *vp = v; return n; @@ -97,7 +112,7 @@ static int skip_spaces(int (*peek)(void *userp), void *userp) { int n = 0; - while (isspace((*peek)(userp))) { + while (my_isspace((*peek)(userp))) { n++; (*pop)(userp); } |