From 2661812e3fc3f7385a5f8343172afc173f594efe Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 17 Feb 2009 02:28:08 +0100 Subject: Adding stalloc system. --- mpq-fs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mpq-fs.c') diff --git a/mpq-fs.c b/mpq-fs.c index 68da3b8..063e522 100644 --- a/mpq-fs.c +++ b/mpq-fs.c @@ -5,6 +5,7 @@ #include "hashtab.h" #include "mpq-fs.h" #include "mpq-misc.h" +#include "stalloc.h" #define MAX_FNAME 2048 @@ -38,10 +39,10 @@ static void add_file(struct mpq_archive_t * mpq_a, char * fname) { if (!hash_table) hash_table = hcreate(INITIAL_HASH_SIZE); - nfname = strnormalize(strdup(fname)); + nfname = strnormalize(st_strdup(fname)); hadd(hash_table, (uint8_t *) nfname, strlen(nfname), NULL); if (!hstuff(hash_table)) { - hstuff(hash_table) = malloc(sizeof(hash_entry)); + hstuff(hash_table) = st_alloc(sizeof(hash_entry)); } ((hash_entry *) hstuff(hash_table))->mpq_a = mpq_a; ((hash_entry *) hstuff(hash_table))->entry = entry; @@ -154,11 +155,14 @@ int mpqlib_fs_filelist(char * buffer) { void mpqlib_fs_shutdown() { if (!hash_table) return; +/* if (hfirst(hash_table)) do { free(hstuff(hash_table)); free(hkey(hash_table)); } while (hnext(hash_table)); +*/ + st_shutdown(); hdestroy(hash_table); hash_table = 0; } -- cgit v1.2.3