From c69006e4a4556d3b1d6e1a57c49a95b1d16efeb0 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 10 May 2005 15:38:07 +0000 Subject: [PATCH] s/sv_setpv(sv,"")/sv_setpvn(sv,"",0)/ plus a couple of 1 byte sv_setpv()s too. p4raw-id: //depot/perl@24439 --- doio.c | 4 ++-- dump.c | 2 +- ext/B/B.xs | 2 +- ext/Storable/Storable.xs | 2 +- mg.c | 4 ++-- op.c | 4 ++-- perl.c | 6 +++--- pp_ctl.c | 14 +++++++------- pp_hot.c | 2 +- pp_sys.c | 8 ++++---- toke.c | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/doio.c b/doio.c index 8de13f1..64ac77e 100644 --- a/doio.c +++ b/doio.c @@ -1373,7 +1373,7 @@ Perl_my_stat(pTHX) io = GvIO(gv); if (io && IoIFP(io)) { PL_statgv = gv; - sv_setpv(PL_statname,""); + sv_setpvn(PL_statname,"", 0); PL_laststype = OP_STAT; return (PL_laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &PL_statcache)); } @@ -1383,7 +1383,7 @@ Perl_my_stat(pTHX) if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) report_evil_fh(gv, io, PL_op->op_type); PL_statgv = Nullgv; - sv_setpv(PL_statname,""); + sv_setpvn(PL_statname,"", 0); return (PL_laststatval = -1); } } diff --git a/dump.c b/dump.c index 2ee5483..b20c602 100644 --- a/dump.c +++ b/dump.c @@ -1343,7 +1343,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv)); Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", PTR2UV(AvARYLEN(sv))); flags = AvFLAGS(sv); - sv_setpv(d, ""); + sv_setpvn(d, "", 0); if (flags & AVf_REAL) sv_catpv(d, ",REAL"); if (flags & AVf_REIFY) sv_catpv(d, ",REIFY"); if (flags & AVf_REUSED) sv_catpv(d, ",REUSED"); diff --git a/ext/B/B.xs b/ext/B/B.xs index a5aecbb..fc9ef7c 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -257,7 +257,7 @@ cstring(pTHX_ SV *sv, bool perlstyle) SV *tmpsv = sv_newmortal(); /* Temporary SV to feed sv_uni_display */ len = SvCUR(sv); s = sv_uni_display(tmpsv, sv, 8*len, UNI_DISPLAY_QQ); - sv_setpv(sstr,"\""); + sv_setpvn(sstr,"\"",1); while (*s) { if (*s == '"') diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index aaf62e2..628dd0a 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -5386,7 +5386,7 @@ static SV *retrieve_code(pTHX_ stcxt_t *cxt, char *cname) if (SvROK(cxt->eval) && SvTYPE(SvRV(cxt->eval)) == SVt_PVCV) { SV* errsv = get_sv("@", TRUE); - sv_setpv(errsv, ""); /* clear $@ */ + sv_setpvn(errsv, "", 0); /* clear $@ */ PUSHMARK(sp); XPUSHs(sv_2mortal(newSVsv(sub))); PUTBACK; diff --git a/mg.c b/mg.c index 21a3747..bb16dea 100644 --- a/mg.c +++ b/mg.c @@ -608,7 +608,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_setpv(sv,""); + sv_setpvn(sv,"",0); } #else #ifdef OS2 @@ -634,7 +634,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) PerlProc_GetOSError(sv, dwErr); } else - sv_setpv(sv, ""); + sv_setpvn(sv, "", 0); SetLastError(dwErr); } #else diff --git a/op.c b/op.c index e852f47..1afdbc0 100644 --- a/op.c +++ b/op.c @@ -4355,7 +4355,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) (void)SvREFCNT_inc(const_sv); if (cv) { assert(!CvROOT(cv) && !CvCONST(cv)); - sv_setpv((SV*)cv, ""); /* prototype is "" */ + sv_setpvn((SV*)cv, "", 0); /* prototype is "" */ CvXSUBANY(cv).any_ptr = const_sv; CvXSUB(cv) = const_sv_xsub; CvCONST_on(cv); @@ -4609,7 +4609,7 @@ Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv) cv = newXS(name, const_sv_xsub, savepv(CopFILE(PL_curcop))); CvXSUBANY(cv).any_ptr = sv; CvCONST_on(cv); - sv_setpv((SV*)cv, ""); /* prototype is "" */ + sv_setpvn((SV*)cv, "", 0); /* prototype is "" */ if (stash) CopSTASH_free(PL_curcop); diff --git a/perl.c b/perl.c index e47fe92..ca209a3 100644 --- a/perl.c +++ b/perl.c @@ -2186,7 +2186,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags) if (flags & G_KEEPERR) PL_in_eval |= EVAL_KEEPERR; else - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); } PL_markstack_ptr++; @@ -2197,7 +2197,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags) call_body((OP*)&myop, FALSE); retval = PL_stack_sp - (PL_stack_base + oldmark); if (!(flags & G_KEEPERR)) - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); break; case 1: STATUS_ALL_FAILURE; @@ -2322,7 +2322,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) call_body((OP*)&myop,TRUE); retval = PL_stack_sp - (PL_stack_base + oldmark); if (!(flags & G_KEEPERR)) - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); break; case 1: STATUS_ALL_FAILURE; diff --git a/pp_ctl.c b/pp_ctl.c index 1c582bc..8295777 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1085,7 +1085,7 @@ PP(pp_flip) RETURNOP(((LOGOP*)cUNOP->op_first)->op_other); } } - sv_setpv(TARG, ""); + sv_setpvn(TARG, "", 0); SETs(targ); RETURN; } @@ -1397,7 +1397,7 @@ Perl_die_where(pTHX_ const char *message, STRLEN msglen) SV *err = ERRSV; const char *e = Nullch; if (!SvPOK(err)) - sv_setpv(err,""); + sv_setpvn(err,"",0); else if (SvCUR(err) >= sizeof(prefix)+msglen-1) { e = SvPV(err, n_a); e += n_a - msglen; @@ -2030,7 +2030,7 @@ PP(pp_return) LEAVESUB(sv); if (clear_errsv) - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); return retop; } @@ -2920,7 +2920,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) if (saveop && saveop->op_flags & OPf_SPECIAL) PL_in_eval |= EVAL_KEEPERR; else - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); if (yyparse() || PL_error_count || !PL_eval_root) { SV **newsp; /* Used by POPBLOCK. */ PERL_CONTEXT *cx = &cxstack[cxstack_ix]; @@ -3533,7 +3533,7 @@ PP(pp_leaveeval) else { LEAVE; if (!(save_flags & OPf_SPECIAL)) - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); } RETURNOP(retop); @@ -3553,7 +3553,7 @@ PP(pp_entertry) cx->blk_eval.retop = cLOGOP->op_other->op_next; PL_in_eval = EVAL_INEVAL; - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); PUTBACK; return DOCATCH(PL_op->op_next); } @@ -3600,7 +3600,7 @@ PP(pp_leavetry) PL_curpm = newpm; /* Don't pop $1 et al till now */ LEAVE; - sv_setpv(ERRSV,""); + sv_setpvn(ERRSV,"",0); RETURN; } diff --git a/pp_hot.c b/pp_hot.c index f6caadb..a3734c1 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -172,7 +172,7 @@ PP(pp_concat) if (SvGMAGICAL(left)) mg_get(left); /* or mg_get(left) may happen here */ if (!SvOK(TARG)) - sv_setpv(left, ""); + sv_setpvn(left, "", 0); (void)SvPV_nomg(left, llen); /* Needed to set UTF8 flag */ lbyte = !DO_UTF8(left); if (IN_BYTES) diff --git a/pp_sys.c b/pp_sys.c index a920a6c..60f9c90 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -348,7 +348,7 @@ PP(pp_backtick) ENTER; SAVESPTR(PL_rs); PL_rs = &PL_sv_undef; - sv_setpv(TARG, ""); /* note that this preserves previous buffer */ + sv_setpvn(TARG, "", 0); /* note that this preserves previous buffer */ while (sv_gets(TARG, fp, SvCUR(TARG)) != Nullch) /*SUPPRESS 530*/ ; @@ -1230,7 +1230,7 @@ PP(pp_getc) RETPUSHUNDEF; } TAINT; - sv_setpv(TARG, " "); + sv_setpvn(TARG, " ", 1); *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 */ @@ -2822,7 +2822,7 @@ PP(pp_stat) if (gv != PL_defgv) { PL_laststype = OP_STAT; PL_statgv = gv; - sv_setpv(PL_statname, ""); + sv_setpvn(PL_statname, "", 0); PL_laststatval = (GvIO(gv) && IoIFP(GvIOp(gv)) ? PerlLIO_fstat(PerlIO_fileno(IoIFP(GvIOn(gv))), &PL_statcache) : -1); } @@ -3423,7 +3423,7 @@ PP(pp_fttext) else { PL_statgv = gv; PL_laststatval = -1; - sv_setpv(PL_statname, ""); + sv_setpvn(PL_statname, "", 0); io = GvIO(PL_statgv); } if (io && IoIFP(io)) { diff --git a/toke.c b/toke.c index 4e7f695..3d32662 100644 --- a/toke.c +++ b/toke.c @@ -2661,7 +2661,7 @@ Perl_yylex(pTHX) } PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_last_lop = PL_last_uni = Nullch; - sv_setpv(PL_linestr,""); + sv_setpvn(PL_linestr,"",0); TOKEN(';'); /* not infinite loop because rsfp is NULL now */ } /* If it looks like the start of a BOM or raw UTF-16, @@ -2702,7 +2702,7 @@ Perl_yylex(pTHX) if (PL_doextract) { /* Incest with pod. */ if (*s == '=' && strnEQ(s, "=cut", 4)) { - sv_setpv(PL_linestr, ""); + sv_setpvn(PL_linestr, "", 0); PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = Nullch; @@ -2888,7 +2888,7 @@ Perl_yylex(pTHX) /* if we have already added "LINE: while (<>) {", we must not do it again */ { - sv_setpv(PL_linestr, ""); + sv_setpvn(PL_linestr, "", 0); PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr); PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); PL_last_lop = PL_last_uni = Nullch; @@ -5231,7 +5231,7 @@ Perl_yylex(pTHX) Perl_croak(aTHX_ "Missing name in \"my sub\""); PL_expect = XTERMBLOCK; attrful = XATTRTERM; - sv_setpv(PL_subname,"?"); + sv_setpvn(PL_subname,"?",1); have_name = FALSE; } -- 2.7.4