|
|
|
@ -27,6 +27,7 @@ static inline void *realloc_it(void *ptrmem, size_t size) {
|
|
|
|
|
|
|
|
|
|
static int dump(const char *js, jsmntok_t *t, size_t count, int indent) {
|
|
|
|
|
int i, j, k;
|
|
|
|
|
jsmntok_t *key;
|
|
|
|
|
if (count == 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -40,11 +41,15 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) {
|
|
|
|
|
printf("\n");
|
|
|
|
|
j = 0;
|
|
|
|
|
for (i = 0; i < t->size; i++) {
|
|
|
|
|
for (k = 0; k < indent; k++)
|
|
|
|
|
for (k = 0; k < indent; k++) {
|
|
|
|
|
printf(" ");
|
|
|
|
|
j += dump(js, t + 1 + j, count - j, indent + 1);
|
|
|
|
|
printf(": ");
|
|
|
|
|
j += dump(js, t + 1 + j, count - j, indent + 1);
|
|
|
|
|
}
|
|
|
|
|
key = t + 1 + j;
|
|
|
|
|
j += dump(js, key, count - j, indent + 1);
|
|
|
|
|
if (key->size > 0) {
|
|
|
|
|
printf(": ");
|
|
|
|
|
j += dump(js, t + 1 + j, count - j, indent + 1);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
return j + 1;
|
|
|
|
@ -52,8 +57,9 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) {
|
|
|
|
|
j = 0;
|
|
|
|
|
printf("\n");
|
|
|
|
|
for (i = 0; i < t->size; i++) {
|
|
|
|
|
for (k = 0; k < indent - 1; k++)
|
|
|
|
|
for (k = 0; k < indent - 1; k++) {
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
printf(" - ");
|
|
|
|
|
j += dump(js, t + 1 + j, count - j, indent + 1);
|
|
|
|
|
printf("\n");
|
|
|
|
|