From 70265291d62280c525adc317158e9f531e0147ff Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 17 Sep 2015 01:21:28 +0200 Subject: 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 --- src/map/npc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index a0c14a058..85de5301b 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2321,16 +2321,8 @@ int npc_unload(struct npc_data* nd, bool single) nd->ud = NULL; } - if (nd->hdata) { - unsigned int i; - for (i = 0; i < nd->hdatac; i++) { - if (nd->hdata[i]->flag.free) { - aFree(nd->hdata[i]->data); - } - aFree(nd->hdata[i]); - } - aFree(nd->hdata); - } + HPM->data_store_destroy(nd->hdata); + nd->hdata = NULL; aFree(nd); -- cgit v1.2.3-60-g2f50