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 --- unrar/unrar.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'unrar') diff --git a/unrar/unrar.c b/unrar/unrar.c index 5468b94..8793dc4 100644 --- a/unrar/unrar.c +++ b/unrar/unrar.c @@ -101,13 +101,14 @@ struct TVFSGlobs { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////// // 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->block_size = DEFAULT_BLOCK_SIZE; globs->extract_callback_data = NULL; globs->extract_callback_func = NULL; @@ -116,11 +117,15 @@ void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) globs->log_func = log_func; if (globs->log_func != NULL) globs->log_func((char*)"unrar plugin: VFSInit"); + + return globs; } -void VFSDestroy(struct TVFSGlobs *globs) +void +VFSFree (struct TVFSGlobs *globs) { if (globs->log_func != NULL) globs->log_func((char*)"unrar plugin: VFSDestroy"); + free (globs); } int VFSVersion() -- cgit v1.2.3