Gets rid of many hardcoded string lengths.
p4raw-id: //depot/perl@26641
break;
}
switch (*pv) {
- case '\t': sv_catpvn(dsv, "\\t", 2); break;
- case '\n': sv_catpvn(dsv, "\\n", 2); break;
- case '\r': sv_catpvn(dsv, "\\r", 2); break;
- case '\f': sv_catpvn(dsv, "\\f", 2); break;
- case '"': sv_catpvn(dsv, "\\\"", 2); break;
- case '\\': sv_catpvn(dsv, "\\\\", 2); break;
+ case '\t': sv_catpvs(dsv, "\\t"); break;
+ case '\n': sv_catpvs(dsv, "\\n"); break;
+ case '\r': sv_catpvs(dsv, "\\r"); break;
+ case '\f': sv_catpvs(dsv, "\\f"); break;
+ case '"': sv_catpvs(dsv, "\\\""); break;
+ case '\\': sv_catpvs(dsv, "\\\\"); break;
default:
if (isPRINT(*pv))
sv_catpvn(dsv, pv, 1);
Perl_sv_catpvf(aTHX_ dsv, "\\%o", (U8)*pv);
}
}
- sv_catpvn(dsv, "\"", 1);
+ sv_catpvs(dsv, "\"");
if (truncated)
- sv_catpvn(dsv, "...", 3);
+ sv_catpvs(dsv, "...");
if (nul_terminated)
- sv_catpvn(dsv, "\\0", 2);
+ sv_catpvs(dsv, "\\0");
return SvPVX(dsv);
}
if (!SvPVX_const(sv))
sv_catpv(t, "(null)");
else {
- SV *tmp = newSVpvn("", 0);
+ SV *tmp = newSVpvs("");
sv_catpv(t, "(");
if (SvOOK(sv))
Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
op_dump(pm->op_pmreplroot);
}
if (pm->op_pmflags || (PM_GETRE(pm) && PM_GETRE(pm)->check_substr)) {
- SV *tmpsv = newSVpvn("", 0);
+ SV *tmpsv = newSVpvs("");
if (pm->op_pmdynflags & PMdf_USED)
sv_catpv(tmpsv, ",USED");
if (pm->op_pmdynflags & PMdf_TAINTED)
Perl_dump_indent(aTHX_ level, file, "ADDR = 0x%"UVxf" => 0x%"UVxf"\n", (UV)o, (UV)o->op_next);
#endif
if (o->op_flags) {
- SV *tmpsv = newSVpvn("", 0);
+ SV *tmpsv = newSVpvs("");
switch (o->op_flags & OPf_WANT) {
case OPf_WANT_VOID:
sv_catpv(tmpsv, ",VOID");
SvREFCNT_dec(tmpsv);
}
if (o->op_private) {
- SV *tmpsv = newSVpvn("", 0);
+ SV *tmpsv = newSVpvs("");
if (PL_opargs[o->op_type] & OA_TARGLEX) {
if (o->op_private & OPpTARGET_MY)
sv_catpv(tmpsv, ",TARGET_MY");
Perl_dump_indent(aTHX_ level, file, " MG_PTR = 0x%"UVxf, PTR2UV(mg->mg_ptr));
if (mg->mg_len >= 0) {
if (mg->mg_type != PERL_MAGIC_utf8) {
- SV *sv = newSVpvn("", 0);
+ SV *sv = newSVpvs("");
PerlIO_printf(file, " %s", pv_display(sv, mg->mg_ptr, mg->mg_len, 0, pvlim));
SvREFCNT_dec(sv);
}
LEAVE;
varsv = GvSVn(vargv);
sv_setpvn(varsv, packname, packname_len);
- sv_catpvn(varsv, "::", 2);
+ sv_catpvs(varsv, "::");
sv_catpvn(varsv, name, len);
SvTAINTED_off(varsv);
return gv;
ENTER;
save_scalar(gv); /* keep the value of $! */
Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
- newSVpvn("Errno",5), Nullsv);
+ newSVpvs("Errno"), Nullsv);
LEAVE;
SPAGAIN;
stash = gv_stashpvn("Errno",5,FALSE);
if (keepmain || strNE(name, "main")) {
sv_catpvn(sv,name,namelen);
- sv_catpvn(sv,"::", 2);
+ sv_catpvs(sv,"::");
}
sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
}
o->op_private |= OPpTRANS_TO_UTF;
if (o->op_private & (OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF)) {
- SV* const listsv = newSVpvn("# comment\n",10);
+ SV* const listsv = newSVpvs("# comment\n");
SV* transv = NULL;
const U8* tend = t + tlen;
const U8* rend = r + rlen;
UV nextmin = 0;
Newx(cp, 2*tlen, UV);
i = 0;
- transv = newSVpvn("",0);
+ transv = newSVpvs("");
while (t < tend) {
cp[2*i] = utf8n_to_uvuni(t, tend-t, &ulen, 0);
t += ulen;
if (SvPOK(cv))
Perl_sv_catpvf(aTHX_ msg, " (%"SVf")", (const SV *)cv);
else
- Perl_sv_catpv(aTHX_ msg, ": none");
- sv_catpv(msg, " vs ");
+ sv_catpvs(msg, ": none");
+ sv_catpvs(msg, " vs ");
if (p)
Perl_sv_catpvf(aTHX_ msg, "(%s)", p);
else
- sv_catpv(msg, "none");
+ sv_catpvs(msg, "none");
Perl_warner(aTHX_ packWARN(WARN_PROTOTYPE), "%"SVf, msg);
}
}
GV *glob_gv;
ENTER;
Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
- newSVpvn("File::Glob", 10), Nullsv, Nullsv, Nullsv);
+ newSVpvs("File::Glob"), Nullsv, Nullsv, Nullsv);
gv = gv_fetchpv("CORE::GLOBAL::glob", 0, SVt_PVCV);
glob_gv = gv_fetchpv("File::Glob::csh_glob", 0, SVt_PVCV);
GvCV(gv) = GvCV(glob_gv);
o = ck_listiob(o);
o->op_type = OP_PRINT;
cLISTOPo->op_last = cLISTOPo->op_last->op_sibling
- = newSVOP(OP_CONST, 0, newSVpvn("\n", 1));
+ = newSVOP(OP_CONST, 0, newSVpvs("\n"));
return o;
}
SvCUR_set(sv, SvCUR(sv) - 1);
}
}
- sv_catpvn(sv, ".pm", 3);
+ sv_catpvs(sv, ".pm");
SvFLAGS(sv) |= was_readonly;
}
}
op_free(cLISTOPo->op_first);
cLISTOPo->op_first = kid;
if (!kid) {
- cLISTOPo->op_first = kid = newSVOP(OP_CONST, 0, newSVpvn(" ", 1));
+ cLISTOPo->op_first = kid = newSVOP(OP_CONST, 0, newSVpvs(" "));
cLISTOPo->op_last = kid; /* There was only one element previously */
}
{
GV * const gv = cGVOPx_gv(gvop);
OP * const sibling = o2->op_sibling;
- SV * const n = newSVpvn("",0);
+ SV * const n = newSVpvs("");
op_free(o2);
gv_fullname4(n, gv, "", FALSE);
o2 = newSVOP(OP_CONST, 0, n);
#endif
}
- PL_rs = newSVpvn("\n", 1);
+ PL_rs = newSVpvs("\n");
init_stacks();
PL_fdpid = newAV(); /* for remembering popen pids by fd */
PL_modglobal = newHV(); /* pointers to per-interpreter module globals */
- PL_errors = newSVpvn("",0);
+ 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. */
PL_fdscript = -1;
PL_suidscript = -1;
sv_setpvn(PL_linestr,"",0);
- sv = newSVpvn("",0); /* first used for -I flags */
+ sv = newSVpvs(""); /* first used for -I flags */
SAVEFREESV(sv);
init_main_stash();
#endif
forbid_setid("-e");
if (!PL_e_script) {
- PL_e_script = newSVpvn("",0);
+ PL_e_script = newSVpvs("");
filter_add(read_e_script, NULL);
}
if (*++s)
}
else
Perl_croak(aTHX_ "No code specified for -%c", *s);
- sv_catpv(PL_e_script, "\n");
+ sv_catpvs(PL_e_script, "\n");
break;
case 'f':
STRLEN len = strlen(s);
const char * const p = savepvn(s, len);
incpush(p, TRUE, TRUE, FALSE, FALSE);
- sv_catpvn(sv, "-I", 2);
+ sv_catpvs(sv, "-I");
sv_catpvn(sv, p, len);
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
Safefree(p);
}
else
if (!PL_preambleav)
PL_preambleav = newAV();
av_push(PL_preambleav,
- newSVpv("use Config;",0));
+ newSVpvs("use Config;"));
if (*++s != ':') {
STRLEN opts;
- opts_prog = newSVpv("print Config::myconfig(),",0);
+ opts_prog = newSVpvs("print Config::myconfig(),");
#ifdef VMS
- sv_catpv(opts_prog,"\"\\nCharacteristics of this PERLSHR image: \\n\",");
+ sv_catpvs(opts_prog,"\"\\nCharacteristics of this PERLSHR image: \\n\",");
#else
- sv_catpv(opts_prog,"\"\\nCharacteristics of this binary (from libperl): \\n\",");
+ sv_catpvs(opts_prog,"\"\\nCharacteristics of this binary (from libperl): \\n\",");
#endif
opts = SvCUR(opts_prog);
"\\n ", 25);
}
- sv_catpv(opts_prog,"\\n\",");
+ sv_catpvs(opts_prog,"\\n\",");
#if defined(LOCAL_PATCH_COUNT)
if (LOCAL_PATCH_COUNT > 0) {
int i;
- sv_catpv(opts_prog,
+ sv_catpvs(opts_prog,
"\" Locally applied patches:\\n\",");
for (i = 1; i <= LOCAL_PATCH_COUNT; i++) {
if (PL_localpatches[i])
__DATE__);
# endif
#endif
- sv_catpv(opts_prog, "; $\"=\"\\n \"; "
+ sv_catpvs(opts_prog, "; $\"=\"\\n \"; "
"@env = map { \"$_=\\\"$ENV{$_}\\\"\" } "
"sort grep {/^PERL/} keys %ENV; ");
#ifdef __CYGWIN__
- sv_catpv(opts_prog,
+ sv_catpvs(opts_prog,
"push @env, \"CYGWIN=\\\"$ENV{CYGWIN}\\\"\";");
#endif
- sv_catpv(opts_prog,
+ sv_catpvs(opts_prog,
"print \" \\%ENV:\\n @env\\n\" if @env;"
"print \" \\@INC:\\n @INC\\n\";");
}
numlen = 0;
s--;
}
- PL_rs = newSVpvn("", 0);
+ PL_rs = newSVpvs("");
SvGROW(PL_rs, (STRLEN)(UNISKIP(rschar) + 1));
tmps = (U8*)SvPVX(PL_rs);
uvchr_to_utf8(tmps, rschar);
if (rschar & ~((U8)~0))
PL_rs = &PL_sv_undef;
else if (!rschar && numlen >= 2)
- PL_rs = newSVpvn("", 0);
+ PL_rs = newSVpvs("");
else {
char ch = (char)rschar;
PL_rs = newSVpvn(&ch, 1);
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
const char *start;
- SV * const sv = newSVpv("use Devel::", 0);
+ SV * const sv = newSVpvs("use Devel::");
start = ++s;
/* We now allow -d:Module=Foo,Bar */
while(isALNUM(*s) || *s==':') ++s;
if (isDIGIT(*s)) {
I32 flags = 0;
STRLEN numlen;
- PL_ors_sv = newSVpvn("\n",1);
+ PL_ors_sv = newSVpvs("\n");
numlen = 3 + (*s == '0');
*SvPVX(PL_ors_sv) = (char)grok_oct(s, &numlen, &flags, NULL);
s += numlen;
}
else {
if (RsPARA(PL_rs)) {
- PL_ors_sv = newSVpvn("\n\n",2);
+ PL_ors_sv = newSVpvs("\n\n");
}
else {
PL_ors_sv = newSVsv(PL_rs);
s++;
{
char * const start = s;
- SV * const sv = newSVpv("use assertions::activate", 24);
+ SV * const sv = newSVpvs("use assertions::activate");
while(isALNUM(*s) || *s == ':') ++s;
if (s != start) {
- sv_catpvn(sv, "::", 2);
+ sv_catpvs(sv, "::");
sv_catpvn(sv, start, s-start);
}
if (*s == '=') {
if (*(start-1) == 'm') {
if (*s != '\0')
Perl_croak(aTHX_ "Can't use '%c' after -mname", *s);
- sv_catpv( sv, " ()");
+ sv_catpvs( sv, " ()");
}
} else {
if (s == start)
Perl_croak(aTHX_ "Module name required with -%c option",
s[-1]);
sv_catpvn(sv, start, s-start);
- sv_catpv(sv, " split(/,/,q");
- sv_catpvn(sv, "\0)", 1); /* Use NUL as q//-delimiter. */
+ sv_catpvs(sv, " split(/,/,q");
+ sv_catpvs(sv, "\0"); /* Use NUL as q//-delimiter. */
sv_catpv(sv, ++s);
- sv_catpvn(sv, "\0)", 2);
+ sv_catpvs(sv, "\0)");
}
s += strlen(s);
if (!PL_preambleav)
extern int etext;
prog = newSVpv(BIN_EXP, 0);
- sv_catpv(prog, "/perl");
+ sv_catpvs(prog, "/perl");
file = newSVpv(PL_origfilename, 0);
- sv_catpv(file, ".perldump");
+ sv_catpvs(file, ".perldump");
unexec(SvPVX(file), SvPVX(prog), &etext, sbrk(0), 0);
/* unexec prints msg to stderr in case of failure */
#else /* IAMSUID */
else if (PL_preprocess) {
const char * const cpp_cfg = CPPSTDIN;
- SV * const cpp = newSVpvn("",0);
+ SV * const cpp = newSVpvs("");
SV * const cmd = NEWSV(0,0);
if (cpp_cfg[0] == 0) /* PERL_MICRO? */
sv_catpv(cpp, cpp_cfg);
# ifndef VMS
- sv_catpvn(sv, "-I", 2);
+ sv_catpvs(sv, "-I");
sv_catpv(sv,PRIVLIB_EXP);
# endif
PL_rsfp = Nullfp;
lex_start(PL_linestr);
PL_rsfp = tmpfp;
- PL_subname = newSVpvn("main",4);
+ PL_subname = newSVpvs("main");
}
STATIC void
if (usesep) {
while ( *p == PERLLIB_SEP ) {
/* Uncomment the next line for PATH semantics */
- /* av_push(GvAVn(PL_incgv), newSVpvn(".", 1)); */
+ /* av_push(GvAVn(PL_incgv), newSVpvs(".")); */
p++;
}
}
sv_setpv(libdir, MacPerl_CanonDir(SvPVX(libdir), buf, 0));
}
if (SvPVX(libdir)[SvCUR(libdir)-1] != ':')
- sv_catpv(libdir, ":");
+ sv_catpvs(libdir, ":");
#endif
/* Do the if() outside the #ifdef to avoid warnings about an unused
sv_upgrade(PL_bodytarget, SVt_PVFM);
sv_setpvn(PL_bodytarget, "", 0);
PL_formtarget = PL_bodytarget;
- thr->errsv = newSVpvn("", 0);
+ thr->errsv = newSVpvs("");
(void) find_threadsv("@"); /* Ensure $@ is initialised early */
PL_maxscream = -1;
PL_curcop = &PL_compiling;
CopLINE_set(PL_curcop, oldline);
if (paramList == PL_beginav)
- sv_catpv(atsv, "BEGIN failed--compilation aborted");
+ sv_catpvs(atsv, "BEGIN failed--compilation aborted");
else
Perl_sv_catpvf(aTHX_ atsv,
"%s failed--call queue aborted",
#else
const char *s = CopFILE(PL_curcop);
STRLEN len;
- SV * const sv = newSVpvn("", 0);
+ SV * const sv = newSVpvs("");
Perl_sv_catpvf(aTHX_ sv, "%s:%" IVdf " ", s ? s : "(none)",
(IV) CopLINE(PL_curcop));
Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap);
Perl_croak(aTHX_ "Recursive call to Perl_load_module in PerlIO_find_layer");
return NULL;
} else {
- SV * const pkgsv = newSVpvn("PerlIO", 6);
+ SV * const pkgsv = newSVpvs("PerlIO");
SV * const layer = newSVpvn(name, len);
CV * const cv = get_cv("PerlIO::Layer::NoWarnings", FALSE);
ENTER;
PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap)
{
dTHX;
- SV * const sv = newSVpvn("", 0);
+ SV * const sv = newSVpvs("");
const char *s;
STRLEN len;
SSize_t wrote;
f = PerlIO_fdopen(fd, "w+b");
#else /* WIN32 */
# if defined(HAS_MKSTEMP) && ! defined(VMS) && ! defined(OS2)
- SV * const sv = newSVpv("/tmp/PerlIO_XXXXXX", 0);
+ SV * const sv = newSVpvs("/tmp/PerlIO_XXXXXX");
/*
* I have no idea how portable mkstemp() is ... NI-S
*/
if (strEQ(second_letter, "ACKAGE")) {
const HV * const stash = GvSTASH(gv);
const HEK * const hek = stash ? HvNAME_HEK(stash) : NULL;
- sv = hek ? newSVhek(hek) : newSVpvn("__ANON__", 8);
+ sv = hek ? newSVhek(hek) : newSVpvs("__ANON__");
}
break;
case 'S':
if (flop) {
sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0);
- sv_catpvn(targ, "E0", 2);
+ sv_catpvs(targ, "E0");
}
SETs(targ);
}
PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs)));
}
else {
- PUSHs(sv_2mortal(newSVpvn("(unknown)",9)));
+ PUSHs(sv_2mortal(newSVpvs("(unknown)")));
PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs)));
}
}
else {
- PUSHs(sv_2mortal(newSVpvn("(eval)",6)));
+ PUSHs(sv_2mortal(newSVpvs("(eval)")));
PUSHs(sv_2mortal(newSViv(0)));
}
gimme = (I32)cx->blk_gimme;
));
for (i = 0; i <= AvFILL(ar); i++) {
- sv_catpvn(msg, " ", 1);
+ sv_catpvs(msg, " ");
sv_catsv(msg, *av_fetch(ar, i, TRUE));
}
- sv_catpvn(msg, ")", 1);
+ sv_catpvs(msg, ")");
msgstr = SvPV_nolen_const(msg);
}
}
ENTER;
SAVETMPS;
- lex_start(sv_2mortal(newSVpvn("",0)));
+ lex_start(sv_2mortal(newSVpvs("")));
SAVEGENERICSV(PL_rsfp_filters);
PL_rsfp_filters = NULL;
char *t;
if (!strnEQ(s, "0000", 4)) { /* need to grow sv */
- SV * const tmpNew = newSVpvn("0000000000", 10);
+ SV * const tmpNew = newSVpvs("0000000000");
sv_catsv(tmpNew, sv);
SvREFCNT_dec(sv); /* free old sv */
PL_last_in_gv = (GV*)*PL_stack_sp--;
SAVESPTR(PL_rs); /* This is not permanent, either. */
- PL_rs = sv_2mortal(newSVpvn("\000", 1));
+ PL_rs = sv_2mortal(newSVpvs("\000"));
#ifndef DOSISH
#ifndef CSH
*SvPVX(PL_rs) = '\n';
SV * const error = ERRSV;
SvUPGRADE(error, SVt_PV);
if (SvPOK(error) && SvCUR(error))
- sv_catpv(error, "\t...caught");
+ sv_catpvs(error, "\t...caught");
tmpsv = error;
tmps = SvPV_const(tmpsv, len);
}
if (!tmps || !len)
- tmpsv = sv_2mortal(newSVpvn("Warning: something's wrong", 26));
+ tmpsv = sv_2mortal(newSVpvs("Warning: something's wrong"));
Perl_warn(aTHX_ "%"SVf, tmpsv);
RETSETYES;
}
else {
if (SvPOK(error) && SvCUR(error))
- sv_catpv(error, "\t...propagated");
+ sv_catpvs(error, "\t...propagated");
tmpsv = error;
if (SvOK(tmpsv))
tmps = SvPV_const(tmpsv, len);
}
}
if (!tmps || !len)
- tmpsv = sv_2mortal(newSVpvn("Died", 4));
+ tmpsv = sv_2mortal(newSVpvs("Died"));
DIE(aTHX_ "%"SVf, tmpsv);
}
#ifdef USE_STAT_RDEV
PUSHs(sv_2mortal(newSViv(PL_statcache.st_rdev)));
#else
- PUSHs(sv_2mortal(newSVpvn("", 0)));
+ PUSHs(sv_2mortal(newSVpvs("")));
#endif
#if Off_t_size > IVSIZE
PUSHs(sv_2mortal(newSVnv((NV)PL_statcache.st_size)));
PUSHs(sv_2mortal(newSVuv(PL_statcache.st_blksize)));
PUSHs(sv_2mortal(newSVuv(PL_statcache.st_blocks)));
#else
- PUSHs(sv_2mortal(newSVpvn("", 0)));
- PUSHs(sv_2mortal(newSVpvn("", 0)));
+ PUSHs(sv_2mortal(newSVpvs("")));
+ PUSHs(sv_2mortal(newSVpvs("")));
#endif
}
RETURN;
for (elem = hent->h_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
}
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)hent->h_addrtype);
for (elem = nent->n_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
}
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)nent->n_addrtype);
for (elem = pent->p_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
}
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)pent->p_proto);
for (elem = sent->s_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
}
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef HAS_NTOHS
for (elem = grent->gr_mem; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
- sv_catpvn(sv, " ", 1);
+ sv_catpvs(sv, " ");
}
#endif
}
*/
minlen = 0;
- data.longest_fixed = newSVpvn("",0);
- data.longest_float = newSVpvn("",0);
- data.last_found = newSVpvn("",0);
+ data.longest_fixed = newSVpvs("");
+ data.longest_float = newSVpvs("");
+ data.last_found = newSVpvs("");
data.longest = &(data.longest_fixed);
first = scan;
if (!r->regstclass) {
if (RExC_parse - 1 - s)
sv = newSVpvn(s, RExC_parse - 1 - s);
else
- sv = newSVpvn("", 0);
+ sv = newSVpvs("");
ENTER;
Perl_save_re_context(aTHX);
if (LOC)
ANYOF_FLAGS(ret) |= ANYOF_LOCALE;
ANYOF_BITMAP_ZERO(ret);
- listsv = newSVpvn("# comment\n", 10);
+ listsv = newSVpvs("# comment\n");
}
nextvalue = RExC_parse < RExC_end ? UCHARAT(RExC_parse) : 0;
k = PL_regkind[(U8)OP(o)];
if (k == EXACT) {
- SV * const dsv = sv_2mortal(newSVpvn("", 0));
+ SV * const dsv = sv_2mortal(newSVpvs(""));
/* Using is_utf8_string() is a crude hack but it may
* be the best for now since we have no flag "this EXACTish
* node was UTF-8" --jhi */
};
if (flags & ANYOF_LOCALE)
- sv_catpv(sv, "{loc}");
+ sv_catpvs(sv, "{loc}");
if (flags & ANYOF_FOLD)
- sv_catpv(sv, "{i}");
+ sv_catpvs(sv, "{i}");
Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]);
if (flags & ANYOF_INVERT)
- sv_catpv(sv, "^");
+ sv_catpvs(sv, "^");
for (i = 0; i <= 256; i++) {
if (i < 256 && ANYOF_BITMAP_TEST(o,i)) {
if (rangestart == -1)
put_byte(sv, rangestart);
else {
put_byte(sv, rangestart);
- sv_catpv(sv, "-");
+ sv_catpvs(sv, "-");
put_byte(sv, i - 1);
}
rangestart = -1;
sv_catpv(sv, anyofs[i]);
if (flags & ANYOF_UNICODE)
- sv_catpv(sv, "{unicode}");
+ sv_catpvs(sv, "{unicode}");
else if (flags & ANYOF_UNICODE_ALL)
- sv_catpv(sv, "{unicode_all}");
+ sv_catpvs(sv, "{unicode_all}");
{
SV *lv;
U8 *p;
for (p = s; p < e; p++)
put_byte(sv, *p);
- sv_catpvn(sv, "-", 1);
+ sv_catpvs(sv, "-");
e = uvchr_to_utf8(s, i-1);
for (p = s; p < e; p++)
put_byte(sv, *p);
}
}
- sv_catpv(sv, "..."); /* et cetera */
+ sv_catpvs(sv, "..."); /* et cetera */
}
{
const char *pv;
if (DO_UTF8(sv)) {
- dsv = sv_2mortal(newSVpvn("", 0));
+ dsv = sv_2mortal(newSVpvs(""));
pv = sv_uni_display(dsv, sv, 10, 0);
} else {
char *d = tmpbuf;
const SV *const referent = (SV*)SvRV(sv);
if (!referent) {
- tsv = sv_2mortal(newSVpvn("NULLREF", 7));
+ tsv = sv_2mortal(newSVpvs("NULLREF"));
} else if (SvTYPE(referent) == SVt_PVMG
&& ((SvFLAGS(referent) &
(SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG))
"\"%%\\%03"UVof"\"",
(UV)c & 0xFF);
} else
- sv_catpv(msg, "end of string");
+ sv_catpvs(msg, "end of string");
Perl_warner(aTHX_ packWARN(WARN_PRINTF), "%"SVf, msg); /* yes, this is reentrant */
}
case OP_SCHOMP:
case OP_CHOMP:
if (SvROK(PL_rs) && uninit_sv == SvRV(PL_rs))
- return sv_2mortal(newSVpvn("${$/}", 5));
+ return sv_2mortal(newSVpvs("${$/}"));
/* FALL THROUGH */
default:
#define sv_2iv(sv) sv_2iv_flags(sv, SV_GMAGIC)
#define sv_2uv(sv) sv_2uv_flags(sv, SV_GMAGIC)
+#define newSVpvs(str) newSVpvn(STR_WITH_LEN(str))
+#define sv_catpvs(sv, str) sv_catpvn_flags(sv, STR_WITH_LEN(str), SV_GMAGIC)
+
/* Should be named SvCatPVN_utf8_upgrade? */
#define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv) \
STMT_START { \
const char *name = Nullch;
enum token_type type = TOKENTYPE_NONE;
const struct debug_tokens *p;
- SV* const report = newSVpvn("<== ", 4);
+ SV* const report = newSVpvs("<== ");
for (p = debug_tokens; p->token; p++) {
if (p->token == (int)rv) {
else if ((char)rv > ' ' && (char)rv < '~')
Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv);
else if (!rv)
- Perl_sv_catpv(aTHX_ report, "EOF");
+ sv_catpvs(report, "EOF");
else
Perl_sv_catpvf(aTHX_ report, "?? %"IVdf, (IV)rv);
switch (type) {
}
else
- Perl_sv_catpv(aTHX_ report, "(opval=null)");
+ sv_catpvs(report, "(opval=null)");
break;
}
PerlIO_printf(Perl_debug_log, "### %s\n\n", SvPV_nolen_const(report));
STATIC void
S_printbuf(pTHX_ const char* fmt, const char* s)
{
- SV* const tmp = newSVpvn("", 0);
+ SV* const tmp = newSVpvs("");
PerlIO_printf(Perl_debug_log, fmt, pv_display(tmp, s, strlen(s), 0, 60));
SvREFCNT_dec(tmp);
}
if (!len || s[len-1] != ';') {
if (!(SvFLAGS(PL_linestr) & SVs_TEMP))
PL_linestr = sv_2mortal(newSVsv(PL_linestr));
- sv_catpvn(PL_linestr, "\n;", 2);
+ sv_catpvs(PL_linestr, "\n;");
}
SvTEMP_off(PL_linestr);
PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);
{
dVAR;
if (!PL_lex_starts++) {
- SV * const sv = newSVpvn("",0);
+ SV * const sv = newSVpvs("");
if (SvUTF8(PL_linestr))
SvUTF8_on(sv);
PL_expect = XOPERATOR;
bool bof = FALSE;
DEBUG_T( {
- SV* tmp = newSVpvn("", 0);
+ SV* tmp = newSVpvs("");
PerlIO_printf(Perl_debug_log, "### %"IVdf":LEX_%s/X%s %s\n",
(IV)CopLINE(PL_curcop),
lex_state_names[PL_lex_state],
PL_preambled = TRUE;
sv_setpv(PL_linestr,incl_perldb());
if (SvCUR(PL_linestr))
- sv_catpvn(PL_linestr,";", 1);
+ sv_catpvs(PL_linestr,";");
if (PL_preambleav){
while(AvFILLp(PL_preambleav) >= 0) {
SV *tmpsv = av_shift(PL_preambleav);
sv_catsv(PL_linestr, tmpsv);
- sv_catpvn(PL_linestr, ";", 1);
+ sv_catpvs(PL_linestr, ";");
sv_free(tmpsv);
}
sv_free((SV*)PL_preambleav);
PL_preambleav = NULL;
}
if (PL_minus_n || PL_minus_p) {
- sv_catpv(PL_linestr, "LINE: while (<>) {");
+ sv_catpvs(PL_linestr, "LINE: while (<>) {");
if (PL_minus_l)
- sv_catpv(PL_linestr,"chomp;");
+ sv_catpvs(PL_linestr,"chomp;");
if (PL_minus_a) {
if (PL_minus_F) {
if ((*PL_splitstr == '/' || *PL_splitstr == '\''
/* This loop will embed the trailing NUL of
PL_linestr as the last thing it does before
terminating. */
- sv_catpvn(PL_linestr, ");", 2);
+ sv_catpvs(PL_linestr, ");");
}
}
else
- sv_catpv(PL_linestr,"our @F=split(' ');");
+ sv_catpvs(PL_linestr,"our @F=split(' ');");
}
}
if (PL_minus_E)
- sv_catpv(PL_linestr,"use feature ':5.10';");
- sv_catpvn(PL_linestr, "\n", 1);
+ sv_catpvs(PL_linestr,"use feature ':5.10';");
+ sv_catpvs(PL_linestr, "\n");
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;
/* if we saw a global override before, get the right name */
if (gvp) {
- sv = newSVpvn("CORE::GLOBAL::",14);
+ sv = newSVpvs("CORE::GLOBAL::");
sv_catpv(sv,PL_tokenbuf);
}
else {
sv_setpv(PL_subname, tmpbuf);
else {
sv_setsv(PL_subname,PL_curstname);
- sv_catpvn(PL_subname,"::",2);
+ sv_catpvs(PL_subname,"::");
sv_catpvn(PL_subname,tmpbuf,len);
}
s = skipspace(d);
HV * const stash = PAD_COMPNAME_OURSTASH(tmp);
HEK * const stashname = HvNAME_HEK(stash);
SV * const sym = newSVhek(stashname);
- sv_catpvn(sym, "::", 2);
+ sv_catpvs(sym, "::");
sv_catpv(sym, PL_tokenbuf+1);
yylval.opval = (OP*)newSVOP(OP_CONST, 0, sym);
yylval.opval->op_private = OPpCONST_ENTERED;
/* Check the eval first */
if (!PL_in_eval && SvTRUE(ERRSV)) {
- sv_catpv(ERRSV, "Propagated");
+ sv_catpvs(ERRSV, "Propagated");
yyerror(SvPV_nolen_const(ERRSV)); /* Duplicates the message inside eval */
(void)POPs;
res = SvREFCNT_inc(sv);
PL_sublex_info.super_bufend = PL_bufend;
PL_multi_end = 0;
pm->op_pmflags |= PMf_EVAL;
- repl = newSVpvn("",0);
+ repl = newSVpvs("");
while (es-- > 0)
sv_catpv(repl, es ? "eval " : "do ");
- sv_catpvn(repl, "{ ", 2);
+ sv_catpvs(repl, "{ ");
sv_catsv(repl, PL_lex_repl);
- sv_catpvn(repl, " }", 2);
+ sv_catpvs(repl, " }");
SvEVALED_on(repl);
SvREFCNT_dec(PL_lex_repl);
PL_lex_repl = repl;
HV *stash = PAD_COMPNAME_OURSTASH(tmp);
HEK *stashname = HvNAME_HEK(stash);
SV *sym = sv_2mortal(newSVhek(stashname));
- sv_catpvn(sym, "::", 2);
+ sv_catpvs(sym, "::");
sv_catpv(sym, d+1);
d = SvPVX(sym);
goto intro_sym;
{
register char *eol;
register char *t;
- SV *stuff = newSVpvn("",0);
+ SV *stuff = newSVpvs("");
bool needargs = FALSE;
bool eofmt = FALSE;
where = "within string";
}
else {
- SV *where_sv = sv_2mortal(newSVpvn("next char ", 10));
+ SV *where_sv = sv_2mortal(newSVpvs("next char "));
if (yychar < 32)
Perl_sv_catpvf(aTHX_ where_sv, "^%c", toCTRL(yychar));
else if (isPRINT_LC(yychar))
SP -= items;
if (sv_derived_from(ST(0), "version")) {
SV * const lobj = SvRV(ST(0));
- SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvn("0",1))) );
+ SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvs("0"))) );
PUSHs(sv_2mortal(rs));
PUTBACK;
return;
const IV flags = SvIVX(*flgsvp);
if (flags & PERLIO_F_UTF8) {
- XPUSHs(newSVpvn("utf8", 4));
+ XPUSHs(newSVpvs("utf8"));
nitem++;
}
}
}
if (dowarn) {
- SV* const sv = sv_2mortal(newSVpv("Malformed UTF-8 character ", 0));
+ SV* const sv = sv_2mortal(newSVpvs("Malformed UTF-8 character "));
switch (warning) {
case 0: /* Intentionally empty. */ break;
case UTF8_WARN_EMPTY:
- Perl_sv_catpv(aTHX_ sv, "(empty string)");
+ sv_catpvs(sv, "(empty string)");
break;
case UTF8_WARN_CONTINUATION:
Perl_sv_catpvf(aTHX_ sv, "(unexpected continuation byte 0x%02"UVxf", with no preceding start byte)", uv);
Perl_sv_catpvf(aTHX_ sv, "(character 0x%04"UVxf")", uv);
break;
default:
- Perl_sv_catpv(aTHX_ sv, "(unknown reason)");
+ sv_catpvs(sv, "(unknown reason)");
break;
}
}
/* create and initialize $swatch */
- swatch = newSVpvn("",0);
+ swatch = newSVpvs("");
scur = octets ? (span * octets) : (span + 7) / 8;
SvGROW(swatch, scur + 1);
s = (U8*)SvPVX(swatch);
Perl_sv_catpvf(aTHX_ dsv, "\\x{%"UVxf"}", u);
}
if (truncated)
- sv_catpvn(dsv, "...", 3);
+ sv_catpvs(dsv, "...");
return SvPVX(dsv);
}
if (flags & FBMcf_TAIL) {
MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
- sv_catpvn(sv, "\n", 1); /* Taken into account in fbm_instr() */
+ sv_catpvs(sv, "\n"); /* Taken into account in fbm_instr() */
if (mg && mg->mg_len >= 0)
mg->mg_len++;
}
XPVMG *any;
if (!PL_dirty)
- return sv_2mortal(newSVpvn("",0));
+ return sv_2mortal(newSVpvs(""));
if (PL_mess_sv)
return PL_mess_sv;
/* attempt to retrieve the version array */
if ( !(av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)) ) ) {
- sv_catpvn(sv,"0",1);
+ sv_catpvs(sv,"0");
return sv;
}
len = av_len(av);
if ( len == -1 )
{
- sv_catpvn(sv,"0",1);
+ sv_catpvs(sv,"0");
return sv;
}
{
digit = SvIV(*av_fetch(av, len, 0));
if ( alpha && width == 3 ) /* alpha version */
- sv_catpvn(sv,"_",1);
+ sv_catpvs(sv,"_");
Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit);
}
else /* len == 0 */
{
- sv_catpvn(sv,"000",3);
+ sv_catpvs(sv, "000");
}
return sv;
}
len = av_len(av);
if ( len == -1 )
{
- sv_catpvn(sv,"",0);
+ sv_catpvs(sv,"");
return sv;
}
digit = SvIV(*av_fetch(av, 0, 0));
if ( len <= 2 ) { /* short version, must be at least three */
for ( len = 2 - len; len != 0; len-- )
- sv_catpvn(sv,".0",2);
+ sv_catpvs(sv,".0");
}
return sv;
}
case SVt_PVCV:
cvflags = CvFLAGS((CV*)sv);
if (cvflags & CVf_LOCKED)
- XPUSHs(sv_2mortal(newSVpvn("locked", 6)));
+ XPUSHs(sv_2mortal(newSVpvs("locked")));
#ifdef CVf_LVALUE
if (cvflags & CVf_LVALUE)
- XPUSHs(sv_2mortal(newSVpvn("lvalue", 6)));
+ XPUSHs(sv_2mortal(newSVpvs("lvalue")));
#endif
if (cvflags & CVf_METHOD)
- XPUSHs(sv_2mortal(newSVpvn("method", 6)));
+ XPUSHs(sv_2mortal(newSVpvs("method")));
if (GvUNIQUE(CvGV((CV*)sv)))
- XPUSHs(sv_2mortal(newSVpvn("unique", 6)));
+ XPUSHs(sv_2mortal(newSVpvs("unique")));
if (cvflags & CVf_ASSERTION)
- XPUSHs(sv_2mortal(newSVpvn("assertion", 9)));
+ XPUSHs(sv_2mortal(newSVpvs("assertion")));
break;
case SVt_PVGV:
if (GvUNIQUE(sv))
- XPUSHs(sv_2mortal(newSVpvn("unique", 6)));
+ XPUSHs(sv_2mortal(newSVpvs("unique")));
break;
default:
break;