const char *s = SvPV(sv, len);
PERL_HASH(hash, s, len);
len = my_sprintf(hexhash, "0x%"UVxf, (UV)hash);
- ST(0) = sv_2mortal(newSVpvn(hexhash, len));
+ ST(0) = newSVpvn_flags(hexhash, len, SVs_TEMP);
#define cast_I32(foo) (I32)foo
IV
EXTEND(sp, len);
for (i = 0; i < len; i++)
- PUSHs(sv_2mortal(newSVpvn(&PL_threadsv_names[i], 1)));
+ PUSHs(newSVpvn_flags(&PL_threadsv_names[i], 1, SVs_TEMP));
# endif
#endif
{
const short* const tbl = (short*)o->op_pv;
const short entries = 257 + tbl[256];
- ST(0) = sv_2mortal(newSVpvn(o->op_pv, entries * sizeof(short)));
+ ST(0) = newSVpvn_flags(o->op_pv, entries * sizeof(short), SVs_TEMP);
}
else if (o->op_type == OP_TRANS) {
- ST(0) = sv_2mortal(newSVpvn(o->op_pv, 256 * sizeof(short)));
+ ST(0) = newSVpvn_flags(o->op_pv, 256 * sizeof(short), SVs_TEMP);
}
else
- ST(0) = sv_2mortal(newSVpv(o->op_pv, 0));
+ ST(0) = newSVpvn_flags(o->op_pv, strlen(o->op_pv), SVs_TEMP);
#define LOOP_redoop(o) o->op_redoop
#define LOOP_nextop(o) o->op_nextop
wp[0] = htonl(((U32)iv) >> (sizeof(UV)*4));
#endif
wp[1] = htonl(iv & 0xffffffff);
- ST(0) = sv_2mortal(newSVpvn((char *)wp, 8));
+ ST(0) = newSVpvn_flags((char *)wp, 8, SVs_TEMP);
} else {
U32 w = htonl((U32)SvIVX(sv));
- ST(0) = sv_2mortal(newSVpvn((char *)&w, 4));
+ ST(0) = newSVpvn_flags((char *)&w, 4, SVs_TEMP);
}
CODE:
str = SvPV(sv, len);
/* Boyer-Moore table is just after string and its safety-margin \0 */
- ST(0) = sv_2mortal(newSVpvn(str + len + PERL_FBM_TABLE_OFFSET, 256));
+ ST(0) = newSVpvn_flags(str + len + PERL_FBM_TABLE_OFFSET, 256, SVs_TEMP);
MODULE = B PACKAGE = B::GV PREFIX = Gv
#if PERL_VERSION >= 10
ST(0) = sv_2mortal(newSVhek(GvNAME_HEK(gv)));
#else
- ST(0) = sv_2mortal(newSVpvn(GvNAME(gv), GvNAMELEN(gv)));
+ ST(0) = newSVpvn_flags(GvNAME(gv), GvNAMELEN(gv), SVs_TEMP);
#endif
bool
) ],
);
-$VERSION = '1.06';
+$VERSION = '1.07';
sub import {
require Exporter;
EXTEND(sp, pglob.gl_pathc);
for (i = 0; i < pglob.gl_pathc; i++) {
/* printf("# bsd_glob: %s\n", pglob.gl_pathv[i]); */
- tmp = sv_2mortal(newSVpvn(pglob.gl_pathv[i],
- strlen(pglob.gl_pathv[i])));
+ tmp = newSVpvn_flags(pglob.gl_pathv[i], strlen(pglob.gl_pathv[i]),
+ SVs_TEMP);
TAINT;
SvTAINT(tmp);
PUSHs(tmp);
const U16 bits = bitmap[i];
for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++) {
if ( bits & (1 << j) )
- XPUSHs(sv_2mortal(newSVpv(names[myopcode], 0)));
+ XPUSHs(newSVpvn_flags(names[myopcode], strlen(names[myopcode]),
+ SVs_TEMP));
}
}
}
/* copy args to a scratch area since we may push output values onto */
/* the stack faster than we read values off it if masks are used. */
- args = (SV**)SvPVX(sv_2mortal(newSVpvn((char*)&ST(0), items*sizeof(SV*))));
+ args = (SV**)SvPVX(newSVpvn_flags((char*)&ST(0), items*sizeof(SV*), SVs_TEMP));
for (i = 0; i < items; i++) {
const char * const opname = SvPV(args[i], len);
SV *bitspec = get_op_bitspec(aTHX_ opname, len, 1);
const int myopcode = SvIV(bitspec);
if (myopcode < 0 || myopcode >= PL_maxo)
croak("panic: opcode %d (%s) out of range",myopcode,opname);
- XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
+ XPUSHs(newSVpvn_flags(op_desc[myopcode], strlen(op_desc[myopcode]),
+ SVs_TEMP));
}
else if (SvPOK(bitspec) && SvCUR(bitspec) == (STRLEN)opset_len) {
int b, j;
const U16 bits = bitmap[b];
for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++)
if (bits & (1 << j))
- XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
+ XPUSHs(newSVpvn_flags(op_desc[myopcode],
+ strlen(op_desc[myopcode]),
+ SVs_TEMP));
}
}
else
errno = 0;
if ((incr = nice(incr)) != -1 || errno == 0) {
if (incr == 0)
- XPUSHs(sv_2mortal(newSVpvn("0 but true", 10)));
+ XPUSHs(newSVpvs_flags("0 but true", SVs_TEMP));
else
XPUSHs(sv_2mortal(newSViv(incr)));
}
struct utsname buf;
if (uname(&buf) >= 0) {
EXTEND(SP, 5);
- PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
- PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
- PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
- PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
- PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
+ PUSHs(newSVpvn_flags(buf.sysname, strlen(buf.sysname), SVs_TEMP));
+ PUSHs(newSVpvn_flags(buf.nodename, strlen(buf.nodename), SVs_TEMP));
+ PUSHs(newSVpvn_flags(buf.release, strlen(buf.release), SVs_TEMP));
+ PUSHs(newSVpvn_flags(buf.version, strlen(buf.version), SVs_TEMP));
+ PUSHs(newSVpvn_flags(buf.machine, strlen(buf.machine), SVs_TEMP));
}
#else
uname((char *) 0); /* A stub to call not_here(). */
tzname()
PPCODE:
EXTEND(SP,2);
- PUSHs(sv_2mortal(newSVpvn(tzname[0],strlen(tzname[0]))));
- PUSHs(sv_2mortal(newSVpvn(tzname[1],strlen(tzname[1]))));
+ PUSHs(newSVpvn_flags(tzname[0], strlen(tzname[0]), SVs_TEMP));
+ PUSHs(newSVpvn_flags(tzname[1], strlen(tzname[1]), SVs_TEMP));
SysRet
access(filename, mode)
package PerlIO::via;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
use XSLoader ();
XSLoader::load 'PerlIO::via';
1;
/* binmode() passes NULL - so find out what mode is */
mode = PerlIO_modestr(f,lmode);
}
- modesv = sv_2mortal(newSVpvn(mode, strlen(mode)));
+ modesv = newSVpvn_flags(mode, strlen(mode), SVs_TEMP);
result = PerlIOVia_method(aTHX_ f, MYMethod(PUSHED), G_SCALAR,
modesv, Nullsv);
if (result) {
PerlIOVia_unread(pTHX_ PerlIO * f, const void *vbuf, Size_t count)
{
PerlIOVia *s = PerlIOSelf(f, PerlIOVia);
- SV *buf = sv_2mortal(newSVpvn((char *) vbuf, count));
+ SV *buf = newSVpvn_flags((char *) vbuf, count, SVs_TEMP);
SV *result =
PerlIOVia_method(aTHX_ f, MYMethod(UNREAD), G_SCALAR, buf, Nullsv);
if (result)
push @names,
{name => $_, type => "SV",
pre=>"struct in_addr ip_address; ip_address.s_addr = htonl($_);",
- value => "sv_2mortal(newSVpvn((char *)&ip_address,sizeof ip_address ))",}
+ value => "newSVpvn_flags((char *)&ip_address,sizeof(ip_address), SVs_TEMP)",}
foreach qw(INADDR_ANY INADDR_LOOPBACK INADDR_NONE INADDR_BROADCAST);
WriteConstants(
package Socket;
our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = "1.84";
+$VERSION = "1.85";
=head1 NAME
((addr.s_addr >> 16) & 0xFF),
((addr.s_addr >> 8) & 0xFF),
( addr.s_addr & 0xFF));
- ST(0) = sv_2mortal(newSVpvn(addr_str, strlen(addr_str)));
+ ST(0) = newSVpvn_flags(addr_str, strlen(addr_str), SVs_TEMP);
Safefree(addr_str);
}
} else {
addr_len = sizeof sun_ad;
}
- ST(0) = sv_2mortal(newSVpvn((char *)&sun_ad, addr_len));
+ ST(0) = newSVpvn_flags((char *)&sun_ad, addr_len, SVs_TEMP);
#else
ST(0) = (SV *) not_here("pack_sockaddr_un");
#endif
&& addr_len < sizeof addr.sun_path; addr_len++);
}
- ST(0) = sv_2mortal(newSVpvn(addr.sun_path, addr_len));
+ ST(0) = newSVpvn_flags(addr.sun_path, addr_len, SVs_TEMP);
#else
ST(0) = (SV *) not_here("unpack_sockaddr_un");
#endif
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = htonl(addr.s_addr);
- ST(0) = sv_2mortal(newSVpvn((char *)&sin, sizeof sin));
+ ST(0) = newSVpvn_flags((char *)&sin, sizeof (sin), SVs_TEMP);
}
void
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv((IV) port)));
- PUSHs(sv_2mortal(newSVpvn((char *)&ip_address, sizeof ip_address)));
+ PUSHs(newSVpvn_flags((char *)&ip_address, sizeof(ip_address), SVs_TEMP));
}
void
Copy( ip_address, &addr, sizeof addr, char );
inet_ntop(af, &addr, str, INET6_ADDRSTRLEN);
- ST(0) = sv_2mortal(newSVpv(str, strlen(str)));
+ ST(0) = newSVpvn_flags(str, strlen(str), SVs_TEMP);
#else
ST(0) = (SV *)not_here("inet_ntop");
#endif