diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-10 16:12:07 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-10 16:12:07 -0700 |
commit | f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1 (patch) | |
tree | d9b013ab252968ec1e90e721f7b2ab819af0acb0 /src/char/int_storage.c | |
parent | 5939e1bec75f2550d3ce109b9cd9a5d22c0626c2 (diff) | |
parent | 723fb5d3431b847526c433a13aa74485cfb564a3 (diff) | |
download | tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.gz tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.bz2 tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.xz tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.zip |
Merge commit '723fb5d3431b847526c433a13aa74485cfb564a3'
Diffstat (limited to 'src/char/int_storage.c')
-rw-r--r-- | src/char/int_storage.c | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 744a59f..99af725 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -7,7 +7,6 @@ #include "../common/socket.h" #include "../common/db.h" #include "../common/lock.h" -#include "../common/malloc.h" #include "char.h" #include "inter.h" #include "int_storage.h" @@ -222,12 +221,7 @@ struct storage *account2storage (int account_id) s = (struct storage *) numdb_search (storage_db, account_id); if (s == NULL) { - s = (struct storage *) aCalloc (sizeof (struct storage), 1); - if (s == NULL) - { - printf ("int_storage: out of memory!\n"); - exit (0); - } + CREATE (s, struct storage, 1); memset (s, 0, sizeof (struct storage)); s->account_id = account_id; numdb_insert (storage_db, s->account_id, s); @@ -244,14 +238,7 @@ struct guild_storage *guild2storage (int guild_id) guild_id); if (gs == NULL) { - gs = (struct guild_storage *) - aCalloc (sizeof (struct guild_storage), 1); - if (gs == NULL) - { - printf ("int_storage: out of memory!\n"); - exit (0); - } -// memset(gs,0,sizeof(struct guild_storage)); aCalloc does this! [Skotlex] + CREATE (gs, struct guild_storage, 1); gs->guild_id = guild_id; numdb_insert (guild_storage_db, gs->guild_id, gs); } @@ -280,13 +267,7 @@ int inter_storage_init () while (fgets (line, 65535, fp)) { sscanf (line, "%d", &tmp_int); - s = (struct storage *) aCalloc (sizeof (struct storage), 1); - if (s == NULL) - { - printf ("int_storage: out of memory!\n"); - exit (0); - } -// memset(s,0,sizeof(struct storage)); aCalloc does this... + CREATE (s, struct storage, 1); s->account_id = tmp_int; if (s->account_id > 0 && storage_fromstr (line, s) == 0) { @@ -314,14 +295,7 @@ int inter_storage_init () while (fgets (line, 65535, fp)) { sscanf (line, "%d", &tmp_int); - gs = (struct guild_storage *) aCalloc (sizeof (struct guild_storage), - 1); - if (gs == NULL) - { - printf ("int_storage: out of memory!\n"); - exit (0); - } -// memset(gs,0,sizeof(struct guild_storage)); aCalloc... + CREATE (gs, struct guild_storage, 1); gs->guild_id = tmp_int; if (gs->guild_id > 0 && guild_storage_fromstr (line, gs) == 0) { @@ -340,20 +314,18 @@ int inter_storage_init () return 0; } -int storage_db_final (void *k, void *data, va_list ap) +void storage_db_final (db_key_t k, db_val_t data, va_list ap) { struct storage *p = (struct storage *) data; if (p) free (p); - return 0; } -int guild_storage_db_final (void *k, void *data, va_list ap) +void guild_storage_db_final (db_key_t k, db_val_t data, va_list ap) { struct guild_storage *p = (struct guild_storage *) data; if (p) free (p); - return 0; } void inter_storage_final () @@ -363,7 +335,7 @@ void inter_storage_final () return; } -int inter_storage_save_sub (void *key, void *data, va_list ap) +void inter_storage_save_sub (db_key_t key, db_val_t data, va_list ap) { char line[65536]; FILE *fp; @@ -371,7 +343,6 @@ int inter_storage_save_sub (void *key, void *data, va_list ap) fp = va_arg (ap, FILE *); if (*line) fprintf (fp, "%s" RETCODE, line); - return 0; } //--------------------------------------------------------- @@ -396,7 +367,7 @@ int inter_storage_save () return 0; } -int inter_guild_storage_save_sub (void *key, void *data, va_list ap) +void inter_guild_storage_save_sub (db_key_t key, db_val_t data, va_list ap) { char line[65536]; FILE *fp; @@ -409,7 +380,6 @@ int inter_guild_storage_save_sub (void *key, void *data, va_list ap) if (*line) fprintf (fp, "%s" RETCODE, line); } - return 0; } //--------------------------------------------------------- |