diff options
author | Haru <haru@dotalux.com> | 2015-09-17 01:21:28 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-10-11 00:24:22 +0200 |
commit | 70265291d62280c525adc317158e9f531e0147ff (patch) | |
tree | 8beae9d0edc99a38bc678b86f2709780314ad327 /src/map/battleground.c | |
parent | 502703d2b632125b35a2b8d341a90a13d7445f02 (diff) | |
download | hercules-70265291d62280c525adc317158e9f531e0147ff.tar.gz hercules-70265291d62280c525adc317158e9f531e0147ff.tar.bz2 hercules-70265291d62280c525adc317158e9f531e0147ff.tar.xz hercules-70265291d62280c525adc317158e9f531e0147ff.zip |
Cleanup of the HPluginData implementation (First part)
- Several explicit casts are removed, to have a slightly better
type-checking at compile time.
- A destructor function is provided, to remove code duplication.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/battleground.c')
-rw-r--r-- | src/map/battleground.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c index 5df05d301..46d695272 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -880,17 +880,10 @@ void do_init_battleground(bool minimal) { */ int bg_team_db_final(DBKey key, DBData *data, va_list ap) { struct battleground_data* bgd = DB->data2ptr(data); - int i; - nullpo_ret(bgd); - for(i = 0; i < bgd->hdatac; i++ ) { - if( bgd->hdata[i]->flag.free ) { - aFree(bgd->hdata[i]->data); - } - aFree(bgd->hdata[i]); - } - if( bgd->hdata ) - aFree(bgd->hdata); - + + HPM->data_store_destroy(bgd->hdata); + bgd->hdata = NULL; + return 0; } |