summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-19 21:37:39 +0100
committerHaru <haru@dotalux.com>2016-03-20 18:32:07 +0100
commitf4fced20c769ccee7f808531221dda481f7bbcca (patch)
tree4bbdd3509a3d6f682e89279f8df2abb1e259a198 /src/login
parent8c9e9668cef87ab9595bde6608de424072cc752d (diff)
downloadhercules-f4fced20c769ccee7f808531221dda481f7bbcca.tar.gz
hercules-f4fced20c769ccee7f808531221dda481f7bbcca.tar.bz2
hercules-f4fced20c769ccee7f808531221dda481f7bbcca.tar.xz
hercules-f4fced20c769ccee7f808531221dda481f7bbcca.zip
Removed unnecessary typedefs from sql.h
- Sql -> struct Sql - SqlStmt -> struct SqlStmt - SqlDataType -> enum SqlDataType This is expected to improve compile time, by removing #include cycles (and forward declaring instead) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r--src/login/account.h6
-rw-r--r--src/login/account_sql.c31
-rw-r--r--src/login/ipban_sql.c2
-rw-r--r--src/login/loginlog_sql.c2
4 files changed, 23 insertions, 18 deletions
diff --git a/src/login/account.h b/src/login/account.h
index 151a2863d..7e1930ad4 100644
--- a/src/login/account.h
+++ b/src/login/account.h
@@ -23,7 +23,9 @@
#include "common/cbasetypes.h"
#include "common/mmo.h" // ACCOUNT_REG2_NUM
-#include "common/sql.h" // Sql
+
+/* Forward declarations */
+struct Sql; // common/sql.h
typedef struct AccountDB AccountDB;
typedef struct AccountDBIterator AccountDBIterator;
@@ -158,7 +160,7 @@ struct AccountDB
};
#ifdef HERCULES_CORE
-Sql *account_db_sql_up(AccountDB* self);
+struct Sql *account_db_sql_up(AccountDB* self);
void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id);
void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id);
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index 2a7401f1b..6d0e795f6 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -43,7 +43,7 @@ typedef struct AccountDB_SQL
{
AccountDB vtable; // public interface
- Sql* accounts; // SQL accounts storage
+ struct Sql *accounts; // SQL accounts storage
// global sql settings
char global_db_hostname[32];
@@ -144,7 +144,7 @@ AccountDB* account_db_sql(void)
static bool account_db_sql_init(AccountDB* self)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- Sql* sql_handle;
+ struct Sql *sql_handle;
const char* username;
const char* password;
const char* hostname;
@@ -379,7 +379,7 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- Sql* sql_handle;
+ struct Sql *sql_handle;
// decide on the account id to assign
int account_id;
@@ -433,7 +433,7 @@ static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc)
static bool account_db_sql_remove(AccountDB* self, const int account_id)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- Sql* sql_handle;
+ struct Sql *sql_handle;
bool result = false;
nullpo_ret(db);
@@ -470,7 +470,7 @@ static bool account_db_sql_load_num(AccountDB* self, struct mmo_account* acc, co
static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, const char* userid)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- Sql* sql_handle;
+ struct Sql *sql_handle;
char esc_userid[2*NAME_LENGTH+1];
int account_id;
char* data;
@@ -540,7 +540,7 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account
{
AccountDBIterator_SQL* iter = (AccountDBIterator_SQL*)self;
AccountDB_SQL* db;
- Sql* sql_handle;
+ struct Sql *sql_handle;
char* data;
nullpo_ret(iter);
@@ -575,7 +575,7 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account
static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id)
{
- Sql* sql_handle;
+ struct Sql *sql_handle;
char* data;
nullpo_ret(db);
@@ -620,8 +620,8 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new)
{
- Sql* sql_handle;
- SqlStmt* stmt;
+ struct Sql *sql_handle;
+ struct SqlStmt *stmt;
bool result = false;
nullpo_ret(db);
@@ -701,12 +701,14 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
return result;
}
-Sql* account_db_sql_up(AccountDB* self) {
+struct Sql *account_db_sql_up(AccountDB* self)
+{
AccountDB_SQL* db = (AccountDB_SQL*)self;
return db ? db->accounts : NULL;
}
-void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
- Sql* sql_handle;
+void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id)
+{
+ struct Sql *sql_handle;
AccountDB_SQL* db = (AccountDB_SQL*)self;
int count = RFIFOW(fd, 12);
@@ -756,8 +758,9 @@ void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
}
}
-void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
- Sql* sql_handle;
+void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id)
+{
+ struct Sql *sql_handle;
AccountDB_SQL* db = (AccountDB_SQL*)self;
char* data;
int plen = 0;
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index 301d22c18..bec0217f4 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -49,7 +49,7 @@ static char ipban_codepage[32] = "";
static char ipban_table[32] = "ipbanlist";
// globals
-static Sql* sql_handle = NULL;
+static struct Sql *sql_handle = NULL;
static int cleanup_timer_id = INVALID_TIMER;
static bool ipban_inited = false;
diff --git a/src/login/loginlog_sql.c b/src/login/loginlog_sql.c
index 356bba3b4..16accfada 100644
--- a/src/login/loginlog_sql.c
+++ b/src/login/loginlog_sql.c
@@ -47,7 +47,7 @@ static char log_db_database[32] = "";
static char log_codepage[32] = "";
static char log_login_db[256] = "loginlog";
-static Sql* sql_handle = NULL;
+static struct Sql *sql_handle = NULL;
static bool enabled = false;