Strategická: C: lepší alokace
This commit is contained in:
parent
bf5ed6b559
commit
d5242f5ba9
1 changed files with 3 additions and 3 deletions
|
@ -101,11 +101,11 @@ struct State
|
|||
// Ano, vím, že je to ošklivé, ale prostě parsovat JSON v C/C++ je za trest
|
||||
int r;
|
||||
jsmn_parser p;
|
||||
jsmntok_t t[10000]; /* We expect no more than this count of tokens (jsmn limitation)*/
|
||||
t_len = 100000000;
|
||||
jsmntok_t * t = new jsmntok_t[t_len]; /* We expect no more than this count of tokens (jsmn limitation)*/
|
||||
|
||||
jsmn_init(&p);
|
||||
r = jsmn_parse(&p, input_str, strlen(input_str), t,
|
||||
sizeof(t) / sizeof(t[0]));
|
||||
r = jsmn_parse(&p, input_str, strlen(input_str), t, t_len);
|
||||
assert(!(r < 0));
|
||||
|
||||
assert(!(r < 1 || t[0].type != JSMN_OBJECT));
|
||||
|
|
Loading…
Reference in a new issue