Re: The Inaba patch for tr/// vs. use encoding
[p5sagit/p5-mst-13.2.git] / win32 / perllib.c
index 6243a79..f38dfa1 100644 (file)
@@ -33,6 +33,17 @@ xs_init(pTHX)
 
 #include "perlhost.h"
 
+void
+win32_checkTLS(PerlInterpreter *host_perl)
+{
+    dTHX;
+    if (host_perl != my_perl) {
+       int *nowhere = NULL;
+        *nowhere = 0; 
+       abort();
+    }
+}
+
 EXTERN_C void
 perl_get_host_info(struct IPerlMemInfo* perlMemInfo,
                   struct IPerlMemInfo* perlMemSharedInfo,
@@ -105,6 +116,7 @@ perl_alloc_override(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared,
                                   pHost->m_pHostperlProc);
        if (my_perl) {
            w32_internal_host = pHost;
+           pHost->host_perl  = my_perl;
        }
     }
     return my_perl;
@@ -127,6 +139,7 @@ perl_alloc(void)
                                   pHost->m_pHostperlProc);
        if (my_perl) {
            w32_internal_host = pHost;
+            pHost->host_perl  = my_perl;
        }
     }
     return my_perl;
@@ -154,7 +167,6 @@ RunPerl(int argc, char **argv, char **env)
      * want to free() argv after main() returns.  As luck would have it,
      * Borland's CRT does the right thing to argv[0] already. */
     char szModuleName[MAX_PATH];
-    char *ptr;
 
     GetModuleFileName(NULL, szModuleName, sizeof(szModuleName));
     (void)win32_longpath(szModuleName);
@@ -249,7 +261,7 @@ DllMain(HANDLE hModule,             /* DLL module handle */
             PerlIO_cleanup() was done here but fails (B).
          */     
        EndSockets();
-#if defined(USE_5005THREADS) || defined(USE_ITHREADS)
+#if defined(USE_ITHREADS)
        if (PL_curinterp)
            FREE_THREAD_KEY;
 #endif
@@ -287,6 +299,7 @@ perl_clone_host(PerlInterpreter* proto_perl, UV flags) {
                         h->m_pHostperlProc
     );
     proto_perl->Isys_intern.internal_host = h;
+    h->host_perl  = proto_perl;
     return proto_perl;
        
 }