This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
const the custom op struct in Devel::Peek
authorDaniel Dragan <bulk88@hotmail.com>
Mon, 5 Jan 2015 04:37:58 +0000 (23:37 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 5 Jan 2015 14:30:33 +0000 (06:30 -0800)
This makes the Devel::Peek shared library free of perl caused RW static
data vars, and if CC/OS platform allows, removes RW data section from the
shared library.

ext/Devel-Peek/Peek.pm
ext/Devel-Peek/Peek.xs

index 8f429b4..f3adcfc 100644 (file)
@@ -3,7 +3,7 @@
 
 package Devel::Peek;
 
-$VERSION = '1.20';
+$VERSION = '1.21';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
index 7e64ede..856ff77 100644 (file)
@@ -406,7 +406,13 @@ S_ck_dump(pTHX_ OP *entersubop, GV *namegv, SV *cv)
     return (OP *)newop;
 }
 
-static XOP my_xop;
+const static XOP my_xop = {
+    XOPf_xop_name|XOPf_xop_desc|XOPf_xop_class,                /* xop_flags */
+    "Devel_Peek_Dump",                                 /* xop_name */
+    "Dump",                                            /* xop_desc */
+    OA_BINOP,                                          /* xop_class */
+    NULL                                               /* xop_peep */
+};
 
 MODULE = Devel::Peek           PACKAGE = Devel::Peek
 
@@ -439,10 +445,6 @@ BOOT:
     CV * const cv = get_cvn_flags("Devel::Peek::Dump", 17, 0);
     assert(cv);
     cv_set_call_checker(cv, S_ck_dump, (SV *)cv);
-
-    XopENTRY_set(&my_xop, xop_name, "Devel_Peek_Dump");
-    XopENTRY_set(&my_xop, xop_desc, "Dump");
-    XopENTRY_set(&my_xop, xop_class, OA_BINOP);
     Perl_custom_op_register(aTHX_ S_pp_dump, &my_xop);
 }