summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-01 17:50:26 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-01 17:50:26 +0000
commit463d4d445d4e8abe5753f508cc301c0da91ca46a (patch)
tree853ac09ce1f71a97a3ccaf69c2a92d0c63623d60
parente8af93013ab6d0f6125f651076560fd44073003d (diff)
downloadhercules-463d4d445d4e8abe5753f508cc301c0da91ca46a.tar.gz
hercules-463d4d445d4e8abe5753f508cc301c0da91ca46a.tar.bz2
hercules-463d4d445d4e8abe5753f508cc301c0da91ca46a.tar.xz
hercules-463d4d445d4e8abe5753f508cc301c0da91ca46a.zip
Enabled `DB_OPT_RELEASE_DATA` for atcommands `DBMap`s so they are able to free data automatically (as pointed out by Wildcard).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15642 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/atcommand.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 790c17fcd..0be3154d0 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8851,31 +8851,19 @@ static void atcommand_config_read(const char* config_filename)
return;
}
-static int atcommand_db_free(DBKey key, void *data, va_list va)
-{
- aFree((AtCommandInfo*)data);
- return 1;
-}
-
-static int atcommand_alias_db_free(DBKey key, void *data, va_list va)
-{
- aFree((AliasInfo*)data);
- return 1;
-}
-
void atcommand_db_clear(void)
{
if (atcommand_db != NULL)
- atcommand_db->destroy(atcommand_db, atcommand_db_free);
+ db_destroy(atcommand_db);
if (atcommand_alias_db != NULL)
- atcommand_alias_db->destroy(atcommand_alias_db, atcommand_alias_db_free);
+ db_destroy(atcommand_alias_db);
}
void atcommand_doload(void)
{
atcommand_db_clear();
- atcommand_db = stridb_alloc(DB_OPT_DUP_KEY, ATCOMMAND_LENGTH);
- atcommand_alias_db = stridb_alloc(DB_OPT_DUP_KEY, ATCOMMAND_LENGTH);
+ atcommand_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
+ atcommand_alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
atcommand_basecommands(); //fills initial atcommand_db with known commands
atcommand_config_read(ATCOMMAND_CONF_FILENAME);
}