diff options
Diffstat (limited to 'mpq-fs.c')
-rw-r--r-- | mpq-fs.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } |