1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2010-12-02 21:29:05 +00:00
parent 921ac8d6dd
commit ac3a7458a8

View file

@ -1,7 +1,22 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <stdbool.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), static int parse_dec(int (*peek)(void *userp),
void (*pop)(void *userp), void (*pop)(void *userp),
@ -21,7 +36,7 @@ static int parse_dec(int (*peek)(void *userp),
} }
ch = (*peek)(userp); ch = (*peek)(userp);
if (!isdigit(ch)) if (!my_isdigit(ch))
return -1; return -1;
do do
@ -30,7 +45,7 @@ static int parse_dec(int (*peek)(void *userp),
(*pop)(userp); (*pop)(userp);
n++; n++;
ch = (*peek)(userp); ch = (*peek)(userp);
} while (isdigit(ch)); } while (my_isdigit(ch));
*vp = minus ? -v : v; *vp = minus ? -v : v;
return n; return n;
@ -46,7 +61,7 @@ static int parse_chars(int (*peek)(void *userp),
char *pt=vp; char *pt=vp;
while (!isspace((*peek)(userp))) while (!my_isspace((*peek)(userp)))
{ {
if(fake==false) if(fake==false)
*(pt++) = (*peek)(userp); *(pt++) = (*peek)(userp);
@ -71,7 +86,7 @@ static int parse_hex(int (*peek)(void *userp),
char ch; char ch;
ch = (*peek)(userp); ch = (*peek)(userp);
if (!isxdigit(ch)) if (!my_isxdigit(ch))
return -1; return -1;
do do
@ -86,7 +101,7 @@ static int parse_hex(int (*peek)(void *userp),
(*pop)(userp); (*pop)(userp);
n++; n++;
ch = (*peek)(userp); ch = (*peek)(userp);
} while (isxdigit(ch)); } while (my_isxdigit(ch));
*vp = v; *vp = v;
return n; return n;
@ -97,7 +112,7 @@ static int skip_spaces(int (*peek)(void *userp),
void *userp) void *userp)
{ {
int n = 0; int n = 0;
while (isspace((*peek)(userp))) { while (my_isspace((*peek)(userp))) {
n++; n++;
(*pop)(userp); (*pop)(userp);
} }