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

Function check_distinct

common/json_param.c:210–223  ·  view source on GitHub ↗

* Make sure 2 sequential items in @params are not equal (based on * provided comparator). */

Source from the content-addressed store, hash-verified

208 * provided comparator).
209 */
210static bool check_distinct(struct param *params,
211 int (*compar) (const struct param *a,
212 const struct param *b, void *unused))
213{
214 struct param *first = params;
215 struct param *last = first + tal_count(params);
216 first++;
217 while (first != last) {
218 if (compar(first - 1, first, NULL) == 0)
219 return false;
220 first++;
221 }
222 return true;
223}
224
225static bool check_unique(struct param *copy,
226 int (*compar) (const struct param *a,

Callers 2

check_uniqueFunction · 0.85
check_paramsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected