MCPcopy Create free account
hub / github.com/IBM/Project_CodeNet / jsmn_alloc_token

Function jsmn_alloc_token

tools/json-graph/src/jsmn.h:106–120  ·  view source on GitHub ↗

* Allocates a fresh unused token from the token pool. */

Source from the content-addressed store, hash-verified

104 * Allocates a fresh unused token from the token pool.
105 */
106static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, jsmntok_t *tokens,
107 const size_t num_tokens) {
108 jsmntok_t *tok;
109 if (parser->toknext >= num_tokens) {
110 return NULL;
111 }
112 tok = &tokens[parser->toknext++];
113 tok->type = JSMN_UNDEFINED;
114 tok->start = tok->end = -1;
115 tok->size = 0;
116#ifdef JSMN_PARENT_LINKS
117 tok->parent = -1;
118#endif
119 return tok;
120}
121
122/**
123 * Fills token type and boundaries.

Callers 3

jsmn_parse_primitiveFunction · 0.85
jsmn_parse_stringFunction · 0.85
jsmn_parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected