diff options
Diffstat (limited to 'contrib/ntp/libjsmn/jsmn.h')
-rw-r--r-- | contrib/ntp/libjsmn/jsmn.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/ntp/libjsmn/jsmn.h b/contrib/ntp/libjsmn/jsmn.h index 03b2c1a..95fb2ca 100644 --- a/contrib/ntp/libjsmn/jsmn.h +++ b/contrib/ntp/libjsmn/jsmn.h @@ -1,6 +1,12 @@ #ifndef __JSMN_H_ #define __JSMN_H_ +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + /** * JSON type identifier. Basic types are: * o Object @@ -21,9 +27,7 @@ typedef enum { /* Invalid character inside JSON string */ JSMN_ERROR_INVAL = -2, /* The string is not a full JSON packet, more bytes expected */ - JSMN_ERROR_PART = -3, - /* Everything was fine */ - JSMN_SUCCESS = 0 + JSMN_ERROR_PART = -3 } jsmnerr_t; /** @@ -48,7 +52,7 @@ typedef struct { */ typedef struct { unsigned int pos; /* offset in the JSON string */ - int toknext; /* next token to allocate */ + unsigned int toknext; /* next token to allocate */ int toksuper; /* superior token node, e.g parent object or array */ } jsmn_parser; @@ -61,7 +65,11 @@ void jsmn_init(jsmn_parser *parser); * Run JSON parser. It parses a JSON data string into and array of tokens, each describing * a single JSON object. */ -jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, +jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens); +#ifdef __cplusplus +} +#endif + #endif /* __JSMN_H_ */ |