From 2eb9b5c5ea919e082e595772e0b30cd9b7d1de60 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 29 Aug 2016 13:49:39 +0100 Subject: [PATCH] delete dead code (dbrace) --- src/kernel/race.c | 16 ---------------- src/kernel/race.h | 1 - src/util/language.c | 3 ++- src/util/log.c | 1 + 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/kernel/race.c b/src/kernel/race.c index 4a6546f46..fdc720e2e 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -303,22 +303,6 @@ variant read_race_reference(struct storage *store) return result; } -/** Returns the English name of the race, which is what the database uses. -*/ -const char *dbrace(const struct race *rc) -{ - static char zText[32]; // FIXME: static return value - char *zPtr = zText; - - /* the english names are all in ASCII, so we don't need to worry about UTF8 */ - strlcpy(zText, (const char *)LOC(get_locale("en"), rc_name_s(rc, NAME_SINGULAR)), sizeof(zText)); - while (*zPtr) { - *zPtr = (char)(toupper(*zPtr)); - ++zPtr; - } - return zText; -} - void register_race_description_function(race_desc_func func, const char *name) { register_function((pf_generic)func, name); } diff --git a/src/kernel/race.h b/src/kernel/race.h index 2d1648b7d..b1632f62d 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -257,7 +257,6 @@ extern "C" { variant read_race_reference(struct storage *store); const char *raceprefix(const struct unit *u); - const char *dbrace(const struct race *rc); void register_race_name_function(race_name_func, const char *); void register_race_description_function(race_desc_func, const char *); char * race_namegen(const struct race *rc, struct unit *u); diff --git a/src/util/language.c b/src/util/language.c index 03d65c164..d8b899742 100644 --- a/src/util/language.c +++ b/src/util/language.c @@ -22,11 +22,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "log.h" #include "strings.h" #include "umlaut.h" +#include "assert.h" #include #include #include -#include #include #define SMAXHASH 2048 @@ -84,6 +84,7 @@ locale *get_or_create_locale(const char *name) } } *lp = l = (locale *)calloc(sizeof(locale), 1); + assert_alloc(l); l->hashkey = hkey; l->name = _strdup(name); l->index = nextlocaleindex++; diff --git a/src/util/log.c b/src/util/log.c index cb358519c..a0985ea46 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -138,6 +138,7 @@ static int check_dupe(const char *format, int level) static char last_message[32]; /* STATIC_XCALL: used across calls */ static int dupes = 0; /* STATIC_XCALL: used across calls */ if (strncmp(last_message, format, sizeof(last_message)) == 0) { + // TODO: C6054: String 'last_message' might not be zero - terminated. ++dupes; return 1; }