| 118 | } |
| 119 | |
| 120 | static int compare_tok(const jsmntok_t *a, const jsmntok_t *b, |
| 121 | const char *buffer) |
| 122 | { |
| 123 | int a_len = a->end - a->start, b_len = b->end - b->start, min_len, cmp; |
| 124 | |
| 125 | if (a_len > b_len) |
| 126 | min_len = b_len; |
| 127 | else |
| 128 | min_len = a_len; |
| 129 | |
| 130 | cmp = memcmp(buffer + a->start, buffer + b->start, min_len); |
| 131 | if (cmp != 0) |
| 132 | return cmp; |
| 133 | /* If equal, shorter one wins. */ |
| 134 | return a_len - b_len; |
| 135 | } |
| 136 | |
| 137 | static int compare_help(const jsmntok_t *const *a, |
| 138 | const jsmntok_t *const *b, |