From: Nicholas Clark Date: Wed, 21 Sep 2005 10:53:56 +0000 (+0000) Subject: Remove the last STRLEN n_a;s that my compiler can reach. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2596d9fe3023e9da9e3e000993c9f26fa30909ef;p=p5sagit%2Fp5-mst-13.2.git Remove the last STRLEN n_a;s that my compiler can reach. p4raw-id: //depot/perl@25530 --- diff --git a/doop.c b/doop.c index a36a04f..9e55103 100644 --- a/doop.c +++ b/doop.c @@ -1173,8 +1173,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) Newxz(dc, needlen + 1, char); } else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) { - STRLEN n_a; - dc = SvPV_force_nomg(sv, n_a); + dc = SvPV_force_nomg_nolen(sv); if (SvCUR(sv) < (STRLEN)len) { dc = SvGROW(sv, (STRLEN)(len + 1)); (void)memzero(dc + SvCUR(sv), len - SvCUR(sv) + 1); diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index 057f01e..02396e9 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -181,7 +181,6 @@ dprof_times(pTHX_ struct tms *t) #ifdef OS2 ULONG rc; QWORD cnt; - STRLEN n_a; if (!g_frequ) { if (CheckOSError(DosTmrQueryFreq(&g_frequ))) @@ -190,7 +189,7 @@ dprof_times(pTHX_ struct tms *t) g_frequ = g_frequ/DPROF_HZ; /* count per tick */ if (CheckOSError(DosTmrQueryTime(&cnt))) croak("DosTmrQueryTime: %s", - SvPV(perl_get_sv("!",TRUE), n_a)); + SvPV_nolen_const(perl_get_sv("!",TRUE))); g_start_cnt = toLongLong(cnt); } diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index b313999..8354b48 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -466,8 +466,7 @@ PPCODE: } else if (SvPOK(bitspec) && SvCUR(bitspec) == (STRLEN)opset_len) { int b, j; - STRLEN n_a; - const char * const bitmap = SvPV(bitspec,n_a); + const char * const bitmap = SvPV_nolen_const(bitspec); int myopcode = 0; for (b=0; b < opset_len; b++) { const U16 bits = bitmap[b]; diff --git a/perly.act b/perly.act index 0484e29..1a1a1fa 100644 --- a/perly.act +++ b/perly.act @@ -329,7 +329,7 @@ case 2: case 61: #line 341 "perly.y" - { STRLEN n_a; const char *name = SvPV_const(((SVOP*)(yyvsp[0].opval))->op_sv,n_a); + { const char *const name = SvPV_nolen_const(((SVOP*)(yyvsp[0].opval))->op_sv); if (strEQ(name, "BEGIN") || strEQ(name, "END") || strEQ(name, "INIT") || strEQ(name, "CHECK")) CvSPECIAL_on(PL_compcv); diff --git a/perly.y b/perly.y index 2e21862..37503ba 100644 --- a/perly.y +++ b/perly.y @@ -338,7 +338,7 @@ startformsub: /* NULL */ /* start a format subroutine scope */ ; /* Name of a subroutine - must be a bareword, could be special */ -subname : WORD { STRLEN n_a; const char *name = SvPV_const(((SVOP*)$1)->op_sv,n_a); +subname : WORD { const char *const name = SvPV_nolen_const(((SVOP*)$1)->op_sv); if (strEQ(name, "BEGIN") || strEQ(name, "END") || strEQ(name, "INIT") || strEQ(name, "CHECK")) CvSPECIAL_on(PL_compcv); diff --git a/pp_pack.c b/pp_pack.c index 479782e..92d0a36 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -3522,7 +3522,6 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) SvGETMAGIC(fromstr); if (!SvOK(fromstr)) aptr = NULL; else { - STRLEN n_a; /* XXX better yet, could spirit away the string to * a safe spot and hang on to it until the result * of pack() (and all copies of the result) are @@ -3534,9 +3533,9 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) "Attempt to pack pointer to temporary value"); } if (SvPOK(fromstr) || SvNIOK(fromstr)) - aptr = SvPV_nomg_const(fromstr, n_a); + aptr = SvPV_nomg_const_nolen(fromstr); else - aptr = SvPV_force_flags(fromstr, n_a, 0); + aptr = SvPV_force_flags_nolen(fromstr, 0); } DO_BO_PACK_PC(aptr); PUSH_VAR(utf8, cur, aptr); diff --git a/sv.h b/sv.h index c53de53..376e191 100644 --- a/sv.h +++ b/sv.h @@ -1187,6 +1187,10 @@ Like C but doesn't process magic. ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) +#define SvPV_flags_const_nolen(sv, flags) \ + ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ + ? SvPVX_const(sv) : \ + (const char*) sv_2pv_flags(sv, 0, flags|SV_CONST_RETURN)) #define SvPV_flags_mutable(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ @@ -1197,6 +1201,7 @@ Like C but doesn't process magic. #define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) #define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) +#define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) #define SvPV_force_flags(sv, lp, flags) \ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ @@ -1219,6 +1224,7 @@ Like C but doesn't process magic. #define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) #define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) +#define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) /* ----*/