forked from github/server
remove bad caching in get_race
This commit is contained in:
parent
07bbc022f4
commit
fbd596fbfa
1 changed files with 2 additions and 17 deletions
|
@ -75,30 +75,15 @@ static const char *racenames[MAXRACES] = {
|
|||
"clone"
|
||||
};
|
||||
|
||||
static race * race_cache[MAXRACES];
|
||||
|
||||
struct race *get_race(race_t rt) {
|
||||
static int cache = -1;
|
||||
const char * name;
|
||||
race * result = 0;
|
||||
|
||||
assert(rt < MAXRACES);
|
||||
name = racenames[rt];
|
||||
if (!name) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
if (cache_breaker != cache) {
|
||||
cache = cache_breaker;
|
||||
memset(race_cache, 0, sizeof(race_cache));
|
||||
return race_cache[rt] = rc_get_or_create(name);
|
||||
}
|
||||
else {
|
||||
result = race_cache[rt];
|
||||
if (!result) {
|
||||
result = race_cache[rt] = rc_get_or_create(name);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return rc_get_or_create(name);
|
||||
}
|
||||
|
||||
race_list *get_familiarraces(void)
|
||||
|
|
Loading…
Reference in a new issue