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

Function brute_force_first

ccan/ccan/timer/timer.c:219–246  ·  view source on GitHub ↗

FIXME: Suboptimal */

Source from the content-addressed store, hash-verified

217
218/* FIXME: Suboptimal */
219static const struct timer *brute_force_first(struct timers *timers)
220{
221 unsigned int l, i;
222 const struct timer *found = NULL;
223
224 for (l = 0; l < ARRAY_SIZE(timers->level) && timers->level[l]; l++) {
225 const struct timer *t = NULL;
226
227 /* Do we know they don't have a better one? */
228 if (!level_may_beat(timers, l, found))
229 continue;
230
231 /* Find first timer on this level. */
232 for (i = 0; i < PER_LEVEL; i++)
233 t = find_first(&timers->level[l]->list[i], l, t);
234
235 found = first_for_level(timers, l, t, found);
236 }
237
238 /* Check (and update) far list if there's a chance. */
239 l = ARRAY_SIZE(timers->level);
240 if (level_may_beat(timers, l, found)) {
241 const struct timer *t = find_first(&timers->far, l, NULL);
242 found = first_for_level(timers, l, t, found);
243 }
244
245 return found;
246}
247
248static const struct timer *get_first(struct timers *timers)
249{

Callers 1

get_firstFunction · 0.85

Calls 3

level_may_beatFunction · 0.85
find_firstFunction · 0.85
first_for_levelFunction · 0.85

Tested by

no test coverage detected