From deb1cd2aba61791a6dcb11679e867f0abb477eb4 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Thu, 8 May 2014 15:30:10 +0200 Subject: [PATCH] unit: Do not cache unit divisor list result Now that we support multiple divisor variants caching no longer makes sense Signed-off-by: Thomas Graf --- src/unit.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/unit.c b/src/unit.c index 4bbc195..ab4cbd8 100644 --- a/src/unit.c +++ b/src/unit.c @@ -34,23 +34,17 @@ static LIST_HEAD(units); static struct list_head *get_flist(struct unit *unit) { - static struct list_head *cached_list = NULL; int div = UNIT_DEFAULT; - if (cached_list) - return cached_list; - if (cfg_getbool(cfg, "use_bit")) div = UNIT_BIT; else if (cfg_getbool(cfg, "use_si")) div = UNIT_SI; if (!list_empty(&unit->u_div[div])) - cached_list = &unit->u_div[div]; + return &unit->u_div[div]; else - cached_list = &unit->u_div[UNIT_DEFAULT]; - - return cached_list; + return &unit->u_div[UNIT_DEFAULT]; } struct unit *unit_lookup(const char *name)