/*
- * Copyright © 2001 Novell, Inc. All Rights Reserved.
+ * Copyright © 2001 Novell, Inc. All Rights Reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
EXTERN_C void Perl_nw5_init(int *argcp, char ***argvp);
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
+EXTERN_C BOOL Remove_Thread_Ctx(void);
+
ClsPerlHost::ClsPerlHost()
{
ClsPerlHost::PerlDestroy(PerlInterpreter *my_perl)
{
perl_destruct(my_perl); // Destructor for Perl.
+}
+
+void
+ClsPerlHost::PerlFree(PerlInterpreter *my_perl)
+{
perl_free(my_perl); // Free the memory allocated for Perl.
+ // Remove the thread context set during Perl_set_context
+ // This is added here since for web script there is no other place this gets executed
+ // and it cannot be included into cgi2perl.xs unless this symbol is exported.
+ Remove_Thread_Ctx();
}
/*============================================================================================
PerlInterpreter *new_perl = NULL; // defined in Perl.h
#ifdef PERL_GLOBAL_STRUCT
- #define PERLVAR(var,type)
- #define PERLVARA(var,type)
- #define PERLVARI(var,type,init) PL_Vars.var = init;
- #define PERLVARIC(var,type,init) PL_Vars.var = init;
+ #define PERLVAR(prefix,var,type)
+ #define PERLVARA(prefix,var,type)
+ #define PERLVARI(prefix,var,type,init) PL_Vars.prefix##var = init;
+ #define PERLVARIC(prefix,var,type,init) PL_Vars.prefix##var = init;
#include "perlvars.h"
}
nlm.PerlDestroy(my_perl);
}
+ if(my_perl)
+ nlm.PerlFree(my_perl);
#ifdef USE_ITHREADS
if (new_perl)
{
PERL_SET_THX(new_perl);
nlm.PerlDestroy(new_perl);
+ nlm.PerlFree(my_perl);
}
#endif
//
IPerlHost* AllocStdPerl()
{
- return new ClsPerlHost();
+ return (IPerlHost*) new ClsPerlHost();
}
//
void FreeStdPerl(IPerlHost* pPerlHost)
{
- delete (ClsPerlHost*) pPerlHost;
+ if (pPerlHost)
+ delete (ClsPerlHost*) pPerlHost;
}
-