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

Function get_first

ccan/ccan/timer/timer.c:256–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static const struct timer *get_first(struct timers *timers)
257{
258 /* We can have just far timers, for example. */
259 if (timers->level[0]) {
260 /* First search rest of lower buckets; we've already spilled
261 * so if we find one there we don't need to search further. */
262 unsigned int i, off = timers->base % PER_LEVEL;
263
264 for (i = off; i < PER_LEVEL; i++) {
265 struct list_head *h = &timers->level[0]->list[i];
266 if (!list_empty(h))
267 return find_first(h, 0, NULL);
268 }
269 }
270
271 /* From here on, we're searching non-normalized parts of the
272 * data structure, which is much subtler.
273 *
274 * So we brute force. */
275 return brute_force_first(timers);
276}
277
278static bool update_first(struct timers *timers)
279{

Callers 2

update_firstFunction · 0.85
mainFunction · 0.85

Calls 2

find_firstFunction · 0.85
brute_force_firstFunction · 0.85

Tested by 1

mainFunction · 0.68