From: Nicholas Clark Date: Wed, 8 Jun 2005 15:39:40 +0000 (+0000) Subject: Nuke some more n_a, and convert S_gv_ename from char * to const char * X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b6b16e72bf4dd30bd09781ad50e9f66fd94440b;p=p5sagit%2Fp5-mst-13.2.git Nuke some more n_a, and convert S_gv_ename from char * to const char * p4raw-id: //depot/perl@24760 --- diff --git a/doop.c b/doop.c index a5dcc68..b17da1a 100644 --- a/doop.c +++ b/doop.c @@ -1006,7 +1006,6 @@ Perl_do_chomp(pTHX_ register SV *sv) { register I32 count; STRLEN len; - STRLEN n_a; char *s; char *temp_buffer = NULL; SV* svrecode = Nullsv; @@ -1123,7 +1122,7 @@ Perl_do_chomp(pTHX_ register SV *sv) count += rs_charlen; } } - s = SvPV_force(sv, n_a); + s = SvPV_force_nolen(sv); SvCUR_set(sv, len); *SvEND(sv) = '\0'; SvNIOK_off(sv); diff --git a/dump.c b/dump.c index ee352b9..85abf9c 100644 --- a/dump.c +++ b/dump.c @@ -155,7 +155,6 @@ Perl_sv_peek(pTHX_ SV *sv) { dVAR; SV *t = sv_newmortal(); - STRLEN n_a; int unref = 0; sv_setpvn(t, "", 0); @@ -331,7 +330,7 @@ Perl_sv_peek(pTHX_ SV *sv) while (unref--) sv_catpv(t, ")"); } - return SvPV(t, n_a); + return SvPV_nolen(t); } void @@ -767,11 +766,11 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o) if ( ! PL_op->op_flags & OPf_SPECIAL) { /* not lexical */ if (cSVOPo->op_sv) { SV *tmpsv = NEWSV(0,0); - STRLEN n_a; ENTER; SAVEFREESV(tmpsv); gv_fullname3(tmpsv, (GV*)cSVOPo->op_sv, Nullch); - Perl_dump_indent(aTHX_ level, file, "GV = %s\n", SvPV(tmpsv, n_a)); + Perl_dump_indent(aTHX_ level, file, "GV = %s\n", + SvPV_const_nolen(tmpsv)); LEAVE; } else diff --git a/embed.fnc b/embed.fnc index 942d0b7..75b9031 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1060,7 +1060,7 @@ s |OP* |scalarboolean |NN OP *o sR |OP* |newDEFSVOP sR |OP* |new_logop |I32 type|I32 flags|NN OP **firstp|NN OP **otherp s |void |simplify_sort |NN OP *o -s |char* |gv_ename |GV *gv +s |const char* |gv_ename |GV *gv s |bool |scalar_mod_type|const OP *o|I32 type s |OP * |my_kid |OP *o|OP *attrs|OP **imopsp s |OP * |dup_attrlist |OP *o diff --git a/mg.c b/mg.c index 5a224e2..c0b2762 100644 --- a/mg.c +++ b/mg.c @@ -556,8 +556,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) } magic_get(sv,mg); if (!SvPOK(sv) && SvNIOK(sv)) { - STRLEN n_a; - sv_2pv(sv, &n_a); + sv_2pv(sv, 0); } if (SvPOK(sv)) return SvCUR(sv); diff --git a/op.c b/op.c index a134164..3728073 100644 --- a/op.c +++ b/op.c @@ -158,13 +158,12 @@ Perl_Slab_Free(pTHX_ void *op) #define RETURN_UNLIMITED_NUMBER (PERL_INT_MAX / 2) -STATIC char* +STATIC const char* S_gv_ename(pTHX_ GV *gv) { - STRLEN n_a; SV* tmpsv = sv_newmortal(); gv_efullname3(tmpsv, gv, Nullch); - return SvPV(tmpsv,n_a); + return SvPV_nolen_const(tmpsv); } STATIC OP * @@ -4017,7 +4016,6 @@ OP* Perl_newLOOPEX(pTHX_ I32 type, OP *label) { OP *o; - STRLEN n_a; if (type != OP_GOTO || label->op_type == OP_CONST) { /* "last()" means "last" */ @@ -4025,7 +4023,7 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) o = newOP(type, OPf_SPECIAL); else { o = newPVOP(type, 0, savepv(label->op_type == OP_CONST - ? SvPVx_const(((SVOP*)label)->op_sv, n_a) + ? SvPVx_nolen_const(((SVOP*)label)->op_sv) : "")); } op_free(label); @@ -4248,7 +4246,6 @@ CV * Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) { dVAR; - STRLEN n_a; const char *aname; GV *gv; const char *ps; @@ -4256,7 +4253,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) register CV *cv=0; SV *const_sv; - const char * const name = o ? SvPVx_const(cSVOPo->op_sv, n_a) : Nullch; + const char * const name = o ? SvPVx_nolen_const(cSVOPo->op_sv) : Nullch; if (proto) { assert(proto->op_type == OP_CONST); @@ -6263,7 +6260,6 @@ Perl_ck_subr(pTHX_ OP *o) I32 arg = 0; I32 contextclass = 0; char *e = 0; - STRLEN n_a; bool delete_op = 0; o->op_private |= OPpENTERSUB_HASTARG; @@ -6281,7 +6277,7 @@ Perl_ck_subr(pTHX_ OP *o) else { if (SvPOK(cv)) { namegv = CvANON(cv) ? gv : CvGV(cv); - proto = SvPV((SV*)cv, n_a); + proto = SvPV_nolen((SV*)cv); } if (CvASSERTION(cv)) { if (PL_hints & HINT_ASSERTING) { diff --git a/pp_hot.c b/pp_hot.c index 048e7e6..6626b16 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1527,8 +1527,7 @@ Perl_do_readline(pTHX) offset = 0; if (type == OP_RCATLINE && SvOK(sv)) { if (!SvPOK(sv)) { - STRLEN n_a; - (void)SvPV_force(sv, n_a); + SvPV_force_nolen(sv); } offset = SvCUR(sv); } @@ -2619,8 +2618,7 @@ PP(pp_entersub) sym = SvPOKp(sv) ? SvPVX_const(sv) : Nullch; } else { - STRLEN n_a; - sym = SvPV(sv, n_a); + sym = SvPV_nolen_const(sv); } if (!sym) DIE(aTHX_ PL_no_usym, "a subroutine"); diff --git a/pp_pack.c b/pp_pack.c index b0d3b29..7ba37df 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2317,9 +2317,8 @@ doencodes(U8 *h, const char *s, I32 len) STATIC SV * S_is_an_int(pTHX_ const char *s, STRLEN l) { - STRLEN n_a; SV *result = newSVpvn(s, l); - char *result_c = SvPV(result, n_a); /* convenience */ + char *result_c = SvPV_nolen(result); /* convenience */ char *out = result_c; bool skip = 1; bool ignore = 0; diff --git a/pp_sys.c b/pp_sys.c index 7579de8..fb508b5 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1009,7 +1009,6 @@ PP(pp_sselect) struct timeval *tbuf = &timebuf; I32 growsize; char *fd_sets[4]; - STRLEN n_a; #if BYTEORDER != 0x1234 && BYTEORDER != 0x12345678 I32 masksize; I32 offset; @@ -1081,7 +1080,7 @@ PP(pp_sselect) continue; } else if (!SvPOK(sv)) - SvPV_force(sv,n_a); /* force string conversion */ + SvPV_force_nolen(sv); /* force string conversion */ j = SvLEN(sv); if (j < growsize) { Sv_Grow(sv, growsize); @@ -5635,7 +5634,6 @@ PP(pp_syscall) unsigned long a[20]; register I32 i = 0; I32 retval = -1; - STRLEN n_a; if (PL_tainting) { while (++MARK <= SP) { @@ -5658,7 +5656,7 @@ PP(pp_syscall) else if (*MARK == &PL_sv_undef) a[i++] = 0; else - a[i++] = (unsigned long)SvPV_force(*MARK, n_a); + a[i++] = (unsigned long)SvPV_force_nolen(*MARK); if (i > 15) break; } diff --git a/proto.h b/proto.h index 955d0aa..6d23f92 100644 --- a/proto.h +++ b/proto.h @@ -2084,7 +2084,7 @@ STATIC OP* S_new_logop(pTHX_ I32 type, I32 flags, OP **firstp, OP **otherp) STATIC void S_simplify_sort(pTHX_ OP *o) __attribute__nonnull__(pTHX_1); -STATIC char* S_gv_ename(pTHX_ GV *gv); +STATIC const char* S_gv_ename(pTHX_ GV *gv); STATIC bool S_scalar_mod_type(pTHX_ const OP *o, I32 type); STATIC OP * S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp); STATIC OP * S_dup_attrlist(pTHX_ OP *o); diff --git a/regcomp.c b/regcomp.c index b35dcf9..affd94a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -6106,9 +6106,9 @@ Perl_re_intuit_string(pTHX_ regexp *prog) { /* Assume that RE_INTUIT is set */ GET_RE_DEBUG_FLAGS_DECL; DEBUG_COMPILE_r( - { STRLEN n_a; - const char *s = SvPV(prog->check_substr - ? prog->check_substr : prog->check_utf8, n_a); + { + const char *s = SvPV_nolen_const(prog->check_substr + ? prog->check_substr : prog->check_utf8); if (!PL_colorset) reginitcolors(); PerlIO_printf(Perl_debug_log, diff --git a/taint.c b/taint.c index 209efb3..5ed1eaf 100644 --- a/taint.c +++ b/taint.c @@ -143,10 +143,10 @@ Perl_taint_env(pTHX) /* tainted $TERM is okay if it contains no metachars */ svp = hv_fetch(GvHVn(PL_envgv),"TERM",4,FALSE); if (svp && *svp && SvTAINTED(*svp)) { - STRLEN n_a; + STRLEN len; const bool was_tainted = PL_tainted; - char *t = SvPV(*svp, n_a); - char *e = t + n_a; + const char *t = SvPV(*svp, len); + const char *e = t + len; PL_tainted = was_tainted; if (t < e && isALNUM(*t)) t++; diff --git a/toke.c b/toke.c index 6db4b83..d962e3c 100644 --- a/toke.c +++ b/toke.c @@ -9030,9 +9030,8 @@ S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, SV *sv, SV *pv, /* Check the eval first */ if (!PL_in_eval && SvTRUE(ERRSV)) { - STRLEN n_a; sv_catpv(ERRSV, "Propagated"); - yyerror(SvPV(ERRSV, n_a)); /* Duplicates the message inside eval */ + yyerror(SvPV_nolen_const(ERRSV)); /* Duplicates the message inside eval */ (void)POPs; res = SvREFCNT_inc(sv); }