]> 4ch.mooo.com Git - 16.git/commitdiff
modified: src/lib/jsmn/example/MAPTEST2.EXE
authorsparky4 <sparky4@cock.li>
Sun, 22 Mar 2015 20:10:15 +0000 (15:10 -0500)
committersparky4 <sparky4@cock.li>
Sun, 22 Mar 2015 20:10:15 +0000 (15:10 -0500)
modified:   src/lib/jsmn/example/maptest2.c

src/lib/jsmn/example/MAPTEST2.EXE
src/lib/jsmn/example/maptest2.c

index 7c9d253ba79e492f3eca1464c0be2ea04a444a4e..5773caa3b1116937bd11d81c72ab55627ed35662 100644 (file)
Binary files a/src/lib/jsmn/example/MAPTEST2.EXE and b/src/lib/jsmn/example/MAPTEST2.EXE differ
index 41e2544ab65732de4fb9ec014cb6484993361671..cde3f0df4df133326cd061558d5e1bdd4d902f6d 100644 (file)
@@ -14,8 +14,10 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) {
        if (count == 0) {
                return 0;
        }
+       //what the fuck is going on here?
        if (t->type == JSMN_PRIMITIVE) {
                printf("%.*s", t->end - t->start, js+t->start);
+               printf("%s\n", js+t->start);
                return 1;
        } else if (t->type == JSMN_STRING) {
                printf("'%.*s'", t->end - t->start, js+t->start);
@@ -45,6 +47,14 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) {
        return 0;
 }
 
+static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
+       if (tok->type == JSMN_STRING && (int) strlen(s) == tok->end - tok->start &&
+                       strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
+               return 0;
+       }
+       return -1;
+}
+
 int main() {
        FILE *fh = fopen("../../../../data/test.map", "r");
        int r;