NetWare tweaks from C Aditya <caditya@novell.com>
Jarkko Hietaniemi [Mon, 18 Mar 2002 13:57:06 +0000 (13:57 +0000)]
p4raw-id: //depot/perl@15292

NetWare/nwperlsys.c
cop.h
iperlsys.h
op.c

index 4fc65d3..9eca522 100644 (file)
@@ -87,9 +87,8 @@ perl_alloc(void)
        WCValHashTable<void*>*  m_allocList;
        m_allocList = new WCValHashTable<void*> (fnAllocListHash, 256);
        fnInsertHashListAddrs(m_allocList, FALSE);
-
        my_perl = perl_alloc_using(&perlMem,
-                                  NULL,
+                                  &perlMem,
                                   NULL,
                                   &perlEnv,
                                   &perlStdIO,
@@ -169,9 +168,8 @@ perl_alloc_override(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared,
                lpProc=&perlProc;
        else
                lpProc=*ppProc;
-
        my_perl = perl_alloc_using(lpMem,
-                                  NULL,
+                                  lpMem,
                                   NULL,
                                   lpEnv,
                                   lpStdio,
diff --git a/cop.h b/cop.h
index d617bfc..3b2699e 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -30,13 +30,25 @@ struct cop {
 #  define CopFILE(c)           ((c)->cop_file)
 #  define CopFILEGV(c)         (CopFILE(c) \
                                 ? gv_fetchfile(CopFILE(c)) : Nullgv)
-#  define CopFILE_set(c,pv)    ((c)->cop_file = savesharedpv(pv))
+                                
+ #ifdef NETWARE
+  #define CopFILE_set(c,pv)    ((c)->cop_file = savepv(pv))
+ #else
+  #define CopFILE_set(c,pv)    ((c)->cop_file = savesharedpv(pv))
+ #endif
+
 #  define CopFILESV(c)         (CopFILE(c) \
                                 ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
 #  define CopFILEAV(c)         (CopFILE(c) \
                                 ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
 #  define CopSTASHPV(c)                ((c)->cop_stashpv)
-#  define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = savesharedpv(pv))
+
+  #ifdef NETWARE
+    #define CopSTASHPV_set(c,pv)       ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch))
+  #else
+    #define CopSTASHPV_set(c,pv)       ((c)->cop_stashpv = savesharedpv(pv))
+  #endif
+
 #  define CopSTASH(c)          (CopSTASHPV(c) \
                                 ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
 #  define CopSTASH_set(c,hv)   CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch)
@@ -44,8 +56,17 @@ struct cop {
                                 && (CopSTASHPV(c) == HvNAME(hv)        \
                                     || (CopSTASHPV(c) && HvNAME(hv)    \
                                         && strEQ(CopSTASHPV(c), HvNAME(hv)))))
-#  define CopSTASH_free(c)     PerlMemShared_free(CopSTASHPV(c))      
-#  define CopFILE_free(c)      (PerlMemShared_free(CopFILE(c)),(CopFILE(c) = Nullch))      
+  #ifdef NETWARE
+    #define CopSTASH_free(c) SAVECOPSTASH_FREE(c)
+  #else
+    #define CopSTASH_free(c)   PerlMemShared_free(CopSTASHPV(c))      
+  #endif
+
+  #ifdef NETWARE
+    #define CopFILE_free(c) SAVECOPFILE_FREE(c)
+  #else
+    #define CopFILE_free(c)    (PerlMemShared_free(CopFILE(c)),(CopFILE(c) = Nullch))      
+  #endif
 #else
 #  define CopFILEGV(c)         ((c)->cop_filegv)
 #  define CopFILEGV_set(c,gv)  ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
index 7eda973..b2b2172 100644 (file)
@@ -795,6 +795,25 @@ struct IPerlMemInfo
        (*PL_Mem->pIsLocked)(PL_Mem)
 
 /* Shared memory macros */
+#ifdef NETWARE
+  
+ #define PerlMemShared_malloc(size)                        \
+       (*PL_Mem->pMalloc)(PL_Mem, (size))
+#define PerlMemShared_realloc(buf, size)                   \
+       (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
+#define PerlMemShared_free(buf)                                    \
+       (*PL_Mem->pFree)(PL_Mem, (buf))
+#define PerlMemShared_calloc(num, size)                            \
+       (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
+#define PerlMemShared_get_lock()                           \
+       (*PL_Mem->pGetLock)(PL_Mem)
+#define PerlMemShared_free_lock()                          \
+       (*PL_Mem->pFreeLock)(PL_Mem)
+#define PerlMemShared_is_locked()                          \
+       (*PL_Mem->pIsLocked)(PL_Mem)
+
+#else
+
 #define PerlMemShared_malloc(size)                         \
        (*PL_MemShared->pMalloc)(PL_MemShared, (size))
 #define PerlMemShared_realloc(buf, size)                   \
@@ -810,6 +829,7 @@ struct IPerlMemInfo
 #define PerlMemShared_is_locked()                          \
        (*PL_MemShared->pIsLocked)(PL_MemShared)
 
+#endif
 
 /* Parse tree memory macros */
 #define PerlMemParse_malloc(size)                          \
diff --git a/op.c b/op.c
index d00abec..c755d11 100644 (file)
--- a/op.c
+++ b/op.c
@@ -45,8 +45,8 @@ S_Slab_Alloc(pTHX_ int m, size_t sz)
      */
     sz = (sz + 2*sizeof(I32 *) -1)/sizeof(I32 *);
     if ((PL_OpSpace -= sz) < 0) {
-       PL_OpPtr = (I32 **) PerlMemShared_malloc(PERL_SLAB_SIZE*sizeof(I32*));
-       if (!PL_OpPtr) {
+        PL_OpPtr = (I32 **) PerlMemShared_malloc(PERL_SLAB_SIZE*sizeof(I32*)); 
+       if (!PL_OpPtr) {
            return NULL;
        }
        Zero(PL_OpPtr,PERL_SLAB_SIZE,I32 **);
@@ -82,7 +82,11 @@ S_Slab_Free(pTHX_ void *op)
     assert( ptr < ( (I32 **) slab + PERL_SLAB_SIZE) );
     assert( *slab > 0 );
     if (--(*slab) == 0) {
-       PerlMemShared_free(slab);
+     #ifdef NETWARE
+      #define PerlMemShared PerlMem
+     #endif
+       
+    PerlMemShared_free(slab);
        if (slab == PL_OpSlab) {
            PL_OpSpace = 0;
        }