Change 26642 by [EMAIL PROTECTED] on 2006/01/04 13:00:45

        Get rid of a few more hardcoded string lengths.

Affected files ...

... //depot/perl/gv.c#282 edit
... //depot/perl/perl.c#694 edit
... //depot/perl/perlio.c#294 edit
... //depot/perl/pp_sys.c#480 edit

Differences ...

==== //depot/perl/gv.c#282 (text) ====
Index: perl/gv.c
--- perl/gv.c#281~26641~        2006-01-04 04:48:34.000000000 -0800
+++ perl/gv.c   2006-01-04 05:00:45.000000000 -0800
@@ -292,7 +292,7 @@
     /* UNIVERSAL methods should be callable without a stash */
     if (!stash) {
        level = -1;  /* probably appropriate */
-       if(!(stash = gv_stashpvn("UNIVERSAL", 9, FALSE)))
+       if(!(stash = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE)))
            return 0;
     }
 
@@ -375,7 +375,7 @@
     /* if at top level, try UNIVERSAL */
 
     if (level == 0 || level == -1) {
-       HV* const lastchance = gv_stashpvn("UNIVERSAL", 9, FALSE);
+       HV* const lastchance = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE);
 
        if (lastchance) {
            if ((gv = gv_fetchmeth(lastchance, name, len,
@@ -639,7 +639,7 @@
 S_require_errno(pTHX_ GV *gv)
 {
     dVAR;
-    HV* stash = gv_stashpvn("Errno",5,FALSE);
+    HV* stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
 
     if (!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
        dSP;
@@ -650,7 +650,7 @@
                          newSVpvs("Errno"), Nullsv);
        LEAVE;
        SPAGAIN;
-       stash = gv_stashpvn("Errno",5,FALSE);
+       stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
        if (!stash || !(gv_fetchmethod(stash, "TIEHASH")))
            Perl_croak(aTHX_ "Can't use %%! because Errno.pm is not available");
     }

==== //depot/perl/perl.c#694 (text) ====
Index: perl/perl.c
--- perl/perl.c#693~26641~      2006-01-04 04:48:34.000000000 -0800
+++ perl/perl.c 2006-01-04 05:00:45.000000000 -0800
@@ -3053,7 +3053,7 @@
        Safefree(PL_inplace);
 #if defined(__CYGWIN__) /* do backup extension automagically */
        if (*(s+1) == '\0') {
-       PL_inplace = savepv(".bak");
+       PL_inplace = savepvn(STR_WITH_LEN(".bak"));
        return s+1;
        }
 #endif /* __CYGWIN__ */
@@ -3505,7 +3505,7 @@
     PL_suidscript = -1;
 
     if (PL_e_script) {
-       PL_origfilename = savepvn("-e", 2);
+       PL_origfilename = savepvn(STR_WITH_LEN("-e"));
     }
     else {
        /* if find_script() returns, it returns a malloc()-ed value */

==== //depot/perl/perlio.c#294 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#293~26641~    2006-01-04 04:48:34.000000000 -0800
+++ perl/perlio.c       2006-01-04 05:00:45.000000000 -0800
@@ -867,7 +867,7 @@
 SV *
 PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab)
 {
-    HV * const stash = gv_stashpvn("PerlIO::Layer", 13, TRUE);
+    HV * const stash = gv_stashpvn(STR_WITH_LEN("PerlIO::Layer"), TRUE);
     SV * const sv = sv_bless(newRV_noinc(newSViv(PTR2IV(tab))), stash);
     return sv;
 }

==== //depot/perl/pp_sys.c#480 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#479~26641~    2006-01-04 04:48:34.000000000 -0800
+++ perl/pp_sys.c       2006-01-04 05:00:45.000000000 -0800
@@ -1327,7 +1327,7 @@
                  !gv_fetchpv("top", 0, SVt_PVFM))
                    IoTOP_NAME(io) = savesvpv(topname);
                else
-                   IoTOP_NAME(io) = savepvn("top", 3);
+                   IoTOP_NAME(io) = savepvn(STR_WITH_LEN("top"));
            }
            topgv = gv_fetchpv(IoTOP_NAME(io), 0, SVt_PVFM);
            if (!topgv || !GvFORM(topgv)) {
End of Patch.

Reply via email to