From 35e7a0bc7918d2a26724d9fecdb1cbbd4ea6ce37 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Nov 2015 12:50:10 +0100 Subject: [PATCH] eliminate global.cookie and the cache-invalidation which it enabled --- src/kernel/config.c | 6 +----- src/kernel/config.h | 3 --- src/kernel/save.c | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 9aa30958e..e343b9628 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1006,15 +1006,12 @@ void set_param(struct param **p, const char *key, const char *value) const char * kv = (const char *)match; size_t vlen = strlen(kv + klen) + 1; cb_erase(&par->cb, kv, klen + vlen); - ++global.cookie; } } if (value) { char data[512]; size_t sz = pack_keyval(key, value, data, sizeof(data)); - if (cb_insert(&par->cb, data, sz) == CB_SUCCESS) { - ++global.cookie; - } + cb_insert(&par->cb, data, sz); } } @@ -1631,7 +1628,6 @@ void free_gamedata(void) while (global.attribs) { a_remove(&global.attribs, global.attribs); } - ++global.cookie; /* readgame() already does this, but sjust in case */ } const char * game_name(void) { diff --git a/src/kernel/config.h b/src/kernel/config.h index 2308409d6..b39807a33 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -205,9 +205,6 @@ struct param; const struct race * rc, int in_turn); int(*maintenance) (const struct unit * u); } functions; - /* the following are some cached values, because get_param can be slow. - * you should almost never need to touch them */ - int cookie; } settings; typedef struct helpmode { diff --git a/src/kernel/save.c b/src/kernel/save.c index fd32a567d..f065743f4 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1449,7 +1449,6 @@ int readgame(const char *filename, bool backup) global.data_turn = turn; log_debug(" - reading turn %d\n", turn); rng_init(turn); - ++global.cookie; READ_INT(&store, &nread); /* max_unique_id = ignore */ READ_INT(&store, &nextborder);