MCPcopy Create free account
hub / github.com/ElementsProject/lightning / compare_tok

Function compare_tok

cli/lightning-cli.c:120–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120static 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
137static int compare_help(const jsmntok_t *const *a,
138 const jsmntok_t *const *b,

Callers 1

compare_helpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected