Compare commits

..

12 Commits

@ -158,7 +158,7 @@ the `js` string.
A non-negative return value of `jsmn_parse` is the number of tokens actually
used by the parser.
Passing NULL instead of the tokens array would not store parsing results, but
instead the function will return the number of tokens needed to parse the given
instead the function will return the value of tokens needed to parse the given
string. This can be useful if you don't know yet how many tokens to allocate.
If something goes wrong, you will get an error. Error will be one of these:

@ -66,7 +66,7 @@ enum jsmnerr {
* start start position in JSON data string
* end end position in JSON data string
*/
typedef struct jsmntok {
typedef struct {
jsmntype_t type;
int start;
int end;
@ -80,7 +80,7 @@ typedef struct jsmntok {
* JSON parser. Contains an array of token blocks available. Also stores
* the string being parsed now and current position in that string.
*/
typedef struct jsmn_parser {
typedef struct {
unsigned int pos; /* offset in the JSON string */
unsigned int toknext; /* next token to allocate */
int toksuper; /* superior token node, e.g. parent object or array */
@ -154,9 +154,6 @@ static int jsmn_parse_primitive(jsmn_parser *parser, const char *js,
case ']':
case '}':
goto found;
default:
/* to quiet a warning from gcc*/
break;
}
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
parser->pos = start;

@ -8,13 +8,13 @@ static int vtokeq(const char *s, jsmntok_t *t, unsigned long numtok,
if (numtok > 0) {
unsigned long i;
int start, end, size;
jsmntype_t type;
int type;
char *value;
size = -1;
value = NULL;
for (i = 0; i < numtok; i++) {
type = va_arg(ap, jsmntype_t);
type = va_arg(ap, int);
if (type == JSMN_STRING) {
value = va_arg(ap, char *);
size = va_arg(ap, int);
@ -61,7 +61,7 @@ static int vtokeq(const char *s, jsmntok_t *t, unsigned long numtok,
return 1;
}
static int tokeq(const char *s, jsmntok_t *tokens, unsigned long numtok, ...) {
static int tokeq(const char *s, jsmntok_t *tokens, int numtok, ...) {
int ok;
va_list args;
va_start(args, numtok);
@ -70,7 +70,7 @@ static int tokeq(const char *s, jsmntok_t *tokens, unsigned long numtok, ...) {
return ok;
}
static int parse(const char *s, int status, unsigned long numtok, ...) {
static int parse(const char *s, int status, int numtok, ...) {
int r;
int ok = 1;
va_list args;

Loading…
Cancel
Save