diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-05-08 15:30:10 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2014-05-08 15:30:10 +0200 |
commit | deb1cd2aba61791a6dcb11679e867f0abb477eb4 (patch) | |
tree | efaf3243a4e34a201944907f9084564572a66809 | |
parent | fd461f6568f4deefc870afeeb1860bb3f04cef93 (diff) |
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>
-rw-r--r-- | src/unit.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -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) |