X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Flikely%2Flikely.c;h=260864d36b2bf08fe784718bc265cd281beed030;hp=e4bee71b09c5f3230573ee40f356108f45dd5c39;hb=18636637ee013ef828cb04b2b7bb4a4922324475;hpb=9f8c65b28acba8e5eabea5d7abd98b19e62d06fe diff --git a/ccan/likely/likely.c b/ccan/likely/likely.c index e4bee71b..260864d3 100644 --- a/ccan/likely/likely.c +++ b/ccan/likely/likely.c @@ -88,11 +88,8 @@ static double right_ratio(const struct trace *t) return (double)t->right / t->count; } -static bool get_stats(void *elem, void *vinfo) +static bool get_stats(struct trace *trace, struct get_stats_info *info) { - struct trace *trace = elem; - struct get_stats_info *info = vinfo; - if (trace->count < info->min_hits) return false; @@ -116,7 +113,7 @@ const char *likely_stats(unsigned int min_hits, unsigned int percent) info.worst_ratio = 2; /* This is O(n), but it's not likely called that often. */ - hashtable_traverse(htable, get_stats, &info); + hashtable_traverse(htable, struct trace, get_stats, &info); if (info.worst_ratio * 100 > percent) return NULL;