This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make v?snprintf available on VMS v7.3-2 and later and clean up
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 02ac851..42c1556 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1,7 +1,7 @@
 /*    gv.c
  *
  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- *    2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others
+ *    2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -73,6 +73,7 @@ Perl_gv_HVadd(pTHX_ register GV *gv)
 GV *
 Perl_gv_IOadd(pTHX_ register GV *gv)
 {
+    dVAR;
     if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) {
 
         /*
@@ -102,6 +103,7 @@ Perl_gv_IOadd(pTHX_ register GV *gv)
 GV *
 Perl_gv_fetchfile(pTHX_ const char *name)
 {
+    dVAR;
     char smallbuf[256];
     char *tmpbuf;
     STRLEN tmplen;
@@ -282,6 +284,7 @@ obtained from the GV with the C<GvCV> macro.
 GV *
 Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
 {
+    dVAR;
     AV* av;
     GV* topgv;
     GV* gv;
@@ -292,7 +295,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
     /* UNIVERSAL methods should be callable without a stash */
     if (!stash) {
        level = -1;  /* probably appropriate */
-       if(!(stash = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE)))
+       if(!(stash = gv_stashpvs("UNIVERSAL", FALSE)))
            return 0;
     }
 
@@ -375,7 +378,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
     /* if at top level, try UNIVERSAL */
 
     if (level == 0 || level == -1) {
-       HV* const lastchance = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE);
+       HV* const lastchance = gv_stashpvs("UNIVERSAL", FALSE);
 
        if (lastchance) {
            if ((gv = gv_fetchmeth(lastchance, name, len,
@@ -482,6 +485,7 @@ C<call_sv> apply equally to these functions.
 GV *
 Perl_gv_fetchmethod_autoload(pTHX_ HV *stash, const char *name, I32 autoload)
 {
+    dVAR;
     register const char *nend;
     const char *nsplit = NULL;
     GV* gv;
@@ -639,7 +643,7 @@ STATIC void
 S_require_errno(pTHX_ GV *gv)
 {
     dVAR;
-    HV* stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
+    HV* stash = gv_stashpvs("Errno", FALSE);
 
     if (!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
        dSP;
@@ -650,7 +654,7 @@ S_require_errno(pTHX_ GV *gv)
                          newSVpvs("Errno"), Nullsv);
        LEAVE;
        SPAGAIN;
-       stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
+       stash = gv_stashpvs("Errno", FALSE);
        if (!stash || !(gv_fetchmethod(stash, "TIEHASH")))
            Perl_croak(aTHX_ "Can't use %%! because Errno.pm is not available");
     }
@@ -748,6 +752,7 @@ GV *
 Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
                       I32 sv_type)
 {
+    dVAR;
     register const char *name = nambeg;
     register GV *gv = NULL;
     GV**gvp;
@@ -1237,6 +1242,7 @@ Perl_gv_efullname4(pTHX_ SV *sv, const GV *gv, const char *prefix, bool keepmain
 IO *
 Perl_newIO(pTHX)
 {
+    dVAR;
     GV *iogv;
     IO * const io = (IO*)NEWSV(0,0);
 
@@ -1259,6 +1265,7 @@ Perl_newIO(pTHX)
 void
 Perl_gv_check(pTHX_ HV *stash)
 {
+    dVAR;
     register I32 i;
 
     if (!HvARRAY(stash))
@@ -1310,6 +1317,7 @@ Perl_gv_check(pTHX_ HV *stash)
 GV *
 Perl_newGVgen(pTHX_ const char *pack)
 {
+    dVAR;
     return gv_fetchpv(Perl_form(aTHX_ "%s::_GEN_%ld", pack, (long)PL_gensym++),
                      TRUE, SVt_PVGV);
 }
@@ -1319,6 +1327,7 @@ Perl_newGVgen(pTHX_ const char *pack)
 GP*
 Perl_gp_ref(pTHX_ GP *gp)
 {
+    dVAR;
     if (!gp)
        return (GP*)NULL;
     gp->gp_refcnt++;
@@ -1340,6 +1349,7 @@ Perl_gp_ref(pTHX_ GP *gp)
 void
 Perl_gp_free(pTHX_ GV *gv)
 {
+    dVAR;
     GP* gp;
 
     if (!gv || !(gp = GvGP(gv)))
@@ -1404,6 +1414,7 @@ Perl_magic_freeovrld(pTHX_ SV *sv, MAGIC *mg)
 bool
 Perl_Gv_AMupdate(pTHX_ HV *stash)
 {
+  dVAR;
   MAGIC* const mg = mg_find((SV*)stash, PERL_MAGIC_overload_table);
   AMT * const amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL;
   AMT amt;
@@ -1526,6 +1537,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash)
 CV*
 Perl_gv_handler(pTHX_ HV *stash, I32 id)
 {
+    dVAR;
     MAGIC *mg;
     AMT *amtp;