From 76f68e9bb86f29e34e2aeb5c177571288f05b7ca Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 29 Oct 2008 23:04:34 +0000 Subject: [PATCH] Use pvs macros instead of pvn where possible. p4raw-id: //depot/perl@34653 --- doio.c | 10 +++++----- doop.c | 8 ++++---- dump.c | 38 +++++++++++++++++++------------------- gv.c | 16 ++++++++-------- mg.c | 6 +++--- op.c | 4 ++-- pad.c | 2 +- perl.c | 22 +++++++++++----------- pp.c | 4 ++-- pp_ctl.c | 6 +++--- pp_hot.c | 4 ++-- pp_pack.c | 2 +- pp_sys.c | 14 +++++++------- regcomp.c | 4 ++-- sv.c | 10 +++++----- toke.c | 28 ++++++++++++++-------------- universal.c | 2 +- utf8.c | 4 ++-- util.c | 6 +++--- 19 files changed, 95 insertions(+), 95 deletions(-) diff --git a/doio.c b/doio.c index 39cda9a..b0dd4f2 100644 --- a/doio.c +++ b/doio.c @@ -212,7 +212,7 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw, goto say_false; } #endif /* USE_STDIO */ - name = SvOK(*svp) ? savesvpv (*svp) : savepvn ("", 0); + name = SvOK(*svp) ? savesvpv (*svp) : savepvs (""); SAVEFREEPV(name); } else { @@ -766,7 +766,7 @@ Perl_nextargv(pTHX_ register GV *gv) const char *star = strchr(PL_inplace, '*'); if (star) { const char *begin = PL_inplace; - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); do { sv_catpvn(sv, begin, star - begin); sv_catpvn(sv, PL_oldname, oldlen); @@ -1282,7 +1282,7 @@ Perl_my_stat(pTHX) do_fstat_have_io: PL_laststype = OP_STAT; PL_statgv = gv; - sv_setpvn(PL_statname, "", 0); + sv_setpvs(PL_statname, ""); if(io) { if (IoIFP(io)) { return (PL_laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &PL_statcache)); @@ -2179,7 +2179,7 @@ Perl_do_msgrcv(pTHX_ SV **mark, SV **sp) /* suppress warning when reading into undef var --jhi */ if (! SvOK(mstr)) - sv_setpvn(mstr, "", 0); + sv_setpvs(mstr, ""); msize = SvIVx(*++mark); mtype = (long)SvIVx(*++mark); flags = SvIVx(*++mark); @@ -2288,7 +2288,7 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) char *mbuf; /* suppress warning when reading into undef var (tchrist 3/Mar/00) */ if (! SvOK(mstr)) - sv_setpvn(mstr, "", 0); + sv_setpvs(mstr, ""); SvPV_force_nolen(mstr); mbuf = SvGROW(mstr, (STRLEN)msize+1); diff --git a/doop.c b/doop.c index db97cd5..039d9ad 100644 --- a/doop.c +++ b/doop.c @@ -707,7 +707,7 @@ Perl_do_join(pTHX_ register SV *sv, SV *delim, register SV **mark, register SV * ++mark; } - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); /* sv_setpv retains old UTF8ness [perl #24846] */ SvUTF8_off(sv); @@ -1050,7 +1050,7 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv) } } else - sv_setpvn(astr, "", 0); + sv_setpvs(astr, ""); } else if (s && len) { s += --len; @@ -1061,7 +1061,7 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv) SvNIOK_off(sv); } else - sv_setpvn(astr, "", 0); + sv_setpvs(astr, ""); SvSETMAGIC(sv); } @@ -1228,7 +1228,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) PERL_ARGS_ASSERT_DO_VOP; if (sv != left || (optype != OP_BIT_AND && !SvOK(sv) && !SvGMAGICAL(sv))) - sv_setpvn(sv, "", 0); /* avoid undef warning on |= and ^= */ + sv_setpvs(sv, ""); /* avoid undef warning on |= and ^= */ lsave = lc = SvPV_nomg_const(left, leftlen); rsave = rc = SvPV_nomg_const(right, rightlen); diff --git a/dump.c b/dump.c index b2ca93a..7f55558 100644 --- a/dump.c +++ b/dump.c @@ -229,7 +229,7 @@ Perl_pv_escape( pTHX_ SV *dsv, char const * const str, if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) { /* This won't alter the UTF-8 flag */ - sv_setpvn(dsv, "", 0); + sv_setpvs(dsv, ""); } if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) @@ -342,29 +342,29 @@ Perl_pv_pretty( pTHX_ SV *dsv, char const * const str, const STRLEN count, if (!(flags & PERL_PV_PRETTY_NOCLEAR)) { /* This won't alter the UTF-8 flag */ - sv_setpvn(dsv, "", 0); + sv_setpvs(dsv, ""); } if ( dq == '"' ) - sv_catpvn(dsv, "\"", 1); + sv_catpvs(dsv, "\""); else if ( flags & PERL_PV_PRETTY_LTGT ) - sv_catpvn(dsv, "<", 1); + sv_catpvs(dsv, "<"); if ( start_color != NULL ) - Perl_sv_catpv( aTHX_ dsv, start_color); + sv_catpv(dsv, start_color); pv_escape( dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR ); if ( end_color != NULL ) - Perl_sv_catpv( aTHX_ dsv, end_color); + sv_catpv(dsv, end_color); if ( dq == '"' ) - sv_catpvn( dsv, "\"", 1 ); + sv_catpvs( dsv, "\""); else if ( flags & PERL_PV_PRETTY_LTGT ) - sv_catpvn( dsv, ">", 1); + sv_catpvs(dsv, ">"); if ( (flags & PERL_PV_PRETTY_ELLIPSES) && ( escaped < count ) ) - sv_catpvn( dsv, "...", 3 ); + sv_catpvs(dsv, "..."); return SvPVX(dsv); } @@ -391,7 +391,7 @@ Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pv pv_pretty( dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); if (len > cur && pv[cur] == '\0') - sv_catpvn( dsv, "\\0", 2 ); + sv_catpvs( dsv, "\\0"); return SvPVX(dsv); } @@ -403,7 +403,7 @@ Perl_sv_peek(pTHX_ SV *sv) int unref = 0; U32 type; - sv_setpvn(t, "", 0); + sv_setpvs(t, ""); retry: if (!sv) { sv_catpv(t, "VOID"); @@ -988,13 +988,13 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o) #ifdef PERL_MAD if (PL_madskills && o->op_madprop) { - SV * const tmpsv = newSVpvn("", 0); + SV * const tmpsv = newSVpvs(""); MADPROP* mp = o->op_madprop; Perl_dump_indent(aTHX_ level, file, "MADPROPS = {\n"); level++; while (mp) { const char tmp = mp->mad_key; - sv_setpvn(tmpsv,"'",1); + sv_setpvs(tmpsv,"'"); if (tmp) sv_catpvn(tmpsv, &tmp, 1); sv_catpv(tmpsv, "'="); @@ -1656,7 +1656,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)AvFILLp(sv)); Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv)); Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", SvMAGIC(sv) ? PTR2UV(AvARYLEN(sv)) : 0); - sv_setpvn(d, "", 0); + sv_setpvs(d, ""); if (AvREAL(sv)) sv_catpv(d, ",REAL"); if (AvREIFY(sv)) sv_catpv(d, ",REIFY"); Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", @@ -2240,7 +2240,7 @@ Perl_sv_catxmlpvn(pTHX_ SV *dsv, const char *pv, STRLEN len, int utf8) PERL_ARGS_ASSERT_SV_CATXMLPVN; - sv_catpvn(dsv,"",0); + sv_catpvs(dsv,""); dsvcur = SvCUR(dsv); /* in case we have to restart */ retry: @@ -2366,7 +2366,7 @@ Perl_sv_xmlpeek(pTHX_ SV *sv) PERL_ARGS_ASSERT_SV_XMLPEEK; sv_utf8_upgrade(t); - sv_setpvn(t, "", 0); + sv_setpvs(t, ""); /* retry: */ if (!sv) { sv_catpv(t, "VOID=\"\""); @@ -2616,7 +2616,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o) PerlIO_printf(file, " addr=\"0x%"UVxf" => 0x%"UVxf"\"", (UV)o, (UV)o->op_next); #endif if (o->op_flags) { - SV * const tmpsv = newSVpvn("", 0); + SV * const tmpsv = newSVpvs(""); switch (o->op_flags & OPf_WANT) { case OPf_WANT_VOID: sv_catpv(tmpsv, ",VOID"); @@ -2647,7 +2647,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o) SvREFCNT_dec(tmpsv); } if (o->op_private) { - SV * const tmpsv = newSVpvn("", 0); + SV * const tmpsv = newSVpvs(""); if (PL_opargs[o->op_type] & OA_TARGLEX) { if (o->op_private & OPpTARGET_MY) sv_catpv(tmpsv, ",TARGET_MY"); @@ -2924,7 +2924,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o) level++; while (mp) { char tmp = mp->mad_key; - sv_setpvn(tmpsv,"\"",1); + sv_setpvs(tmpsv,"\""); if (tmp) sv_catxmlpvn(tmpsv, &tmp, 1, 0); if ((tmp == '_') || (tmp == '#')) /* '_' '#' whitespace belong to the previous token. */ diff --git a/gv.c b/gv.c index 7d737de..77c65a4 100644 --- a/gv.c +++ b/gv.c @@ -1120,7 +1120,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (USE_UTF8_IN_NAMES) SvUTF8_on(err); qerror(err); - gv = gv_fetchpvn_flags("::", 8, GV_ADDMULTI, SVt_PVHV); + gv = gv_fetchpvs("::", GV_ADDMULTI, SVt_PVHV); if(!gv) { /* symbol table under destruction */ return NULL; @@ -1210,15 +1210,15 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, && AvFILLp(av) == -1) { const char *pname; - av_push(av, newSVpvn(pname = "NDBM_File",9)); + av_push(av, newSVpvs(pname = "NDBM_File")); gv_stashpvn(pname, 9, GV_ADD); - av_push(av, newSVpvn(pname = "DB_File",7)); + av_push(av, newSVpvs(pname = "DB_File")); gv_stashpvn(pname, 7, GV_ADD); - av_push(av, newSVpvn(pname = "GDBM_File",9)); + av_push(av, newSVpvs(pname = "GDBM_File")); gv_stashpvn(pname, 9, GV_ADD); - av_push(av, newSVpvn(pname = "SDBM_File",9)); + av_push(av, newSVpvs(pname = "SDBM_File")); gv_stashpvn(pname, 9, GV_ADD); - av_push(av, newSVpvn(pname = "ODBM_File",9)); + av_push(av, newSVpvs(pname = "ODBM_File")); gv_stashpvn(pname, 9, GV_ADD); } } @@ -1425,11 +1425,11 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, break; case '\014': /* $^L */ - sv_setpvn(GvSVn(gv),"\f",1); + sv_setpvs(GvSVn(gv),"\f"); PL_formfeed = GvSVn(gv); break; case ';': - sv_setpvn(GvSVn(gv),"\034",1); + sv_setpvs(GvSVn(gv),"\034"); break; case ']': { diff --git a/mg.c b/mg.c index bfd6e2f..1ae5ad3 100644 --- a/mg.c +++ b/mg.c @@ -781,7 +781,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) if (sys$getmsg(vaxc$errno,&msgdsc.dsc$w_length,&msgdsc,0,0) & 1) sv_setpvn(sv,msgdsc.dsc$a_pointer,msgdsc.dsc$w_length); else - sv_setpvn(sv,"",0); + sv_setpvs(sv,""); } #elif defined(OS2) if (!(_emx_env & 0x200)) { /* Under DOS */ @@ -804,7 +804,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) PerlProc_GetOSError(sv, dwErr); } else - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); SetLastError(dwErr); } #else @@ -2444,7 +2444,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) ensure that hints for input are sooner on linked list. */ tmp = out ? newSVpvn_flags(out + 1, start + len - out - 1, SVs_TEMP | SvUTF8(sv)) - : newSVpvn_flags("", 0, SVs_TEMP | SvUTF8(sv)); + : newSVpvs_flags("", SVs_TEMP | SvUTF8(sv)); tmp_he = Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints_hash, diff --git a/op.c b/op.c index 90a0c52..6406b3d 100644 --- a/op.c +++ b/op.c @@ -5661,7 +5661,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) SvREFCNT_inc_simple_void_NN(const_sv); if (cv) { assert(!CvROOT(cv) && !CvCONST(cv)); - sv_setpvn((SV*)cv, "", 0); /* prototype is "" */ + sv_setpvs((SV*)cv, ""); /* prototype is "" */ CvXSUBANY(cv).any_ptr = const_sv; CvXSUB(cv) = const_sv_xsub; CvCONST_on(cv); @@ -7014,7 +7014,7 @@ Perl_ck_fun(pTHX_ OP *o) namesv = PAD_SVl(targ); SvUPGRADE(namesv, SVt_PV); if (*name != '$') - sv_setpvn(namesv, "$", 1); + sv_setpvs(namesv, "$"); sv_catpvn(namesv, name, len); } } diff --git a/pad.c b/pad.c index a68f4d3..d1b9735 100644 --- a/pad.c +++ b/pad.c @@ -499,7 +499,7 @@ Perl_pad_add_anon(pTHX_ SV* sv, OPCODE op_type) PERL_ARGS_ASSERT_PAD_ADD_ANON; pad_peg("add_anon"); - sv_setpvn(name, "&", 1); + sv_setpvs(name, "&"); /* Are these two actually ever read? */ COP_SEQ_RANGE_HIGH_set(name, ~0); COP_SEQ_RANGE_LOW_set(name, 1); diff --git a/perl.c b/perl.c index 24904f5..7b8cd86 100644 --- a/perl.c +++ b/perl.c @@ -367,9 +367,9 @@ perl_construct(pTHXx) PL_fdpid = newAV(); /* for remembering popen pids by fd */ PL_modglobal = newHV(); /* pointers to per-interpreter module globals */ PL_errors = newSVpvs(""); - sv_setpvn(PERL_DEBUG_PAD(0), "", 0); /* For regex debugging. */ - sv_setpvn(PERL_DEBUG_PAD(1), "", 0); /* ext/re needs these */ - sv_setpvn(PERL_DEBUG_PAD(2), "", 0); /* even without DEBUGGING. */ + sv_setpvs(PERL_DEBUG_PAD(0), ""); /* For regex debugging. */ + sv_setpvs(PERL_DEBUG_PAD(1), ""); /* ext/re needs these */ + sv_setpvs(PERL_DEBUG_PAD(2), ""); /* even without DEBUGGING. */ #ifdef USE_ITHREADS /* First entry is a list of empty elements. It needs to be initialised else all hell breaks loose in S_find_uninit_var(). */ @@ -1712,7 +1712,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) bool add_read_e_script = FALSE; SvGROW(linestr_sv, 80); - sv_setpvn(linestr_sv,"",0); + sv_setpvs(linestr_sv,""); sv = newSVpvs(""); /* first used for -I flags */ SAVEFREESV(sv); @@ -2170,12 +2170,12 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) U32 out = PL_unicode & PERL_UNICODE_OUT_FLAG; if (in) { if (out) - sv_setpvn(sv, ":utf8\0:utf8", 11); + sv_setpvs(sv, ":utf8\0:utf8"); else - sv_setpvn(sv, ":utf8\0", 6); + sv_setpvs(sv, ":utf8\0"); } else if (out) - sv_setpvn(sv, "\0:utf8", 6); + sv_setpvs(sv, "\0:utf8"); SvSETMAGIC(sv); } } @@ -3573,7 +3573,7 @@ S_init_main_stash(pTHX) PL_globalstash = GvHV(gv_fetchpvs("CORE::GLOBAL::", GV_ADDMULTI, SVt_PVHV)); /* We must init $/ before switches are processed. */ - sv_setpvn(get_sv("/", TRUE), "\n", 1); + sv_setpvs(get_sv("/", TRUE), "\n"); } STATIC int @@ -4546,7 +4546,7 @@ S_init_predump_symbols(pTHX) GV *tmpgv; IO *io; - sv_setpvn(get_sv("\"", TRUE), " ", 1); + sv_setpvs(get_sv("\"", TRUE), " "); PL_stdingv = gv_fetchpvs("STDIN", GV_ADD|GV_NOTQUAL, SVt_PVIO); GvMULTI_on(PL_stdingv); io = GvIOp(PL_stdingv); @@ -4633,9 +4633,9 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register PERL_ARGS_ASSERT_INIT_POSTDUMP_SYMBOLS; PL_toptarget = newSV_type(SVt_PVFM); - sv_setpvn(PL_toptarget, "", 0); + sv_setpvs(PL_toptarget, ""); PL_bodytarget = newSV_type(SVt_PVFM); - sv_setpvn(PL_bodytarget, "", 0); + sv_setpvs(PL_bodytarget, ""); PL_formtarget = PL_bodytarget; TAINT; diff --git a/pp.c b/pp.c index c749cc2..fb66c08 100644 --- a/pp.c +++ b/pp.c @@ -2431,7 +2431,7 @@ PP(pp_negate) STRLEN len; const char * const s = SvPV_const(sv, len); if (isIDFIRST(*s)) { - sv_setpvn(TARG, "-", 1); + sv_setpvs(TARG, "-"); sv_catsv(TARG, sv); } else if (*s == '+' || *s == '-') { @@ -2445,7 +2445,7 @@ PP(pp_negate) if (SvNOK(sv)) sv_setnv(TARG, -SvNV(sv)); else { - sv_setpvn(TARG, "-", 1); + sv_setpvs(TARG, "-"); sv_catsv(TARG, sv); } } diff --git a/pp_ctl.c b/pp_ctl.c index f4364ac..f00b3be 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -95,7 +95,7 @@ PP(pp_regcomp) /* multiple args; concatentate them */ dMARK; dORIGMARK; tmpstr = PAD_SV(ARGTARG); - sv_setpvn(tmpstr, "", 0); + sv_setpvs(tmpstr, ""); while (++MARK <= SP) { if (PL_amagic_generation) { SV *sv; @@ -1154,7 +1154,7 @@ PP(pp_flip) RETURNOP(((LOGOP*)cUNOP->op_first)->op_other); } } - sv_setpvn(TARG, "", 0); + sv_setpvs(TARG, ""); SETs(targ); RETURN; } @@ -1537,7 +1537,7 @@ Perl_die_where(pTHX_ const char *message, STRLEN msglen) SV * const err = ERRSV; const char *e = NULL; if (!SvPOK(err)) - sv_setpvn(err,"",0); + sv_setpvs(err,""); else if (SvCUR(err) >= sizeof(prefix)+msglen-1) { STRLEN len; e = SvPV_const(err, len); diff --git a/pp_hot.c b/pp_hot.c index 6ceac4f..279389a 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -255,7 +255,7 @@ PP(pp_concat) if (!SvOK(TARG)) { if (left == right && ckWARN(WARN_UNINITIALIZED)) report_uninit(right); - sv_setpvn(left, "", 0); + sv_setpvs(left, ""); } (void)SvPV_nomg_const(left, llen); /* Needed to set UTF8 flag */ lbyte = !DO_UTF8(left); @@ -1571,7 +1571,7 @@ Perl_do_readline(pTHX) if (av_len(GvAVn(PL_last_in_gv)) < 0) { IoFLAGS(io) &= ~IOf_START; do_open(PL_last_in_gv,"-",1,FALSE,O_RDONLY,0,NULL); - sv_setpvn(GvSVn(PL_last_in_gv), "-", 1); + sv_setpvs(GvSVn(PL_last_in_gv), "-"); SvSETMAGIC(GvSV(PL_last_in_gv)); fp = IoIFP(io); goto have_fp; diff --git a/pp_pack.c b/pp_pack.c index 58a7dee..dbbb34e 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -3592,7 +3592,7 @@ PP(pp_pack) register const char *patend = pat + fromlen; MARK++; - sv_setpvn(cat, "", 0); + sv_setpvs(cat, ""); SvUTF8_off(cat); packlist(cat, pat, patend, MARK, SP + 1); diff --git a/pp_sys.c b/pp_sys.c index 1a75bbb..033482d 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -328,7 +328,7 @@ PP(pp_backtick) ENTER; SAVESPTR(PL_rs); PL_rs = &PL_sv_undef; - sv_setpvn(TARG, "", 0); /* note that this preserves previous buffer */ + sv_setpvs(TARG, ""); /* note that this preserves previous buffer */ while (sv_gets(TARG, fp, SvCUR(TARG)) != NULL) NOOP; LEAVE; @@ -1226,7 +1226,7 @@ PP(pp_getc) RETPUSHUNDEF; } TAINT; - sv_setpvn(TARG, " ", 1); + sv_setpvs(TARG, " "); *SvPVX(TARG) = PerlIO_getc(IoIFP(GvIOp(gv))); /* should never be EOF */ if (PerlIO_isutf8(IoIFP(GvIOp(gv)))) { /* Find out how many bytes the char needs */ @@ -1579,7 +1579,7 @@ PP(pp_sysread) goto say_undef; bufsv = *++MARK; if (! SvOK(bufsv)) - sv_setpvn(bufsv, "", 0); + sv_setpvs(bufsv, ""); length = SvIVx(*++MARK); SETERRNO(0,0); if (MARK < SP) @@ -2023,10 +2023,10 @@ PP(pp_eof) IoFLAGS(io) &= ~IOf_START; do_open(gv, "-", 1, FALSE, O_RDONLY, 0, NULL); if ( GvSV(gv) ) { - sv_setpvn(GvSV(gv), "-", 1); + sv_setpvs(GvSV(gv), "-"); } else { - GvSV(gv) = newSVpvn("-", 1); + GvSV(gv) = newSVpvs("-"); } SvSETMAGIC(GvSV(gv)); } @@ -2819,7 +2819,7 @@ PP(pp_stat) if (gv != PL_defgv) { PL_laststype = OP_STAT; PL_statgv = gv; - sv_setpvn(PL_statname, "", 0); + sv_setpvs(PL_statname, ""); if(gv) { io = GvIO(gv); do_fstat_have_io: @@ -3272,7 +3272,7 @@ PP(pp_fttext) else { PL_statgv = gv; PL_laststatval = -1; - sv_setpvn(PL_statname, "", 0); + sv_setpvs(PL_statname, ""); io = GvIO(PL_statgv); } if (io && IoIFP(io)) { diff --git a/regcomp.c b/regcomp.c index a751136..da68910 100644 --- a/regcomp.c +++ b/regcomp.c @@ -8973,7 +8973,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) PERL_ARGS_ASSERT_REGPROP; - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); if (OP(o) > REGNODE_MAX) /* regnode.type is unsigned */ /* It would be nice to FAIL() here, but this may be called from @@ -9949,7 +9949,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, #endif const regnode *nextbranch= NULL; I32 word_idx; - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); for (word_idx= 0; word_idx < (I32)trie->wordcount; word_idx++) { SV ** const elem_ptr = av_fetch(trie_words,word_idx,0); diff --git a/sv.c b/sv.c index 00e22d0..3293a91 100644 --- a/sv.c +++ b/sv.c @@ -8912,7 +8912,7 @@ Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, { PERL_ARGS_ASSERT_SV_VSETPVFN; - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, maybe_tainted); } @@ -11702,9 +11702,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, #endif PL_encoding = sv_dup(proto_perl->Iencoding, param); - sv_setpvn(PERL_DEBUG_PAD(0), "", 0); /* For regex debugging. */ - sv_setpvn(PERL_DEBUG_PAD(1), "", 0); /* ext/re needs these */ - sv_setpvn(PERL_DEBUG_PAD(2), "", 0); /* even without DEBUGGING. */ + sv_setpvs(PERL_DEBUG_PAD(0), ""); /* For regex debugging. */ + sv_setpvs(PERL_DEBUG_PAD(1), ""); /* ext/re needs these */ + sv_setpvs(PERL_DEBUG_PAD(2), ""); /* even without DEBUGGING. */ /* RE engine related */ @@ -12660,7 +12660,7 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, : DEFSV)) { sv = sv_newmortal(); - sv_setpvn(sv, "$_", 2); + sv_setpvs(sv, "$_"); return sv; } } diff --git a/toke.c b/toke.c index 7150bf3..d77dfaa 100644 --- a/toke.c +++ b/toke.c @@ -1119,17 +1119,17 @@ S_skipspace(pTHX_ register char *s) } else if (PL_minus_n) { #ifdef PERL_MAD - sv_catpvn(PL_linestr, ";}", 2); + sv_catpvs(PL_linestr, ";}"); #else - sv_setpvn(PL_linestr, ";}", 2); + sv_setpvs(PL_linestr, ";}"); #endif PL_minus_n = 0; } else #ifdef PERL_MAD - sv_catpvn(PL_linestr,";", 1); + sv_catpvs(PL_linestr,";"); #else - sv_setpvn(PL_linestr,";", 1); + sv_setpvs(PL_linestr,";"); #endif /* reset variables for next time we lex */ @@ -1319,7 +1319,7 @@ S_curmad(pTHX_ char slot, SV *sv) where = &PL_nexttoke[PL_curforce].next_mad; if (PL_faketokens) - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); else { if (!IN_BYTES) { if (UTF && is_utf8_string((U8*)SvPVX(sv), SvCUR(sv))) @@ -1846,7 +1846,7 @@ S_sublex_done(pTHX) PL_thiswhite = 0; } if (PL_thistoken) - sv_setpvn(PL_thistoken,"",0); + sv_setpvs(PL_thistoken,""); else PL_realtokenstart = -1; } @@ -3768,7 +3768,7 @@ Perl_yylex(pTHX) } PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_last_lop = PL_last_uni = NULL; - sv_setpvn(PL_linestr,"",0); + sv_setpvs(PL_linestr,""); TOKEN(';'); /* not infinite loop because rsfp is NULL now */ } /* If it looks like the start of a BOM or raw UTF-16, @@ -3804,7 +3804,7 @@ Perl_yylex(pTHX) sv_catsv(PL_thiswhite, PL_linestr); #endif if (*s == '=' && strnEQ(s, "=cut", 4) && !isALPHA(s[4])) { - sv_setpvn(PL_linestr, "", 0); + sv_setpvs(PL_linestr, ""); PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = NULL; @@ -3992,7 +3992,7 @@ Perl_yylex(pTHX) /* if we have already added "LINE: while (<>) {", we must not do it again */ { - sv_setpvn(PL_linestr, "", 0); + sv_setpvs(PL_linestr, ""); PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = NULL; @@ -4091,7 +4091,7 @@ Perl_yylex(pTHX) if (!PL_thiswhite) PL_thiswhite = newSVpvs(""); if (CopLINE(PL_curcop) == 1) { - sv_setpvn(PL_thiswhite, "", 0); + sv_setpvs(PL_thiswhite, ""); PL_faketokens = 0; } sv_catpvn(PL_thiswhite, s, d - s); @@ -4655,7 +4655,7 @@ Perl_yylex(pTHX) if (PL_madskills) { if (!PL_thiswhite) PL_thiswhite = newSVpvs(""); - sv_catpvn(PL_thiswhite,"}",1); + sv_catpvs(PL_thiswhite,"}"); } #endif return yylex(); /* ignore fake brackets */ @@ -6727,7 +6727,7 @@ Perl_yylex(pTHX) Perl_croak(aTHX_ "Missing name in \"my sub\""); PL_expect = XTERMBLOCK; attrful = XATTRTERM; - sv_setpvn(PL_subname,"?",1); + sv_setpvs(PL_subname,"?"); have_name = FALSE; } @@ -11410,7 +11410,7 @@ S_scan_heredoc(pTHX_ register char *s) PL_last_lop = PL_last_uni = NULL; } else - sv_setpvn(tmpstr,"",0); /* avoid "uninitialized" warning */ + sv_setpvs(tmpstr,""); /* avoid "uninitialized" warning */ while (s >= PL_bufend) { /* multiple line string? */ #ifdef PERL_MAD if (PL_madskills) { @@ -12907,7 +12907,7 @@ Perl_scan_vstring(pTHX_ const char *s, const char *const e, SV *sv) if (*s == 'v') s++; /* get past 'v' */ - sv_setpvn(sv, "", 0); + sv_setpvs(sv, ""); for (;;) { /* this is atoi() that tolerates underscores */ diff --git a/universal.c b/universal.c index 3745ff9..bf82ae5 100644 --- a/universal.c +++ b/universal.c @@ -504,7 +504,7 @@ XS(XS_version_new) if ( items == 1 || vs == &PL_sv_undef ) { /* no param or explicit undef */ /* create empty object */ vs = sv_newmortal(); - sv_setpvn(vs,"",0); + sv_setpvs(vs,""); } else if ( items == 3 ) { vs = sv_newmortal(); diff --git a/utf8.c b/utf8.c index 08fc541..517a67f 100644 --- a/utf8.c +++ b/utf8.c @@ -2254,7 +2254,7 @@ Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV f PERL_ARGS_ASSERT_PV_UNI_DISPLAY; - sv_setpvn(dsv, "", 0); + sv_setpvs(dsv, ""); SvUTF8_off(dsv); for (s = (const char *)spv, e = s + len; s < e; s += UTF8SKIP(s)) { UV u; @@ -2288,7 +2288,7 @@ Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV f } if (ok) { const char string = ok; - sv_catpvn(dsv, "\\", 1); + sv_catpvs(dsv, "\\"); sv_catpvn(dsv, &string, 1); } } diff --git a/util.c b/util.c index a2a4487..6093655 100644 --- a/util.c +++ b/util.c @@ -3108,13 +3108,13 @@ Perl_same_dirent(pTHX_ const char *a, const char *b) if (strNE(a,b)) return FALSE; if (fa == a) - sv_setpvn(tmpsv, ".", 1); + sv_setpvs(tmpsv, "."); else sv_setpvn(tmpsv, a, fa - a); if (PerlLIO_stat(SvPVX_const(tmpsv), &tmpstatbuf1) < 0) return FALSE; if (fb == b) - sv_setpvn(tmpsv, ".", 1); + sv_setpvs(tmpsv, "."); else sv_setpvn(tmpsv, b, fb - b); if (PerlLIO_stat(SvPVX_const(tmpsv), &tmpstatbuf2) < 0) @@ -4425,7 +4425,7 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) (void)hv_stores(MUTABLE_HV(hv), "original", orig); } else { - (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvn("0",1)); + (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvs("0")); av_push(av, newSViv(0)); } -- 2.7.4