From: Gisle Aas Date: Wed, 4 Jan 2006 13:00:45 +0000 (+0000) Subject: Get rid of a few more hardcoded string lengths. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c5d1ca7ee89d1e1782f94ae9883de9a1052a87d;p=p5sagit%2Fp5-mst-13.2.git Get rid of a few more hardcoded string lengths. p4raw-id: //depot/perl@26642 --- diff --git a/gv.c b/gv.c index d341da3..02ac851 100644 --- a/gv.c +++ b/gv.c @@ -292,7 +292,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("UNIVERSAL", 9, FALSE))) + if(!(stash = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE))) return 0; } @@ -375,7 +375,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("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 @@ STATIC void 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 @@ S_require_errno(pTHX_ GV *gv) 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"); } diff --git a/perl.c b/perl.c index ec0fcf5..cd8415c 100644 --- a/perl.c +++ b/perl.c @@ -3053,7 +3053,7 @@ Perl_moreswitches(pTHX_ char *s) 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 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv) 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 */ diff --git a/perlio.c b/perlio.c index 175b978..95ac41d 100644 --- a/perlio.c +++ b/perlio.c @@ -867,7 +867,7 @@ XS(XS_io_MODIFY_SCALAR_ATTRIBUTES) 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; } diff --git a/pp_sys.c b/pp_sys.c index 6ff9acd..f367371 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1327,7 +1327,7 @@ PP(pp_leavewrite) !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)) {