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/party.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/party.c')
-rw-r--r-- | src/map/party.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/map/party.c b/src/map/party.c index db285a4b4..4735dfc42 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -103,16 +103,8 @@ int party_db_final(DBKey key, DBData *data, va_list ap) { if (p->instance) aFree(p->instance); - if (p->hdata) { - int i; - for (i = 0; i < p->hdatac; i++) { - if (p->hdata[i]->flag.free) { - aFree(p->hdata[i]->data); - } - aFree(p->hdata[i]); - } - aFree(p->hdata); - } + HPM->data_store_destroy(p->hdata); + p->hdata = NULL; } return 0; } @@ -608,16 +600,9 @@ int party_broken(int party_id) if( p->instance ) aFree(p->instance); - if( p->hdata ) - { - for( j = 0; j < p->hdatac; j++ ) { - if( p->hdata[j]->flag.free ) { - aFree(p->hdata[j]->data); - } - aFree(p->hdata[j]); - } - aFree(p->hdata); - } + HPM->data_store_destroy(p->hdata); + p->hdata = NULL; + idb_remove(party->db,party_id); return 0; } |