The old COW code needs to use SvPVX_mutable when doing copy-on-write.
[p5sagit/p5-mst-13.2.git] / pad.h
diff --git a/pad.h b/pad.h
index e839042..b331cea 100644 (file)
--- a/pad.h
+++ b/pad.h
@@ -205,23 +205,25 @@ Assumes the slot entry is a valid C<our> lexical.
 The generation number of the name at offset C<po> in the current
 compiling pad (lvalue). Note that C<SvCUR> is hijacked for this purpose.
 
+=for apidoc m|STRLEN|PAD_COMPNAME_GEN_set|PADOFFSET po|int gen
+Sets the generation number of the name at offset C<po> in the current
+ling pad (lvalue) to C<gen>.  Note that C<SvCUR_set> is hijacked for this purpose.
+
 =cut
+
 */
 
 #define PAD_COMPNAME_FLAGS(po) SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE))
 #define PAD_COMPNAME_PV(po) SvPV_nolen(*av_fetch(PL_comppad_name, (po), FALSE))
 
-/* XXX DAPM yuk - using av_fetch twice. Is there a better way? */
-#define PAD_COMPNAME_TYPE(po) \
-    ((SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE)) & SVpad_TYPED) \
-    ? (SvSTASH(*av_fetch(PL_comppad_name, (po), FALSE))) :  Nullhv)
+#define PAD_COMPNAME_TYPE(po) pad_compname_type(po)
 
 #define PAD_COMPNAME_OURSTASH(po) \
     (GvSTASH(*av_fetch(PL_comppad_name, (po), FALSE)))
 
 #define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po])
 
-
+#define PAD_COMPNAME_GEN_set(po, gen) SvCUR_set(AvARRAY(PL_comppad_name)[po], gen)
 
 
 /*
@@ -256,7 +258,7 @@ Clone the state variables associated with running and compiling pads.
  * sub's CV or padlist. */
 
 #define PAD_CLONE_VARS(proto_perl, param)                              \
-    PL_comppad = ptr_table_fetch(PL_ptr_table, proto_perl->Icomppad);  \
+    PL_comppad = (AV *) ptr_table_fetch(PL_ptr_table, proto_perl->Icomppad); \
     PL_curpad = PL_comppad ?  AvARRAY(PL_comppad) : Null(SV**);                \
     PL_comppad_name            = av_dup(proto_perl->Icomppad_name, param); \
     PL_comppad_name_fill       = proto_perl->Icomppad_name_fill;       \