From: Nicholas Clark Date: Thu, 13 Jan 2005 22:54:10 +0000 (+0000) Subject: replace NEWSV(), SvSetSV() with newSVsv() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f2b990bf33ddc9a2c27b053bb94a963bce0c09ce;p=p5sagit%2Fp5-mst-13.2.git replace NEWSV(), SvSetSV() with newSVsv() p4raw-id: //depot/perl@23795 --- diff --git a/pp.c b/pp.c index f960c37..2d0e46a 100644 --- a/pp.c +++ b/pp.c @@ -4186,8 +4186,7 @@ PP(pp_splice) /* make new elements SVs now: avoid problems if they're from the array */ for (dst = MARK, i = newlen; i; i--) { SV *h = *dst; - *dst = NEWSV(46, 0); - sv_setsv(*dst++, h); + *dst++ = newSVsv(h); } if (diff < 0) { /* shrinking the area */ @@ -4395,8 +4394,7 @@ PP(pp_unshift) else { av_unshift(ary, SP - MARK); while (MARK < SP) { - sv = NEWSV(27, 0); - sv_setsv(sv, *++MARK); + sv = newSVsv(*++MARK); (void)av_store(ary, i++, sv); } } @@ -4581,8 +4579,7 @@ PP(pp_split) if (m >= strend) break; - dstr = NEWSV(30, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) @@ -4603,8 +4600,7 @@ PP(pp_split) m++; if (m >= strend) break; - dstr = NEWSV(30, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) @@ -4629,8 +4625,7 @@ PP(pp_split) for (m = s; m < strend && *m != c; m++) ; if (m >= strend) break; - dstr = NEWSV(30, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) @@ -4651,8 +4646,7 @@ PP(pp_split) csv, multiline ? FBMrf_MULTILINE : 0)) ) #endif { - dstr = NEWSV(31, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) @@ -4685,8 +4679,7 @@ PP(pp_split) strend = s + (strend - m); } m = rx->startp[0] + orig; - dstr = NEWSV(32, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); if (make_mortal) sv_2mortal(dstr); if (do_utf8) @@ -4701,8 +4694,7 @@ PP(pp_split) parens that didn't match -- they should be set to undef, not the empty string */ if (m >= orig && s >= orig) { - dstr = NEWSV(33, m-s); - sv_setpvn(dstr, s, m-s); + dstr = newSVpvn(s, m-s); } else dstr = &PL_sv_undef; /* undef, not "" */ @@ -4724,8 +4716,7 @@ PP(pp_split) /* keep field after final delim? */ if (s < strend || (iters && origlimit)) { STRLEN l = strend - s; - dstr = NEWSV(34, l); - sv_setpvn(dstr, s, l); + dstr = newSVpvn(s, l); if (make_mortal) sv_2mortal(dstr); if (do_utf8) diff --git a/pp_hot.c b/pp_hot.c index 22875af..19f8dca 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1008,9 +1008,8 @@ PP(pp_aassign) i = 0; while (relem <= lastrelem) { /* gobble up all the rest */ SV **didstore; - sv = NEWSV(28,0); assert(*relem); - sv_setsv(sv,*relem); + sv = newSVsv(*relem); *(relem++) = sv; didstore = av_store(ary,i++,sv); if (magic) { @@ -2214,8 +2213,7 @@ PP(pp_subst) have_a_cow: #endif rxtainted |= RX_MATCH_TAINTED(rx); - dstr = NEWSV(25, len); - sv_setpvn(dstr, m, s-m); + dstr = newSVpvn(m, s-m); if (DO_UTF8(TARG)) SvUTF8_on(dstr); PL_curpm = pm; diff --git a/pp_sort.c b/pp_sort.c index da019d0..877f171 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1692,8 +1692,7 @@ PP(pp_sort) SV *sv; SV** base, **didstore; for (base = ORIGMARK+1, i=0; i < max; i++) { - sv = NEWSV(28,0); - sv_setsv(sv, base[i]); + sv = newSVsv(base[i]); base[i] = sv; } av_clear(av); diff --git a/regexec.c b/regexec.c index 6a7f064..6ed6d95 100644 --- a/regexec.c +++ b/regexec.c @@ -79,7 +79,7 @@ **** Alterations to Henry's code are... **** **** Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - **** 2000, 2001, 2002, 2003, 2004, by Larry Wall and others + **** 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others **** **** You may distribute under the terms of either the GNU General Public **** License or the Artistic License, as specified in the README file. @@ -4568,8 +4568,7 @@ S_to_utf8_substr(pTHX_ register regexp *prog) { SV* sv; if (prog->float_substr && !prog->float_utf8) { - prog->float_utf8 = sv = NEWSV(117, 0); - SvSetSV(sv, prog->float_substr); + prog->float_utf8 = sv = newSVsv(prog->float_substr); sv_utf8_upgrade(sv); if (SvTAIL(prog->float_substr)) SvTAIL_on(sv); @@ -4577,8 +4576,7 @@ S_to_utf8_substr(pTHX_ register regexp *prog) prog->check_utf8 = sv; } if (prog->anchored_substr && !prog->anchored_utf8) { - prog->anchored_utf8 = sv = NEWSV(118, 0); - SvSetSV(sv, prog->anchored_substr); + prog->anchored_utf8 = sv = newSVsv(prog->anchored_substr); sv_utf8_upgrade(sv); if (SvTAIL(prog->anchored_substr)) SvTAIL_on(sv); @@ -4592,8 +4590,7 @@ S_to_byte_substr(pTHX_ register regexp *prog) { SV* sv; if (prog->float_utf8 && !prog->float_substr) { - prog->float_substr = sv = NEWSV(117, 0); - SvSetSV(sv, prog->float_utf8); + prog->float_substr = sv = newSVsv(prog->float_utf8); if (sv_utf8_downgrade(sv, TRUE)) { if (SvTAIL(prog->float_utf8)) SvTAIL_on(sv); @@ -4605,8 +4602,7 @@ S_to_byte_substr(pTHX_ register regexp *prog) prog->check_substr = sv; } if (prog->anchored_utf8 && !prog->anchored_substr) { - prog->anchored_substr = sv = NEWSV(118, 0); - SvSetSV(sv, prog->anchored_utf8); + prog->anchored_substr = sv = newSVsv(prog->anchored_utf8); if (sv_utf8_downgrade(sv, TRUE)) { if (SvTAIL(prog->anchored_utf8)) SvTAIL_on(sv); diff --git a/scope.c b/scope.c index c158544..db55735 100644 --- a/scope.c +++ b/scope.c @@ -350,9 +350,8 @@ Perl_save_hash(pTHX_ GV *gv) void Perl_save_item(pTHX_ register SV *item) { - register SV *sv = NEWSV(0,0); + register SV *sv = newSVsv(item); - sv_setsv(sv,item); SSCHECK(3); SSPUSHPTR(item); /* remember the pointer */ SSPUSHPTR(sv); /* remember the value */ diff --git a/toke.c b/toke.c index fcd143a..eb8a581 100644 --- a/toke.c +++ b/toke.c @@ -275,9 +275,7 @@ S_tokereport(pTHX_ char* s, I32 rv) char *name = Nullch; enum token_type type = TOKENTYPE_NONE; struct debug_tokens *p; - SV* report = NEWSV(0, 60); - - Perl_sv_catpvf(aTHX_ report, "<== "); + SV* report = newSVpvn("<== ", 4); for (p = debug_tokens; p->token; p++) { if (p->token == (int)rv) {