From 9b645bf46cb9921224eaa16b424455071ac71716 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 1 Dec 2015 12:24:22 +0100 Subject: [PATCH] issue #419, eliminate language_struct.h, make the struct module-private --- src/sqlite.c | 4 ++-- src/util/language.c | 20 ++++++++++++++++++-- src/util/language_struct.h | 27 --------------------------- 3 files changed, 20 insertions(+), 31 deletions(-) delete mode 100644 src/util/language_struct.h diff --git a/src/sqlite.c b/src/sqlite.c index 50b4024c8..9eecb2fa8 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -129,7 +129,7 @@ static void update_faction(sqlite3 *db, const faction *f) { sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 3, f->name, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 4, f->email, -1, SQLITE_STATIC); - sqlite3_bind_text(stmt, 5, f->locale->name, -1, SQLITE_STATIC); + sqlite3_bind_text(stmt, 5, locale_name(f->locale), -1, SQLITE_STATIC); sqlite3_bind_int(stmt, 6, turn); sqlite3_step(stmt); sqlite3_finalize(stmt); diff --git a/src/util/language.c b/src/util/language.c index ed43074dd..03d65c164 100644 --- a/src/util/language.c +++ b/src/util/language.c @@ -18,7 +18,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "language.h" -#include "language_struct.h" #include "log.h" #include "strings.h" @@ -30,7 +29,24 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -/** importing **/ +#define SMAXHASH 2048 +typedef struct locale_str { + unsigned int hashkey; + struct locale_str *nexthash; + char *str; + char *key; +} locale_str; + +typedef struct locale { + char *name; + unsigned int index; + struct locale *next; + unsigned int hashkey; + struct locale_str *strings[SMAXHASH]; +} locale; + +extern locale *default_locale; +extern locale *locales; locale *default_locale; locale *locales; diff --git a/src/util/language_struct.h b/src/util/language_struct.h deleted file mode 100644 index 7caad74af..000000000 --- a/src/util/language_struct.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CLASS_LANGUAGE_STRUCT -#define CLASS_LANGUAGE_STRUCT - -/* This file should not be included by anything in the server. If you - * feel that you need to include it, it's a sure sign that you're trying to - * do something BAD. */ - -#define SMAXHASH 2048 -typedef struct locale_str { - unsigned int hashkey; - struct locale_str *nexthash; - char *str; - char *key; -} locale_str; - -typedef struct locale { - char *name; - unsigned int index; - struct locale *next; - unsigned int hashkey; - struct locale_str *strings[SMAXHASH]; -} locale; - -extern locale *default_locale; -extern locale *locales; - -#endif