]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Directly store the CVs into the MGWIZ structure
authorVincent Pit <vince@profvince.com>
Mon, 30 Nov 2009 00:16:18 +0000 (01:16 +0100)
committerVincent Pit <vince@profvince.com>
Mon, 30 Nov 2009 00:16:18 +0000 (01:16 +0100)
Instead of references to CVs.

Magic.xs

index a3f40c8a3015cc416450c43f623a33168d2cb419..35bc61c67b0df670439e2ee4bd4950624715c6b4 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -394,8 +394,7 @@ STATIC void vmg_mgwiz_free(pTHX_ MGWIZ *w) {
 #if VMG_THREADSAFE
 
 #define VMG_CLONE_CB(N) \
- z->cb_ ## N = (w->cb_ ## N) ? newRV_noinc(vmg_clone(SvRV(w->cb_ ## N), \
-                                           w->owner))                   \
+ z->cb_ ## N = (w->cb_ ## N) ? vmg_clone(w->cb_ ## N, w->owner) \
                              : NULL;
 
 STATIC MGWIZ *vmg_mgwiz_clone(pTHX_ const MGWIZ *w) {
@@ -1232,13 +1231,13 @@ STATIC I32 vmg_svt_val(pTHX_ IV action, SV *sv) {
 
 #define VMG_SET_CB(S, N)              \
  cb = (S);                            \
- w->cb_ ## N = (SvOK(cb) && SvROK(cb)) ? newRV_inc(SvRV(cb)) : NULL;
+ w->cb_ ## N = (SvOK(cb) && SvROK(cb)) ? SvREFCNT_inc(SvRV(cb)) : NULL;
 
 #define VMG_SET_SVT_CB(S, N)          \
  cb = (S);                            \
  if (SvOK(cb) && SvROK(cb)) {         \
   t->svt_ ## N = vmg_svt_ ## N;       \
-  w->cb_  ## N = newRV_inc(SvRV(cb)); \
+  w->cb_  ## N = SvREFCNT_inc(SvRV(cb)); \
  } else {                             \
   t->svt_ ## N = NULL;                \
   w->cb_  ## N = NULL;                \