[svn:parrot] r38378 - trunk/src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Apr 27 17:22:10 UTC 2009


Author: NotFound
Date: Mon Apr 27 17:22:09 2009
New Revision: 38378
URL: https://trac.parrot.org/parrot/changeset/38378

Log:
[cage] fix c++ build, limit scope of some vars

Modified:
   trunk/src/jit.c

Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c	Mon Apr 27 01:37:12 2009	(r38377)
+++ trunk/src/jit.c	Mon Apr 27 17:22:09 2009	(r38378)
@@ -1785,38 +1785,47 @@
 PMC *
 Parrot_jit_clone_buffer(PARROT_INTERP, PMC *pmc, void *priv)
 {
-    struct jit_buffer_private_data *jit = (struct jit_buffer_private_data*)priv;
     PMC *rv = pmc_new(interp, pmc->vtable->base_type);
-    void *tmp, *freepriv, *clonepriv;
 
     VTABLE_init(interp, rv);
     /* copy the attributes */
-    GETATTR_ManagedStruct_custom_free_func(interp, pmc, tmp);
-    SETATTR_ManagedStruct_custom_free_func(interp, rv , tmp);
-    GETATTR_ManagedStruct_custom_clone_func(interp, pmc, tmp);
-    SETATTR_ManagedStruct_custom_clone_func(interp, rv , tmp);
-    GETATTR_ManagedStruct_custom_free_priv(interp , pmc, freepriv);
-    GETATTR_ManagedStruct_custom_clone_priv(interp, pmc, clonepriv);
-    if (freepriv) {
-        tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
-        memcpy(tmp, freepriv, sizeof (struct jit_buffer_private_data));
-        SETATTR_ManagedStruct_custom_free_priv(interp, rv , tmp);
-        if (clonepriv == freepriv) {
-            /* clonepriv is a copy of freepriv, make it a copy in the clone too. */
+    {
+        void (*tmpfreefunc)(PARROT_INTERP, void*, void*);
+        GETATTR_ManagedStruct_custom_free_func(interp, pmc, tmpfreefunc);
+        SETATTR_ManagedStruct_custom_free_func(interp, rv , tmpfreefunc);
+    }
+    {
+        PMC* (*tmpclonefunc)(PARROT_INTERP, PMC*, void*);
+        GETATTR_ManagedStruct_custom_clone_func(interp, pmc, tmpclonefunc);
+        SETATTR_ManagedStruct_custom_clone_func(interp, rv , tmpclonefunc);
+    }
+
+    {
+        void *freepriv, *clonepriv;
+        GETATTR_ManagedStruct_custom_free_priv(interp , pmc, freepriv);
+        GETATTR_ManagedStruct_custom_clone_priv(interp, pmc, clonepriv);
+        if (freepriv) {
+            void *tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
+            memcpy(tmp, freepriv, sizeof (struct jit_buffer_private_data));
+            SETATTR_ManagedStruct_custom_free_priv(interp, rv , tmp);
+            if (clonepriv == freepriv) {
+                /* clonepriv is a copy of freepriv, make it a copy in the clone too. */
+                SETATTR_ManagedStruct_custom_clone_priv(interp, rv , tmp);
+                clonepriv = NULL; /* disable the clonepriv copying below */
+            }
+        }
+        if (clonepriv) {
+            void *tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
+            memcpy(tmp, clonepriv, sizeof (struct jit_buffer_private_data));
             SETATTR_ManagedStruct_custom_clone_priv(interp, rv , tmp);
-            clonepriv = NULL; /* disable the clonepriv copying below */
         }
     }
-    if (clonepriv) {
-        tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
-        memcpy(tmp, clonepriv, sizeof (struct jit_buffer_private_data));
-        SETATTR_ManagedStruct_custom_clone_priv(interp, rv , tmp);
-    }
 
     /* copy the execmem buffer */
     if (PARROT_MANAGEDSTRUCT(pmc)->ptr) {
-        void *newptr, *ptr = PARROT_MANAGEDSTRUCT(pmc)->ptr;
-        newptr = mem_alloc_executable(jit->size);
+        struct jit_buffer_private_data *jit = (struct jit_buffer_private_data*)priv;
+        void *ptr = PARROT_MANAGEDSTRUCT(pmc)->ptr;
+        void *newptr = mem_alloc_executable(jit->size);
         memcpy(newptr, ptr, jit->size);
         PARROT_MANAGEDSTRUCT(rv)->ptr = newptr;
     }


More information about the parrot-commits mailing list