eliminate global.cookie and the cache-invalidation which it enabled

This commit is contained in:
Enno Rehling 2015-11-22 12:50:10 +01:00
parent 73fc5a51b3
commit 35e7a0bc79
3 changed files with 1 additions and 9 deletions

View file

@ -1006,15 +1006,12 @@ void set_param(struct param **p, const char *key, const char *value)
const char * kv = (const char *)match; const char * kv = (const char *)match;
size_t vlen = strlen(kv + klen) + 1; size_t vlen = strlen(kv + klen) + 1;
cb_erase(&par->cb, kv, klen + vlen); cb_erase(&par->cb, kv, klen + vlen);
++global.cookie;
} }
} }
if (value) { if (value) {
char data[512]; char data[512];
size_t sz = pack_keyval(key, value, data, sizeof(data)); size_t sz = pack_keyval(key, value, data, sizeof(data));
if (cb_insert(&par->cb, data, sz) == CB_SUCCESS) { cb_insert(&par->cb, data, sz);
++global.cookie;
}
} }
} }
@ -1631,7 +1628,6 @@ void free_gamedata(void)
while (global.attribs) { while (global.attribs) {
a_remove(&global.attribs, global.attribs); a_remove(&global.attribs, global.attribs);
} }
++global.cookie; /* readgame() already does this, but sjust in case */
} }
const char * game_name(void) { const char * game_name(void) {

View file

@ -205,9 +205,6 @@ struct param;
const struct race * rc, int in_turn); const struct race * rc, int in_turn);
int(*maintenance) (const struct unit * u); int(*maintenance) (const struct unit * u);
} functions; } functions;
/* the following are some cached values, because get_param can be slow.
* you should almost never need to touch them */
int cookie;
} settings; } settings;
typedef struct helpmode { typedef struct helpmode {

View file

@ -1449,7 +1449,6 @@ int readgame(const char *filename, bool backup)
global.data_turn = turn; global.data_turn = turn;
log_debug(" - reading turn %d\n", turn); log_debug(" - reading turn %d\n", turn);
rng_init(turn); rng_init(turn);
++global.cookie;
READ_INT(&store, &nread); /* max_unique_id = ignore */ READ_INT(&store, &nread); /* max_unique_id = ignore */
READ_INT(&store, &nextborder); READ_INT(&store, &nextborder);