From bfe9d91c2aa2ff3cea7754c1cd8ac36e5227edad Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 5 Oct 2008 12:25:03 +0200 Subject: Move plugin global data allocation back to the module --- zip/zip.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'zip/zip.cpp') diff --git a/zip/zip.cpp b/zip/zip.cpp index dc52c05..8b61068 100644 --- a/zip/zip.cpp +++ b/zip/zip.cpp @@ -228,13 +228,14 @@ void build_global_filelist(struct TVFSGlobs *globs) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Basic initialization functions -int VFSAllocNeeded() +struct TVFSGlobs * +VFSNew (TVFSLogFunc log_func) { - return sizeof(struct TVFSGlobs); -} + struct TVFSGlobs * globs; + + globs = (struct TVFSGlobs *) malloc (sizeof (struct TVFSGlobs)); + memset (globs, 0, sizeof (struct TVFSGlobs)); -void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) -{ globs->archive_opened = false; globs->block_size = DEFAULT_BLOCK_SIZE; globs->archive_modified = false; @@ -242,11 +243,15 @@ void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) globs->log_func = log_func; if (globs->log_func != NULL) globs->log_func((char*)"zip plugin: VFSInit"); + + return globs; } -void VFSDestroy(struct TVFSGlobs *globs) +void +VFSFree (struct TVFSGlobs *globs) { if (globs->log_func != NULL) globs->log_func((char*)"zip plugin: VFSDestroy"); + free (globs); } int VFSVersion() -- cgit v1.2.3