diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-04-09 14:45:31 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-04-09 14:45:31 +0100 |
commit | 92beef8b1e1c73348d48edbb5cff37b47c4e2f81 (patch) | |
tree | b5301a9cd573eb093c693a10c4c3e39596281098 | |
parent | 9f4001740f061f29c65835c6f7efcab50c27db13 (diff) |
tidying
-rw-r--r-- | src/src/search.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/src/search.c b/src/src/search.c index 2a60fc78a..d929322ba 100644 --- a/src/src/search.c +++ b/src/src/search.c @@ -545,16 +545,9 @@ else else if (do_cache) { - int len = keylength + 1; - - if (t) /* Previous, out-of-date cache entry. Update with the */ - { /* new result and forget the old one */ - e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache; - e->opts = opts; - e->data.ptr = data; - } - else + if (!t) /* No existing entry. Create new one. */ { + int len = keylength + 1; e = store_get(sizeof(expiring_data) + sizeof(tree_node) + len, is_tainted(keystring)); e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache; e->opts = opts; @@ -564,6 +557,11 @@ else t->data.ptr = e; tree_insertnode(&c->item_cache, t); } + /* Else previous, out-of-date cache entry. Update with the */ + /* new result and forget the old one */ + e->expiry = do_cache == UINT_MAX ? 0 : time(NULL)+do_cache; + e->opts = opts; + e->data.ptr = data; } /* If caching was disabled, empty the cache tree. We just set the cache |