From: Nicholas Clark Date: Thu, 15 Oct 2009 18:38:08 +0000 (+0100) Subject: Use gv_stashsv() and gv_fetchpvs(), the later with proper arguments. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=352e1c09cf09498d4917c120c2055943a4301c0a;p=p5sagit%2Fp5-mst-13.2.git Use gv_stashsv() and gv_fetchpvs(), the later with proper arguments. Brought to you by the Campaign for the Elimination of strlen(). (And the elimination of accidental bugs due to typos in lenghts of constants, and the elimination of abuse of boolean constants for parameters with more than 2 values.) --- diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 31b6f44..9dbbce0 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -6,7 +6,7 @@ use strict; our($VERSION, @ISA, @EXPORT_OK); -$VERSION = "1.14"; +$VERSION = "1.15"; use Carp; use Exporter (); diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 4bcb2e4..5f2979c 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -260,12 +260,12 @@ BOOT: void _safe_pkg_prep(Package) - const char *Package + SV *Package PPCODE: HV *hv; ENTER; - hv = gv_stashpv(Package, GV_ADDWARN); /* should exist already */ + hv = gv_stashsv(Package, GV_ADDWARN); /* should exist already */ if (strNE(HvNAME_get(hv),"main")) { /* make it think it's in main:: */ @@ -281,7 +281,7 @@ PPCODE: void _safe_call_sv(Package, mask, codesv) - char * Package + SV * Package SV * mask SV * codesv PPCODE: @@ -298,7 +298,7 @@ PPCODE: save_hptr(&PL_defstash); /* save current default stash */ /* the assignment to global defstash changes our sense of 'main' */ - PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */ + PL_defstash = gv_stashsv(Package, GV_ADDWARN); /* should exist already */ save_hptr(&PL_curstash); PL_curstash = PL_defstash; @@ -306,13 +306,13 @@ PPCODE: /* defstash must itself contain a main:: so we'll add that now */ /* take care with the ref counts (was cause of long standing bug) */ /* XXX I'm still not sure if this is right, GV_ADDWARN should warn! */ - gv = gv_fetchpv("main::", GV_ADDWARN, SVt_PVHV); + gv = gv_fetchpvs("main::", GV_ADDWARN, SVt_PVHV); sv_free((SV*)GvHV(gv)); GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash); /* %INC must be clean for use/require in compartment */ dummy_hv = save_hash(PL_incgv); - GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV)))); + GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpvs("INC",GV_ADD,SVt_PVHV)))); /* Invalidate ISA and method caches */ ++PL_sub_generation;