X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjsmn%2Fjsmn.c;h=a0f4f69c6710939fefb2c4d04cbfa5b0e5a19946;hb=2f4fecee7f595ff717929984ec98b8e5c2efbf2f;hp=d79f9a5ddb447d96d494d363ca62d7ae7f0b8e3c;hpb=4501d5aaebec2cba662a40bd1f9af763555d7101;p=16.git diff --git a/src/lib/jsmn/jsmn.c b/src/lib/jsmn/jsmn.c index d79f9a5d..a0f4f69c 100644 --- a/src/lib/jsmn/jsmn.c +++ b/src/lib/jsmn/jsmn.c @@ -1,14 +1,13 @@ #include -#include //fprintf for noisy debugging wwww #include "jsmn.h" /** * Allocates a fresh unused token from the token pull. */ -static jsmntok_t huge *jsmn_alloc_token(jsmn_parser huge *parser, - jsmntok_t huge *tokens, size_t num_tokens) { - jsmntok_t huge *tok; +static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, + jsmntok_t *tokens, size_t num_tokens) { + jsmntok_t *tok; if (parser->toknext >= num_tokens) { return NULL; } @@ -24,7 +23,7 @@ static jsmntok_t huge *jsmn_alloc_token(jsmn_parser huge *parser, /** * Fills token type and boundaries. */ -static void jsmn_fill_token(jsmntok_t huge *token, jsmntype_t type, +static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, int start, int end) { token->type = type; token->start = start; @@ -35,9 +34,9 @@ static void jsmn_fill_token(jsmntok_t huge *token, jsmntype_t type, /** * Fills next available token with JSON primitive. */ -static jsmnerr_t jsmn_parse_primitive(jsmn_parser huge *parser, const char huge *js, - size_t len, jsmntok_t huge *tokens, size_t num_tokens) { - jsmntok_t huge *token; +static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js, + size_t len, jsmntok_t *tokens, size_t num_tokens) { + jsmntok_t *token; int start; start = parser->pos; @@ -84,9 +83,9 @@ found: /** * Filsl next token with JSON string. */ -static jsmnerr_t jsmn_parse_string(jsmn_parser huge *parser, const char huge *js, - size_t len, jsmntok_t huge *tokens, size_t num_tokens) { - jsmntok_t huge *token; +static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js, + size_t len, jsmntok_t *tokens, size_t num_tokens) { + jsmntok_t *token; int start = parser->pos; @@ -151,21 +150,17 @@ static jsmnerr_t jsmn_parse_string(jsmn_parser huge *parser, const char huge *js /** * Parse JSON string and fill tokens. */ -jsmnerr_t jsmn_parse(jsmn_parser huge *parser, const char huge *js, size_t len, - jsmntok_t huge *tokens, unsigned int num_tokens) { +jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, + jsmntok_t *tokens, unsigned int num_tokens) { jsmnerr_t r; int i; - jsmntok_t huge *token; + jsmntok_t *token; int count = 0; - static unsigned long pee=0; for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) { char c; jsmntype_t type; -fprintf(stdout, "pee=%lu count=%u i=%d nt=%u\n", pee, count, i, num_tokens); -pee++; - c = js[parser->pos]; switch (c) { case '{': case '[': @@ -269,7 +264,7 @@ pee++; case 't': case 'f': case 'n' : /* And they must not be keys of the object */ if (tokens != NULL) { - jsmntok_t huge *t = &tokens[parser->toksuper]; + jsmntok_t *t = &tokens[parser->toksuper]; if (t->type == JSMN_OBJECT || (t->type == JSMN_STRING && t->size != 0)) { return JSMN_ERROR_INVAL; @@ -308,7 +303,7 @@ pee++; * Creates a new parser based over a given buffer with an array of tokens * available. */ -void jsmn_init(jsmn_parser huge *parser) { +void jsmn_init(jsmn_parser *parser) { parser->pos = 0; parser->toknext = 0; parser->toksuper = -1;