utf8-ize @ARGV when -C switch is used on Windows
[p5sagit/p5-mst-13.2.git] / win32 / perllib.c
index 26135f8..3aed241 100644 (file)
@@ -160,7 +160,7 @@ perl_construct(PerlInterpreter* my_perl)
        CPerlHost* pHost = (CPerlHost*)w32_internal_host;
        Perl_free();
        delete pHost;
-       SetPerlInterpreter(NULL);
+       PERL_SET_THX(NULL);
     }
 }
 
@@ -200,7 +200,7 @@ perl_free(PerlInterpreter* my_perl)
     {
     }
 #endif
-    SetPerlInterpreter(NULL);
+    PERL_SET_THX(NULL);
 }
 
 EXTERN_C int
@@ -254,26 +254,6 @@ perl_parse(PerlInterpreter* my_perl, void (*xsinit)(CPerlObj*), int argc, char**
 
 EXTERN_C HANDLE w32_perldll_handle;
 
-static DWORD g_TlsAllocIndex;
-
-EXTERN_C DllExport bool
-SetPerlInterpreter(void *interp)
-{
-    DWORD dwErr = GetLastError();
-    bool bResult = TlsSetValue(g_TlsAllocIndex, interp);
-    SetLastError(dwErr);
-    return bResult;
-}
-
-EXTERN_C DllExport void*
-GetPerlInterpreter(void)
-{
-    DWORD dwErr = GetLastError();
-    LPVOID pResult = TlsGetValue(g_TlsAllocIndex);
-    SetLastError(dwErr);
-    return pResult;
-}
-
 EXTERN_C DllExport int
 RunPerl(int argc, char **argv, char **env)
 {
@@ -333,7 +313,7 @@ RunPerl(int argc, char **argv, char **env)
        new_perl = perl_clone(my_perl, 1);
 #  endif
        exitstatus = perl_run( new_perl );
-       SetPerlInterpreter(my_perl);
+       PERL_SET_THX(my_perl);
 #else
        exitstatus = perl_run( my_perl );
 #endif
@@ -343,7 +323,7 @@ RunPerl(int argc, char **argv, char **env)
     perl_free( my_perl );
 #ifdef USE_ITHREADS
     if (new_perl) {
-       SetPerlInterpreter(new_perl);
+       PERL_SET_THX(new_perl);
        perl_destruct(new_perl);
        perl_free(new_perl);
     }
@@ -371,7 +351,6 @@ DllMain(HANDLE hModule,             /* DLL module handle */
        setmode( fileno( stderr ), O_BINARY );
        _fmode = O_BINARY;
 #endif
-       g_TlsAllocIndex = TlsAlloc();
        DisableThreadLibraryCalls((HMODULE)hModule);
        w32_perldll_handle = hModule;
        break;
@@ -380,7 +359,6 @@ DllMain(HANDLE hModule,             /* DLL module handle */
         * process termination or call to FreeLibrary.
         */
     case DLL_PROCESS_DETACH:
-       TlsFree(g_TlsAllocIndex);
        break;
 
        /* The attached process creates a new thread. */