Skip Menu |
Report information
Id: 122070
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: ilmari <ilmari [at] ilmari.org>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type:
  • unknown
  • Patch
Perl Version: (no value)
Fixed In: (no value)



Subject: [PATCH] Change newSVpvn("…", …) tonewSVpvs("…")
To: perlbug [...] perl.org
Date: Mon, 09 Jun 2014 19:40:45 +0200
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Download (untitled) / with headers
text/plain 585b
The dual-life dists affected use Devel::PPPort, so can safely use newSVpvs() even though it wasn't added until Perl v5.8.9. The newSVpvn("\\", 2) in Dumper.xs looks like a bug, since that would create '\&*foo', which is not valid syntax. However, I could not find a way to trigger that code path. -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl

Message body is not shown because it is too large.

Date: Mon, 09 Jun 2014 19:58:11 +0200
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Subject: Re: [perl #122070] [PATCH] Change sv_catpvn(…, "…", …) tosv_catpvs(…, "…")
To: perlbug-followup [...] perl.org
Download (untitled) / with headers
text/plain 239b
The dual-life dist affected uses Devel::PPPort, so can safely use sv_catpvs() even though it wasn't added until Perl v5.8.9. -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen
From 824889c74e41131cf627b432e8dcc57aac84eb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org> Date: Mon, 9 Jun 2014 18:53:36 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Change=20sv=5Fcatpvn(=E2=80=A6,=20"?= =?UTF-8?q?=E2=80=A6",=20=E2=80=A6)=20to=20sv=5Fcatpvs(=E2=80=A6,=20"?= =?UTF-8?q?=E2=80=A6")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dual-life dist affected uses Devel::PPPort, so can safely use sv_catpvs() even though it wasn't added until Perl v5.8.9. --- dist/Data-Dumper/Dumper.xs | 92 +++++++++++++++++++++++----------------------- pp_ctl.c | 4 +- win32/win32.c | 4 +- win32/wince.c | 4 +- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 049121f..44d3999 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -498,13 +498,13 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SV *postentry; if (realtype == SVt_PVHV) - sv_catpvn(retval, "{}", 2); + sv_catpvs(retval, "{}"); else if (realtype == SVt_PVAV) - sv_catpvn(retval, "[]", 2); + sv_catpvs(retval, "[]"); else - sv_catpvn(retval, "do{my $o}", 9); + sv_catpvs(retval, "do{my $o}"); postentry = newSVpvn(name, namelen); - sv_catpvn(postentry, " = ", 3); + sv_catpvs(postentry, " = "); sv_catsv(postentry, othername); av_push(postav, postentry); } @@ -517,9 +517,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } else { sv_catpvn(retval, name, 1); - sv_catpvn(retval, "{", 1); + sv_catpvs(retval, "{"); sv_catsv(retval, othername); - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); } } else @@ -584,9 +584,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if (!purity && maxdepth > 0 && *levelp >= maxdepth) { STRLEN vallen; const char * const valstr = SvPV(val,vallen); - sv_catpvn(retval, "'", 1); - sv_catpvn(retval, valstr, vallen); - sv_catpvn(retval, "'", 1); + sv_catpvs(retval, "'"); + sv_catpvs(retval, valstr, vallen); + sv_catpvs(retval, "'"); return 1; } @@ -594,7 +594,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, STRLEN blesslen; const char * const blessstr = SvPV(bless, blesslen); sv_catpvn(retval, blessstr, blesslen); - sv_catpvn(retval, "( ", 2); + sv_catpvs(retval, "( "); if (indent >= 2) { blesspad = apad; apad = newSVsv(apad); @@ -646,18 +646,18 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, rval = SvPV(sv_pattern, rlen); rend = rval+rlen; slash = rval; - sv_catpvn(retval, "qr/", 3); + sv_catpvs(retval, "qr/"); for (;slash < rend; slash++) { if (*slash == '\\') { ++slash; continue; } if (*slash == '/') { sv_catpvn(retval, rval, slash-rval); - sv_catpvn(retval, "\\/", 2); + sv_catpvs(retval, "\\/"); rlen -= slash-rval+1; rval = slash+1; } } sv_catpvn(retval, rval, rlen); - sv_catpvn(retval, "/", 1); + sv_catpvs(retval, "/"); if (sv_flags) sv_catsv(retval, sv_flags); } @@ -670,17 +670,17 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, ) { /* scalar ref */ SV * const namesv = newSVpvs("${"); sv_catpvn(namesv, name, namelen); - sv_catpvn(namesv, "}", 1); + sv_catpvs(namesv, "}"); if (realpack) { /* blessed */ - sv_catpvn(retval, "do{\\(my $o = ", 13); + sv_catpvs(retval, "do{\\(my $o = "); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, maxdepth, sortkeys, use_sparse_seen_hash, useqq); - sv_catpvn(retval, ")}", 2); + sv_catpvs(retval, ")}"); } /* plain */ else { - sv_catpvn(retval, "\\", 1); + sv_catpvs(retval, "\\"); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, @@ -691,8 +691,8 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, else if (realtype == SVt_PVGV) { /* glob ref */ SV * const namesv = newSVpvs("*{"); sv_catpvn(namesv, name, namelen); - sv_catpvn(namesv, "}", 1); - sv_catpvn(retval, "\\", 1); + sv_catpvs(namesv, "}"); + sv_catpvs(retval, "\\"); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, @@ -710,11 +710,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, (void)strcpy(iname, name); inamelen = namelen; if (name[0] == '@') { - sv_catpvn(retval, "(", 1); + sv_catpvs(retval, "("); iname[0] = '$'; } else { - sv_catpvn(retval, "[", 1); + sv_catpvs(retval, "["); /* omit "->" in $foo{bar}->[0], but not in ${$foo}->[0] */ /*if (namelen > 0 && name[namelen-1] != ']' && name[namelen-1] != '}' @@ -761,7 +761,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if (indent >= 3) { sv_catsv(retval, totpad); sv_catsv(retval, ipad); - sv_catpvn(retval, "#", 1); + sv_catpvs(retval, "#"); sv_catsv(retval, ixsv); } sv_catsv(retval, totpad); @@ -771,7 +771,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, freezer, toaster, purity, deepcopy, quotekeys, bless, maxdepth, sortkeys, use_sparse_seen_hash, useqq); if (ix < ixmax) - sv_catpvn(retval, ",", 1); + sv_catpvs(retval, ","); } if (ixmax >= 0) { SV * const opad = sv_x(aTHX_ Nullsv, SvPVX_const(xpad), SvCUR(xpad), (*levelp)-1); @@ -780,9 +780,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(opad); } if (name[0] == '@') - sv_catpvn(retval, ")", 1); + sv_catpvs(retval, ")"); else - sv_catpvn(retval, "]", 1); + sv_catpvs(retval, "]"); SvREFCNT_dec(ixsv); SvREFCNT_dec(totpad); Safefree(iname); @@ -798,11 +798,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SV * const iname = newSVpvn(name, namelen); if (name[0] == '%') { - sv_catpvn(retval, "(", 1); + sv_catpvs(retval, "("); (SvPVX(iname))[0] = '$'; } else { - sv_catpvn(retval, "{", 1); + sv_catpvs(retval, "{"); /* omit "->" in $foo[0]->{bar}, but not in ${$foo}->{bar} */ if ((namelen > 0 && name[namelen-1] != ']' && name[namelen-1] != '}') @@ -810,16 +810,16 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, && (name[1] == '{' || (name[0] == '\\' && name[2] == '{')))) { - sv_catpvn(iname, "->", 2); + sv_catpvs(iname, "->"); } } if (name[0] == '*' && name[namelen-1] == '}' && namelen >= 8 && (instr(name+namelen-8, "{SCALAR}") || instr(name+namelen-7, "{ARRAY}") || instr(name+namelen-6, "{HASH}"))) { - sv_catpvn(iname, "->", 2); + sv_catpvs(iname, "->"); } - sv_catpvn(iname, "{", 1); + sv_catpvs(iname, "{"); totpad = newSVsv(sep); sv_catsv(totpad, pad); sv_catsv(totpad, apad); @@ -894,7 +894,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } if (i) - sv_catpvn(retval, ",", 1); + sv_catpvs(retval, ","); if (sortkeys) { char *key; @@ -961,7 +961,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } sname = newSVsv(iname); sv_catpvn(sname, nkey, nlen); - sv_catpvn(sname, "}", 1); + sv_catpvs(sname, "}"); sv_catsv(retval, pair); if (indent >= 2) { @@ -994,14 +994,14 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(opad); } if (name[0] == '%') - sv_catpvn(retval, ")", 1); + sv_catpvs(retval, ")"); else - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); SvREFCNT_dec(iname); SvREFCNT_dec(totpad); } else if (realtype == SVt_PVCV) { - sv_catpvn(retval, "sub { \"DUMMY\" }", 15); + sv_catpvs(retval, "sub { \"DUMMY\" }"); if (purity) warn("Encountered CODE ref, using dummy placeholder"); } @@ -1017,7 +1017,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(apad); apad = blesspad; } - sv_catpvn(retval, ", '", 3); + sv_catpvs(retval, ", '"); plen = strlen(realpack); pticks = num_q(realpack, plen); @@ -1036,11 +1036,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, else { sv_catpvn(retval, realpack, strlen(realpack)); } - sv_catpvn(retval, "' )", 3); + sv_catpvs(retval, "' )"); if (toaster && SvPOK(toaster) && SvCUR(toaster)) { - sv_catpvn(retval, "->", 2); + sv_catpvs(retval, "->"); sv_catsv(retval, toaster); - sv_catpvn(retval, "()", 2); + sv_catpvs(retval, "()"); } } SvREFCNT_dec(ipad); @@ -1065,9 +1065,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if ((svp = av_fetch(seenentry, 0, FALSE)) && (othername = *svp) && (svp = av_fetch(seenentry, 2, FALSE)) && *svp && SvIV(*svp) > 0) { - sv_catpvn(retval, "${", 2); + sv_catpvs(retval, "${"); sv_catsv(retval, othername); - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); return 1; } } @@ -1178,7 +1178,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, sv_setsv(nname, postentry); sv_catpvn(nname, entries[j], sizes[j]); - sv_catpvn(postentry, " = ", 3); + sv_catpvs(postentry, " = "); av_push(postav, postentry); e = newRV_inc(e); @@ -1200,7 +1200,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } } else if (val == &PL_sv_undef || !SvOK(val)) { - sv_catpvn(retval, "undef", 5); + sv_catpvs(retval, "undef"); } #ifdef SvVOK else if (SvMAGICAL(val) && (mg = mg_find(val, 'V'))) { @@ -1455,7 +1455,7 @@ Data_Dumper_Dumpxs(href, ...) if (postlen >= 0 || !terse) { sv_insert(valstr, 0, 0, " = ", 3); sv_insert(valstr, 0, 0, SvPVX_const(name), SvCUR(name)); - sv_catpvn(valstr, ";", 1); + sv_catpvs(valstr, ";"); } sv_catsv(retval, pad); sv_catsv(retval, valstr); @@ -1469,13 +1469,13 @@ Data_Dumper_Dumpxs(href, ...) if (svp && (elem = *svp)) { sv_catsv(retval, elem); if (i < postlen) { - sv_catpvn(retval, ";", 1); + sv_catpvs(retval, ";"); sv_catsv(retval, sep); sv_catsv(retval, pad); } } } - sv_catpvn(retval, ";", 1); + sv_catpvs(retval, ";"); sv_catsv(retval, sep); } sv_setpvn(valstr, "", 0); diff --git a/pp_ctl.c b/pp_ctl.c index 6a619ce..b559c5a 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3649,7 +3649,7 @@ S_doopen_pm(pTHX_ SV *name) Stat_t pmcstat; SvSetSV_nosteal(pmcsv,name); - sv_catpvn(pmcsv, "c", 1); + sv_catpvs(pmcsv, "c"); if (PerlLIO_stat(SvPV_nolen_const(pmcsv), &pmcstat) >= 0) return check_type_and_open(pmcsv); @@ -4078,7 +4078,7 @@ PP(pp_require) sv_catpv(msg, " (you may need to install the "); for (c = name; c < e; c++) { if (*c == '/') { - sv_catpvn(msg, "::", 2); + sv_catpvs(msg, "::"); } else { sv_catpvn(msg, c, 1); diff --git a/win32/win32.c b/win32/win32.c index b601452..26d419e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -360,7 +360,7 @@ get_emd_part(SV **prev_pathp, STRLEN *const len, char *trailing_path, ...) if (!*prev_pathp) *prev_pathp = sv_2mortal(newSVpvs("")); else if (SvPVX(*prev_pathp)) - sv_catpvn(*prev_pathp, ";", 1); + sv_catpvs(*prev_pathp, ";"); sv_catpv(*prev_pathp, mod_name); if(len) *len = SvCUR(*prev_pathp); @@ -418,7 +418,7 @@ win32_get_xlib(const char *pl, const char *xlib, const char *libname, sv1 = sv2; } else if (sv2) { dTHX; - sv_catpvn(sv1, ";", 1); + sv_catpv(sv1, ";"); sv_catsv(sv1, sv2); } diff --git a/win32/wince.c b/win32/wince.c index bbe8d31..271df2b 100644 --- a/win32/wince.c +++ b/win32/wince.c @@ -227,7 +227,7 @@ get_emd_part(SV **prev_pathp, STRLEN *const len, char *trailing_path, ...) dTHX; if (!*prev_pathp) *prev_pathp = sv_2mortal(newSVpvs("")); - sv_catpvn(*prev_pathp, ";", 1); + sv_catpvs(*prev_pathp, ";"); sv_catpv(*prev_pathp, mod_name); if(len) *len = SvCUR(*prev_pathp); @@ -286,7 +286,7 @@ win32_get_xlib(const char *pl, const char *xlib, const char *libname, if (!sv1) { sv1 = sv2; } else if (sv2) { - sv_catpvn(sv1, ";", 1); + sv_catpvs(sv1, ";"); sv_catsv(sv1, sv2); } -- 2.0.0
Subject: Re: [perl #122070] [PATCH] Change sv_catpvn(…, "…", …) tosv_catpvs(…, "…")
To: perlbug-followup [...] perl.org
Date: Mon, 09 Jun 2014 20:10:49 +0200
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Download (untitled) / with headers
text/plain 273b
Oops, the previous patch had a spurious s/pvn/pvs/ for a non-constant item, so failed to compile. Here's an updated version which builds and passes all tests. -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen
From 8f31ba5b847a7cbcac0eb30cf72ca423c4ec74f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org> Date: Mon, 9 Jun 2014 18:53:36 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Change=20sv=5Fcatpvn(=E2=80=A6,=20"?= =?UTF-8?q?=E2=80=A6",=20=E2=80=A6)=20to=20sv=5Fcatpvs(=E2=80=A6,=20"?= =?UTF-8?q?=E2=80=A6")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dual-life dist affected uses Devel::PPPort, so can safely use sv_catpvs() even though it wasn't added until Perl v5.8.9. --- dist/Data-Dumper/Dumper.xs | 90 +++++++++++++++++++++++----------------------- pp_ctl.c | 4 +-- win32/win32.c | 4 +-- win32/wince.c | 4 +-- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 049121f..6356501 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -498,13 +498,13 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SV *postentry; if (realtype == SVt_PVHV) - sv_catpvn(retval, "{}", 2); + sv_catpvs(retval, "{}"); else if (realtype == SVt_PVAV) - sv_catpvn(retval, "[]", 2); + sv_catpvs(retval, "[]"); else - sv_catpvn(retval, "do{my $o}", 9); + sv_catpvs(retval, "do{my $o}"); postentry = newSVpvn(name, namelen); - sv_catpvn(postentry, " = ", 3); + sv_catpvs(postentry, " = "); sv_catsv(postentry, othername); av_push(postav, postentry); } @@ -517,9 +517,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } else { sv_catpvn(retval, name, 1); - sv_catpvn(retval, "{", 1); + sv_catpvs(retval, "{"); sv_catsv(retval, othername); - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); } } else @@ -584,9 +584,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if (!purity && maxdepth > 0 && *levelp >= maxdepth) { STRLEN vallen; const char * const valstr = SvPV(val,vallen); - sv_catpvn(retval, "'", 1); + sv_catpvs(retval, "'"); sv_catpvn(retval, valstr, vallen); - sv_catpvn(retval, "'", 1); + sv_catpvs(retval, "'"); return 1; } @@ -594,7 +594,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, STRLEN blesslen; const char * const blessstr = SvPV(bless, blesslen); sv_catpvn(retval, blessstr, blesslen); - sv_catpvn(retval, "( ", 2); + sv_catpvs(retval, "( "); if (indent >= 2) { blesspad = apad; apad = newSVsv(apad); @@ -646,18 +646,18 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, rval = SvPV(sv_pattern, rlen); rend = rval+rlen; slash = rval; - sv_catpvn(retval, "qr/", 3); + sv_catpvs(retval, "qr/"); for (;slash < rend; slash++) { if (*slash == '\\') { ++slash; continue; } if (*slash == '/') { sv_catpvn(retval, rval, slash-rval); - sv_catpvn(retval, "\\/", 2); + sv_catpvs(retval, "\\/"); rlen -= slash-rval+1; rval = slash+1; } } sv_catpvn(retval, rval, rlen); - sv_catpvn(retval, "/", 1); + sv_catpvs(retval, "/"); if (sv_flags) sv_catsv(retval, sv_flags); } @@ -670,17 +670,17 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, ) { /* scalar ref */ SV * const namesv = newSVpvs("${"); sv_catpvn(namesv, name, namelen); - sv_catpvn(namesv, "}", 1); + sv_catpvs(namesv, "}"); if (realpack) { /* blessed */ - sv_catpvn(retval, "do{\\(my $o = ", 13); + sv_catpvs(retval, "do{\\(my $o = "); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, maxdepth, sortkeys, use_sparse_seen_hash, useqq); - sv_catpvn(retval, ")}", 2); + sv_catpvs(retval, ")}"); } /* plain */ else { - sv_catpvn(retval, "\\", 1); + sv_catpvs(retval, "\\"); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, @@ -691,8 +691,8 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, else if (realtype == SVt_PVGV) { /* glob ref */ SV * const namesv = newSVpvs("*{"); sv_catpvn(namesv, name, namelen); - sv_catpvn(namesv, "}", 1); - sv_catpvn(retval, "\\", 1); + sv_catpvs(namesv, "}"); + sv_catpvs(retval, "\\"); DD_dump(aTHX_ ival, SvPVX_const(namesv), SvCUR(namesv), retval, seenhv, postav, levelp, indent, pad, xpad, apad, sep, pair, freezer, toaster, purity, deepcopy, quotekeys, bless, @@ -710,11 +710,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, (void)strcpy(iname, name); inamelen = namelen; if (name[0] == '@') { - sv_catpvn(retval, "(", 1); + sv_catpvs(retval, "("); iname[0] = '$'; } else { - sv_catpvn(retval, "[", 1); + sv_catpvs(retval, "["); /* omit "->" in $foo{bar}->[0], but not in ${$foo}->[0] */ /*if (namelen > 0 && name[namelen-1] != ']' && name[namelen-1] != '}' @@ -761,7 +761,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if (indent >= 3) { sv_catsv(retval, totpad); sv_catsv(retval, ipad); - sv_catpvn(retval, "#", 1); + sv_catpvs(retval, "#"); sv_catsv(retval, ixsv); } sv_catsv(retval, totpad); @@ -771,7 +771,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, freezer, toaster, purity, deepcopy, quotekeys, bless, maxdepth, sortkeys, use_sparse_seen_hash, useqq); if (ix < ixmax) - sv_catpvn(retval, ",", 1); + sv_catpvs(retval, ","); } if (ixmax >= 0) { SV * const opad = sv_x(aTHX_ Nullsv, SvPVX_const(xpad), SvCUR(xpad), (*levelp)-1); @@ -780,9 +780,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(opad); } if (name[0] == '@') - sv_catpvn(retval, ")", 1); + sv_catpvs(retval, ")"); else - sv_catpvn(retval, "]", 1); + sv_catpvs(retval, "]"); SvREFCNT_dec(ixsv); SvREFCNT_dec(totpad); Safefree(iname); @@ -798,11 +798,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SV * const iname = newSVpvn(name, namelen); if (name[0] == '%') { - sv_catpvn(retval, "(", 1); + sv_catpvs(retval, "("); (SvPVX(iname))[0] = '$'; } else { - sv_catpvn(retval, "{", 1); + sv_catpvs(retval, "{"); /* omit "->" in $foo[0]->{bar}, but not in ${$foo}->{bar} */ if ((namelen > 0 && name[namelen-1] != ']' && name[namelen-1] != '}') @@ -810,16 +810,16 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, && (name[1] == '{' || (name[0] == '\\' && name[2] == '{')))) { - sv_catpvn(iname, "->", 2); + sv_catpvs(iname, "->"); } } if (name[0] == '*' && name[namelen-1] == '}' && namelen >= 8 && (instr(name+namelen-8, "{SCALAR}") || instr(name+namelen-7, "{ARRAY}") || instr(name+namelen-6, "{HASH}"))) { - sv_catpvn(iname, "->", 2); + sv_catpvs(iname, "->"); } - sv_catpvn(iname, "{", 1); + sv_catpvs(iname, "{"); totpad = newSVsv(sep); sv_catsv(totpad, pad); sv_catsv(totpad, apad); @@ -894,7 +894,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } if (i) - sv_catpvn(retval, ",", 1); + sv_catpvs(retval, ","); if (sortkeys) { char *key; @@ -961,7 +961,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } sname = newSVsv(iname); sv_catpvn(sname, nkey, nlen); - sv_catpvn(sname, "}", 1); + sv_catpvs(sname, "}"); sv_catsv(retval, pair); if (indent >= 2) { @@ -994,14 +994,14 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(opad); } if (name[0] == '%') - sv_catpvn(retval, ")", 1); + sv_catpvs(retval, ")"); else - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); SvREFCNT_dec(iname); SvREFCNT_dec(totpad); } else if (realtype == SVt_PVCV) { - sv_catpvn(retval, "sub { \"DUMMY\" }", 15); + sv_catpvs(retval, "sub { \"DUMMY\" }"); if (purity) warn("Encountered CODE ref, using dummy placeholder"); } @@ -1017,7 +1017,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, SvREFCNT_dec(apad); apad = blesspad; } - sv_catpvn(retval, ", '", 3); + sv_catpvs(retval, ", '"); plen = strlen(realpack); pticks = num_q(realpack, plen); @@ -1036,11 +1036,11 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, else { sv_catpvn(retval, realpack, strlen(realpack)); } - sv_catpvn(retval, "' )", 3); + sv_catpvs(retval, "' )"); if (toaster && SvPOK(toaster) && SvCUR(toaster)) { - sv_catpvn(retval, "->", 2); + sv_catpvs(retval, "->"); sv_catsv(retval, toaster); - sv_catpvn(retval, "()", 2); + sv_catpvs(retval, "()"); } } SvREFCNT_dec(ipad); @@ -1065,9 +1065,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, if ((svp = av_fetch(seenentry, 0, FALSE)) && (othername = *svp) && (svp = av_fetch(seenentry, 2, FALSE)) && *svp && SvIV(*svp) > 0) { - sv_catpvn(retval, "${", 2); + sv_catpvs(retval, "${"); sv_catsv(retval, othername); - sv_catpvn(retval, "}", 1); + sv_catpvs(retval, "}"); return 1; } } @@ -1178,7 +1178,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, sv_setsv(nname, postentry); sv_catpvn(nname, entries[j], sizes[j]); - sv_catpvn(postentry, " = ", 3); + sv_catpvs(postentry, " = "); av_push(postav, postentry); e = newRV_inc(e); @@ -1200,7 +1200,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } } else if (val == &PL_sv_undef || !SvOK(val)) { - sv_catpvn(retval, "undef", 5); + sv_catpvs(retval, "undef"); } #ifdef SvVOK else if (SvMAGICAL(val) && (mg = mg_find(val, 'V'))) { @@ -1455,7 +1455,7 @@ Data_Dumper_Dumpxs(href, ...) if (postlen >= 0 || !terse) { sv_insert(valstr, 0, 0, " = ", 3); sv_insert(valstr, 0, 0, SvPVX_const(name), SvCUR(name)); - sv_catpvn(valstr, ";", 1); + sv_catpvs(valstr, ";"); } sv_catsv(retval, pad); sv_catsv(retval, valstr); @@ -1469,13 +1469,13 @@ Data_Dumper_Dumpxs(href, ...) if (svp && (elem = *svp)) { sv_catsv(retval, elem); if (i < postlen) { - sv_catpvn(retval, ";", 1); + sv_catpvs(retval, ";"); sv_catsv(retval, sep); sv_catsv(retval, pad); } } } - sv_catpvn(retval, ";", 1); + sv_catpvs(retval, ";"); sv_catsv(retval, sep); } sv_setpvn(valstr, "", 0); diff --git a/pp_ctl.c b/pp_ctl.c index 6a619ce..b559c5a 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3649,7 +3649,7 @@ S_doopen_pm(pTHX_ SV *name) Stat_t pmcstat; SvSetSV_nosteal(pmcsv,name); - sv_catpvn(pmcsv, "c", 1); + sv_catpvs(pmcsv, "c"); if (PerlLIO_stat(SvPV_nolen_const(pmcsv), &pmcstat) >= 0) return check_type_and_open(pmcsv); @@ -4078,7 +4078,7 @@ PP(pp_require) sv_catpv(msg, " (you may need to install the "); for (c = name; c < e; c++) { if (*c == '/') { - sv_catpvn(msg, "::", 2); + sv_catpvs(msg, "::"); } else { sv_catpvn(msg, c, 1); diff --git a/win32/win32.c b/win32/win32.c index b601452..26d419e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -360,7 +360,7 @@ get_emd_part(SV **prev_pathp, STRLEN *const len, char *trailing_path, ...) if (!*prev_pathp) *prev_pathp = sv_2mortal(newSVpvs("")); else if (SvPVX(*prev_pathp)) - sv_catpvn(*prev_pathp, ";", 1); + sv_catpvs(*prev_pathp, ";"); sv_catpv(*prev_pathp, mod_name); if(len) *len = SvCUR(*prev_pathp); @@ -418,7 +418,7 @@ win32_get_xlib(const char *pl, const char *xlib, const char *libname, sv1 = sv2; } else if (sv2) { dTHX; - sv_catpvn(sv1, ";", 1); + sv_catpv(sv1, ";"); sv_catsv(sv1, sv2); } diff --git a/win32/wince.c b/win32/wince.c index bbe8d31..271df2b 100644 --- a/win32/wince.c +++ b/win32/wince.c @@ -227,7 +227,7 @@ get_emd_part(SV **prev_pathp, STRLEN *const len, char *trailing_path, ...) dTHX; if (!*prev_pathp) *prev_pathp = sv_2mortal(newSVpvs("")); - sv_catpvn(*prev_pathp, ";", 1); + sv_catpvs(*prev_pathp, ";"); sv_catpv(*prev_pathp, mod_name); if(len) *len = SvCUR(*prev_pathp); @@ -286,7 +286,7 @@ win32_get_xlib(const char *pl, const char *xlib, const char *libname, if (!sv1) { sv1 = sv2; } else if (sv2) { - sv_catpvn(sv1, ";", 1); + sv_catpvs(sv1, ";"); sv_catsv(sv1, sv2); } -- 2.0.0
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 668b
On Mon Jun 09 11:26:41 2014, ilmari wrote: Show quoted text
> Oops, the previous patch had a spurious s/pvn/pvs/ for a non-constant > item, so failed to compile. Here's an updated version which builds and > passes all tests. >
Thanks, applied as c2b90b61b50912ff59d36bd0dc279930c2b76bf2 and 46e2868e06e3a90816b9788baa0ef60e02976ea2. The change to Data::Dumper did fix a bug, the following: ./perl -Ilib -MData::Dumper -le 'sub x {} print Data::Dumper->new([\&x, \\&x], ["*b", "c"])->Dump' would produce the incorrect result you predicted. The pure perl code produced the correct result. I added a test for the correct behaviour in 4662a05932175fe185d382b9b1b730e2b5cfad25. Tony
To: perl5-porters [...] perl.org
Subject: Re: [perl #122070] [PATCH] Change newSVpvn("…", …) tonewSVpvs("…")
Date: Thu, 12 Jun 2014 09:50:08 +0200
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Download (untitled) / with headers
text/plain 756b
"Tony Cook via RT" <perlbug-followup@perl.org> writes: Show quoted text
> The change to Data::Dumper did fix a bug, the following: > > ./perl -Ilib -MData::Dumper -le 'sub x {} print Data::Dumper->new([\&x, \\&x], ["*b", "c"])->Dump' > > would produce the incorrect result you predicted. The pure perl code > produced the correct result. > > I added a test for the correct behaviour in > 4662a05932175fe185d382b9b1b730e2b5cfad25.
Shouldn't that test be un-TODOed now that it's fixed? -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 720b
On Thu Jun 12 00:50:41 2014, ilmari wrote: Show quoted text
> "Tony Cook via RT" <perlbug-followup@perl.org> writes: >
> > The change to Data::Dumper did fix a bug, the following: > > > > ./perl -Ilib -MData::Dumper -le 'sub x {} print Data::Dumper-
> > >new([\&x, \\&x], ["*b", "c"])->Dump'
> > > > would produce the incorrect result you predicted. The pure perl code > > produced the correct result. > > > > I added a test for the correct behaviour in > > 4662a05932175fe185d382b9b1b730e2b5cfad25.
> > Shouldn't that test be un-TODOed now that it's fixed?
Removed the $TODO in b65827489f432c6b8ea39e1ae6abef4e8d8b0723. This didn't actually make the test TODO, since dumper.t uses its own test framework which ignores $TODO. Tony


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org