version 1.1.2.4, 2017/11/28 00:46:53
|
version 1.1.2.5, 2017/11/28 02:00:45
|
Line 536 json_token2array(const char *jstr, jtok_t * __restrict
|
Line 536 json_token2array(const char *jstr, jtok_t * __restrict
|
return NULL; |
return NULL; |
|
|
siz = tok->tok_size; |
siz = tok->tok_size; |
if (!siz && tok->tok_type != J_ARRAY && tok->tok_type != J_OBJECT) | if (!siz && json_toktype(tok) != J_ARRAY && json_toktype(tok) != J_OBJECT) |
siz++; |
siz++; |
|
|
arr = ait_allocVars(siz); |
arr = ait_allocVars(siz); |
Line 545 json_token2array(const char *jstr, jtok_t * __restrict
|
Line 545 json_token2array(const char *jstr, jtok_t * __restrict
|
|
|
if (tok->tok_type == J_STRING || tok->tok_type == J_VALUE) { |
if (tok->tok_type == J_STRING || tok->tok_type == J_VALUE) { |
v = ait_getVars(&arr, 0); |
v = ait_getVars(&arr, 0); |
AIT_SET_STRSIZ(v, tok->tok_end - tok->tok_start); | AIT_SET_STRSIZ(v, json_toklen(tok)); |
strncpy(AIT_GET_STR(v), jstr + tok->tok_start, AIT_LEN(v) - 1); | json_tokstrcpy(AIT_GET_STR(v), jstr, tok); |
} else if (tok->tok_type == J_ARRAY) { |
} else if (tok->tok_type == J_ARRAY) { |
for (i = 0; i < tok->tok_size; i++) { |
for (i = 0; i < tok->tok_size; i++) { |
t = &tok[i + 1]; |
t = &tok[i + 1]; |
v = ait_getVars(&arr, i); |
v = ait_getVars(&arr, i); |
AIT_SET_STRSIZ(v, t->tok_end - t->tok_start); | AIT_SET_STRSIZ(v, json_toklen(t)); |
strncpy(AIT_GET_STR(v), jstr + t->tok_start, AIT_LEN(v) - 1); | json_tokstrcpy(AIT_GET_STR(v), jstr, t); |
} |
} |
} else { |
} else { |
/* todo for object */ |
/* todo for object */ |