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

Function get_first

ccan/ccan/timer/timer.c:248–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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