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 <tgraf@suug.ch>
This commit is contained in:
parent
fd461f6568
commit
deb1cd2aba
10
src/unit.c
10
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user