return -1;
nw_perlshell_items = 0; // No Shell
-// New(1306, argv, (sp - mark) + nw_perlshell_items + 3, char*); // In the old code of 5.6.1
- New(1306, argv, (sp - mark) + nw_perlshell_items + 2, char*);
+// Newx(argv, (sp - mark) + nw_perlshell_items + 3, char*); // In the old code of 5.6.1
+ Newx(argv, (sp - mark) + nw_perlshell_items + 2, char*);
if (SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) {
++mark;
/* Save an extra exec if possible. See if there are shell
* metacharacters in it */
if (!has_shell_metachars(cmd)) {
- New(1301,argv, strlen(cmd) / 2 + 2, char*);
- New(1302,cmd2, strlen(cmd) + 1, char);
+ Newx(argv, strlen(cmd) / 2 + 2, char*);
+ Newx(cmd2, strlen(cmd) + 1, char);
strcpy(cmd2, cmd);
a = argv;
for (s = cmd2; *s;) {
char **argv = NULL;
int i = -1;
- New(1306, argv, nw_perlshell_items + 2, char*);
+ Newx(argv, nw_perlshell_items + 2, char*);
while (++i < nw_perlshell_items)
argv[i] = nw_perlshell_vec[i];
argv[i++] = cmd;
assert(itmp > newmax);
newmax = itmp - 1;
assert(newmax >= AvMAX(av));
- New(2,ary, newmax+1, SV*);
+ Newx(ary, newmax+1, SV*);
Copy(AvALLOC(av), ary, AvMAX(av)+1, SV*);
if (AvMAX(av) > 64)
offer_nice_chunk(AvALLOC(av), (AvMAX(av)+1) * sizeof(SV*));
else {
newmax = key < 3 ? 3 : key;
MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
- New(2,AvALLOC(av), newmax+1, SV*);
+ Newx(AvALLOC(av), newmax+1, SV*);
ary = AvALLOC(av) + 1;
tmp = newmax;
AvALLOC(av)[0] = &PL_sv_undef; /* For the stacks */
if (size) { /* "defined" was returning undef for size==0 anyway. */
register SV** ary;
register I32 i;
- New(4,ary,size,SV*);
+ Newx(ary,size,SV*);
AvALLOC(av) = ary;
SvPV_set(av, (char*)ary);
AvFILLp(av) = size - 1;
av = (AV*)NEWSV(9,0);
sv_upgrade((SV *)av, SVt_PVAV);
- New(4,ary,size+1,SV*);
+ Newx(ary,size+1,SV*);
AvALLOC(av) = ary;
Copy(strp,ary,size,SV*);
AvREIFY_only(av);
SV *specialsv_list[6];
BYTECODE_HEADER_CHECK; /* croak if incorrect platform */
- New(666, bstate->bs_obj_list, 32, void*); /* set op objlist */
+ Newx(bstate->bs_obj_list, 32, void*); /* set op objlist */
bstate->bs_obj_list_fill = 31;
bstate->bs_obj_list[0] = NULL; /* first is always Null */
bstate->bs_ix = 1;
return do_spawnvp("sh",command);
}
- New (1303,PL_Argv,(s-cmd)/2+2,char*);
+ Newx (PL_Argv,(s-cmd)/2+2,char*);
PL_Cmd=savepvn (cmd,s-cmd);
a=PL_Argv;
for (s=PL_Cmd; *s;) {
return convretcode (system (cmd),cmd,execf);
}
- New (1303,PL_Argv,(s-cmd)/2+2,char*);
+ Newx (PL_Argv,(s-cmd)/2+2,char*);
PL_Cmd=savepvn (cmd,s-cmd);
a=PL_Argv;
for (s=PL_Cmd; *s;) {
const char *tmps = Nullch;
if (sp > mark) {
- New(401,PL_Argv, sp - mark + 1, char*);
+ Newx(PL_Argv, sp - mark + 1, char*);
a = PL_Argv;
while (++mark <= sp) {
if (*mark)
}
}
- New(402,PL_Argv, (s - cmd) / 2 + 2, char*);
+ Newx(PL_Argv, (s - cmd) / 2 + 2, char*);
PL_Cmd = savepvn(cmd, s-cmd);
a = PL_Argv;
for (s = PL_Cmd; *s;) {
struct sembuf *temps, *t;
I32 result;
- New (0, temps, nsops, struct sembuf);
+ Newx (temps, nsops, struct sembuf);
t = temps;
while (i--) {
t->sem_num = *o++;
/* Allow for expansion: $_="a".chr(400); tr/a/\xFE/, FE needs encoding */
if (grows)
- New(0, d, len*2+1, U8);
+ Newx(d, len*2+1, U8);
else
d = s;
dstart = d;
}
else { /* isutf8 */
if (grows)
- New(0, d, len*2+1, U8);
+ Newx(d, len*2+1, U8);
else
d = s;
dstart = d;
if (grows) {
/* d needs to be bigger than s, in case e.g. upgrading is required */
- New(0, d, len * 3 + UTF8_MAXBYTES, U8);
+ Newx(d, len * 3 + UTF8_MAXBYTES, U8);
dend = d + len * 3;
dstart = d;
}
if (grows) {
/* d needs to be bigger than s, in case e.g. upgrading is required */
- New(0, d, len * 3 + UTF8_MAXBYTES, U8);
+ Newx(d, len * 3 + UTF8_MAXBYTES, U8);
dend = d + len * 3;
dstart = d;
}
lensave = len;
if ((left_utf || right_utf) && (sv == left || sv == right)) {
needlen = optype == OP_BIT_AND ? len : leftlen + rightlen;
- Newz(801, dc, needlen + 1, char);
+ Newxz(dc, needlen + 1, char);
}
else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) {
STRLEN n_a;
else {
needlen = ((optype == OP_BIT_AND)
? len : (leftlen > rightlen ? leftlen : rightlen));
- Newz(801, dc, needlen + 1, char);
+ Newxz(dc, needlen + 1, char);
(void)sv_usepvn(sv, dc, needlen);
dc = SvPVX(sv); /* sv_usepvn() calls Renew() */
}
if (CopSTASH_eq(PL_curcop, PL_debstash) && !DEBUG_J_TEST_)
return;
if (!PL_profiledata)
- Newz(000, PL_profiledata, MAXO, U32);
+ Newxz(PL_profiledata, MAXO, U32);
++PL_profiledata[o->op_type];
}
# work with byte offsets/lengths
my $pv = pack "a*", $pv;
if (defined $max_string_len && length($pv) > $max_string_len) {
- push @res, sprintf("New(0,%s,%u,char);", $dest, length($pv)+1);
+ push @res, sprintf("Newx(%s,%u,char);", $dest, length($pv)+1);
my $offset = 0;
while (length $pv) {
my $str = substr $pv, 0, $max_string_len, '';
#else
#define EXTRA_OPTIONS 4
#endif /* ALLOW_PERL_OPTIONS */
- New(666, fakeargv, argc + EXTRA_OPTIONS + 1, char *);
+ Newx(fakeargv, argc + EXTRA_OPTIONS + 1, char *);
fakeargv[0] = argv[0];
fakeargv[1] = "-e";
REGEXP* rx = PM_GETRE( (PMOP*)PL_op );
SV* rv = newSViv( 0 );
- New( 671, op, 1, PMOP );
+ Newx( op, 1, PMOP );
Copy( PL_op, op, 1, PMOP );
/* we need just the flags */
op->op_next = NULL;
#define BGET_PV(arg) STMT_START { \
BGET_U32(arg); \
if (arg) { \
- New(666, bstate->bs_pv.pvx, arg, char); \
+ Newx(bstate->bs_pv.pvx, arg, char); \
bl_read(bstate->bs_fdata, bstate->bs_pv.pvx, arg, 1); \
bstate->bs_pv.xpv.xpv_len = arg; \
bstate->bs_pv.xpv.xpv_cur = arg - 1; \
#define BGET_op_tr_array(arg) do { \
unsigned short *ary, len; \
BGET_U16(len); \
- New(666, ary, len, unsigned short); \
+ Newx(ary, len, unsigned short); \
BGET_FREAD(ary, sizeof(unsigned short), len); \
arg = (char *) ary; \
} while (0)
SV *specialsv_list[6];
BYTECODE_HEADER_CHECK; /* croak if incorrect platform */
- New(666, bstate->bs_obj_list, 32, void*); /* set op objlist */
+ Newx(bstate->bs_obj_list, 32, void*); /* set op objlist */
bstate->bs_obj_list_fill = 31;
bstate->bs_obj_list[0] = NULL; /* first is always Null */
bstate->bs_ix = 1;
g_key_hash = newSV(256);
g_prof_pid = (int)getpid();
- New(0, g_profstack, g_profstack_max, PROFANY);
+ Newx(g_profstack, g_profstack_max, PROFANY);
prof_recordheader(aTHX);
DBG_TIMER_NOTIFY("Profiler timer is on.\n");
g_orealtime = g_rprof_start = Times(&g_prof_start);
mp->refCnt++;
return mp;
}
- Newz(1000,mp,1,Module);
+ Newxz(mp,1,Module);
if (mp == NULL) {
dl_errvalid++;
strcpy(dl_errbuf, "Newz: ");
continue;
mp->nExports++;
}
- Newz(1001, mp->exports, mp->nExports, Export);
+ Newxz(mp->exports, mp->nExports, Export);
if (mp->exports == NULL) {
dl_errvalid++;
strcpy(dl_errbuf, "readExports: ");
Safefree(dl_last_error);
}
NXGetMemoryBuffer(s, &buffer, &len, &maxlen);
- New(1097, dl_last_error, len, char);
+ Newx(dl_last_error, len, char);
strcpy(dl_last_error, buffer);
}
specdsc.dsc$w_length = strlen(specdsc.dsc$a_pointer);
DLDEBUG(2,PerlIO_printf(Perl_debug_log, "\tVMS-ified filespec is %s\n",
specdsc.dsc$a_pointer));
- New(1399,dlptr,1,struct libref);
+ Newx(dlptr,1,struct libref);
dlptr->name.dsc$b_dtype = dlptr->defspec.dsc$b_dtype = DSC$K_DTYPE_T;
dlptr->name.dsc$b_class = dlptr->defspec.dsc$b_class = DSC$K_CLASS_S;
sts = sys$filescan(&specdsc,namlst,0);
dlptr->name.dsc$w_length = namlst[0].len;
dlptr->name.dsc$a_pointer = savepvn(namlst[0].string,namlst[0].len);
dlptr->defspec.dsc$w_length = specdsc.dsc$w_length - namlst[0].len;
- New(1097, dlptr->defspec.dsc$a_pointer, dlptr->defspec.dsc$w_length + 1, char);
+ Newx(dlptr->defspec.dsc$a_pointer, dlptr->defspec.dsc$w_length + 1, char);
deflen = namlst[0].string - specdsc.dsc$a_pointer;
memcpy(dlptr->defspec.dsc$a_pointer,specdsc.dsc$a_pointer,deflen);
memcpy(dlptr->defspec.dsc$a_pointer + deflen,
/* We operate on a copy of the pattern */
len = strlen(pattern);
- New(0, new_pat, len + 1, char);
+ Newx(new_pat, len + 1, char);
if (new_pat == NULL)
return (GLOB_NOSPACE);
if (pglob->gl_pathv)
pathv = Renew(pglob->gl_pathv,newsize,char*);
else
- New(0,pathv,newsize,char*);
+ Newx(pathv,newsize,char*);
if (pathv == NULL) {
if (pglob->gl_pathv) {
Safefree(pglob->gl_pathv);
;
len = (STRLEN)(p - path);
*limitp += len;
- New(0, copy, p-path, char);
+ Newx(copy, p-path, char);
if (copy != NULL) {
if (g_Ctoc(path, copy, len)) {
Safefree(copy);
if (dbmrefcnt++)
croak("Old dbm can only open one database");
- New(0, tmpbuf, strlen(filename) + 5, char);
+ Newx(tmpbuf, strlen(filename) + 5, char);
SAVEFREEPV(tmpbuf);
sprintf(tmpbuf,"%s.dir",filename);
if (stat(tmpbuf, &PL_statbuf) < 0) {
SV *opset
PREINIT:
if (!PL_op_mask)
- Newz(0, PL_op_mask, PL_maxo, char);
+ Newxz(PL_op_mask, PL_maxo, char);
CODE:
opmask_add(aTHX_ opset);
CODE:
{
int i;
- New(0, RETVAL, 1, sigset_t);
+ Newx(RETVAL, 1, sigset_t);
sigemptyset(RETVAL);
for (i = 1; i < items; i++)
sigaddset(RETVAL, SvIV(ST(i)));
CODE:
{
#ifdef I_TERMIOS
- New(0, RETVAL, 1, struct termios);
+ Newx(RETVAL, 1, struct termios);
#else
not_here("termios");
RETVAL = 0;
sigset = INT2PTR(sigset_t*, tmp);
}
else {
- New(0, sigset, 1, sigset_t);
+ Newx(sigset, 1, sigset_t);
sv_setptrobj(*svp, sigset, "POSIX::SigSet");
}
*sigset = oact.sa_mask;
* in HP-UX + GCC + 64bitint (returns "0.0.0.0"),
* so let's use this sprintf() workaround everywhere.
* This is also more threadsafe than using inet_ntoa(). */
- New(1138, addr_str, 4 * 3 + 3 + 1, char); /* IPv6? */
+ Newx(addr_str, 4 * 3 + 3 + 1, char); /* IPv6? */
sprintf(addr_str, "%d.%d.%d.%d",
((addr.s_addr >> 24) & 0xFF),
((addr.s_addr >> 16) & 0xFF),
/* T_ARRAY - allocate some memory */
intArray * intArrayPtr( int nelem ) {
intArray * array;
- New(0, array, nelem, intArray);
+ Newx(array, nelem, intArray);
return array;
}
if (tmplen < sizeof smallbuf)
tmpbuf = smallbuf;
else
- New(603, tmpbuf, tmplen + 1, char);
+ Newx(tmpbuf, tmplen + 1, char);
/* This is where the debugger's %{"::_<$filename"} hash is created */
tmpbuf[0] = '_';
tmpbuf[1] = '<';
} else
Safefree(SvPVX_mutable(gv));
}
- Newz(602, gp, 1, GP);
+ Newxz(gp, 1, GP);
GvGP(gv) = gp_ref(gp);
#ifdef PERL_DONT_CREATE_GVSV
GvSV(gv) = 0;
if (namelen + 3 < sizeof smallbuf)
tmpbuf = smallbuf;
else
- New(606, tmpbuf, namelen + 3, char);
+ Newx(tmpbuf, namelen + 3, char);
Copy(name,tmpbuf,namelen,char);
tmpbuf[namelen++] = ':';
tmpbuf[namelen++] = ':';
if (len + 3 < sizeof (smallbuf))
tmpbuf = smallbuf;
else
- New(601, tmpbuf, len+3, char);
+ Newx(tmpbuf, len+3, char);
Copy(name, tmpbuf, len, char);
tmpbuf[len++] = ':';
tmpbuf[len++] = ':';
HV *hv;
I32 i;
if (!PL_psig_ptr) {
- Newz(73, PL_psig_ptr, SIG_SIZE, SV*);
- Newz(73, PL_psig_name, SIG_SIZE, SV*);
- Newz(73, PL_psig_pend, SIG_SIZE, int);
+ Newxz(PL_psig_ptr, SIG_SIZE, SV*);
+ Newxz(PL_psig_name, SIG_SIZE, SV*);
+ Newxz(PL_psig_pend, SIG_SIZE, int);
}
GvMULTI_on(gv);
hv = GvHVn(gv);
=head1 Memory Management
-=for apidoc Am|void|New|int id|void* ptr|int nitems|type
+=for apidoc Am|void|Newx|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<malloc> function.
-=for apidoc Am|void|Newc|int id|void* ptr|int nitems|type|cast
+=for apidoc Am|void|Newxc|void* ptr|int nitems|type|cast
The XSUB-writer's interface to the C C<malloc> function, with
cast.
-=for apidoc Am|void|Newz|int id|void* ptr|int nitems|type
+=for apidoc Am|void|Newxz|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<malloc> function. The allocated
memory is zeroed with C<memzero>.
+In 5.9.3, we removed the 1st parameter, a debug aid, from the api. It
+was used to uniquely identify each usage of these allocation
+functions, but was deemed unnecessary with the availability of better
+memory tracking tools, valgrind for example.
+
=for apidoc Am|void|Renew|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<realloc> function.
#endif
-#define New(x,v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
-#define Newc(x,v,n,t,c) (v = (MEM_WRAP_CHECK_(n,t) (c*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
-#define Newz(x,v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t))))), \
+#define Newx(v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
+#define Newxc(v,n,t,c) (v = (MEM_WRAP_CHECK_(n,t) (c*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
+#define Newxz(v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t))))), \
memzero((char*)(v), (n)*sizeof(t))
+/* pre 5.9.x compatibility */
+#define New(x,v,n,t) Newx(v,n,t)
+#define Newc(x,v,n,t,c) Newxc(v,n,t,c)
+#define Newc(x,v,n,t,c) Newxc(v,n,t,c)
+
#define Renew(v,n,t) \
(v = (MEM_WRAP_CHECK_(n,t) (t*)saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))
#define Renewc(v,n,t,c) \
{
HE* he;
HE* heend;
- New(54, he, PERL_ARENA_SIZE/sizeof(HE), HE);
+ Newx(he, PERL_ARENA_SIZE/sizeof(HE), HE);
HeNEXT(he) = PL_he_arenaroot;
PL_he_arenaroot = he;
char *k;
register HEK *hek;
- New(54, k, HEK_BASESIZE + len + 2, char);
+ Newx(k, HEK_BASESIZE + len + 2, char);
hek = (HEK*)k;
Copy(str, HEK_KEY(hek), len, char);
HEK_KEY(hek)[len] = 0;
HeNEXT(ret) = he_dup(HeNEXT(e),shared, param);
if (HeKLEN(e) == HEf_SVKEY) {
char *k;
- New(54, k, HEK_BASESIZE + sizeof(SV*), char);
+ Newx(k, HEK_BASESIZE + sizeof(SV*), char);
HeKEY_hek(ret) = (HEK*)k;
HeKEY_sv(ret) = SvREFCNT_inc(sv_dup(HeKEY_sv(e), param));
}
else {
char *k;
entry = new_HE();
- New(54, k, HEK_BASESIZE + sizeof(SV*), char);
+ Newx(k, HEK_BASESIZE + sizeof(SV*), char);
HeKEY_hek(entry) = (HEK*)k;
}
HeNEXT(entry) = Nullhe;
#endif
) {
char *array;
- Newz(503, array,
+ Newxz(array,
PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
char);
HvARRAY(hv) = (HE**)array;
NULL is for %ENV with dynamic env fetch. But that should disappear
with magic in the previous code. */
char *array;
- Newz(503, array,
+ Newxz(array,
PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
char);
HvARRAY(hv) = (HE**)array;
Copy(&a[oldsize * sizeof(HE*)], &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux);
}
#else
- New(2, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ Newx(a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0), char);
if (!a) {
PL_nomemok = FALSE;
longest_chain, HvTOTALKEYS(hv), HvFILL(hv), 1+HvMAX(hv));*/
++newsize;
- Newz(2, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ Newxz(a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0), char);
if (SvOOK(hv)) {
Copy(HvAUX(hv), &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux);
Copy(&a[oldsize * sizeof(HE*)], &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux);
}
#else
- New(2, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ Newx(a, PERL_HV_ARRAY_ALLOC_BYTES(newsize)
+ (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0), char);
if (!a) {
PL_nomemok = FALSE;
Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/
}
else {
- Newz(0, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize), char);
+ Newxz(a, PERL_HV_ARRAY_ALLOC_BYTES(newsize), char);
}
xhv->xhv_max = --newsize; /* HvMAX(hv) = --newsize */
HvARRAY(hv) = (HE **) a;
const bool shared = !!HvSHAREKEYS(ohv);
HE **ents, **oents = (HE **)HvARRAY(ohv);
char *a;
- New(0, a, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char);
+ Newx(a, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char);
ents = (HE**)a;
/* In each bucket... */
char *array;
if (!HvARRAY(hv)) {
- Newz(0, array, PERL_HV_ARRAY_ALLOC_BYTES(HvMAX(hv) + 1)
+ Newxz(array, PERL_HV_ARRAY_ALLOC_BYTES(HvMAX(hv) + 1)
+ sizeof(struct xpvhv_aux), char);
} else {
array = (char *) HvARRAY(hv);
/* one HE per MAGICAL hash */
iter->xhv_eiter = entry = new_HE(); /* HvEITER(hv) = new_HE() */
Zero(entry, 1, HE);
- Newz(54, k, HEK_BASESIZE + sizeof(SV*), char);
+ Newxz(k, HEK_BASESIZE + sizeof(SV*), char);
hek = (HEK*)k;
HeKEY_hek(entry) = hek;
HeKLEN(entry) = HEf_SVKEY;
HEK directly from the HE.
*/
- New(0, k, STRUCT_OFFSET(struct shared_he,
+ Newx(k, STRUCT_OFFSET(struct shared_he,
shared_he_hek.hek_key[0]) + len + 2, char);
new_entry = (struct shared_he *)k;
entry = &(new_entry->shared_he_he);
/* the +1 is for the terminating NUL. */
xAlloc = sizeof(PL_collation_ix) + PL_collxfrm_base + (PL_collxfrm_mult * len) + 1;
- New(171, xbuf, xAlloc, char);
+ Newx(xbuf, xAlloc, char);
if (! xbuf)
goto bad;
U8 tmpbuf[UTF8_MAXBYTES+1];
UV *cp;
UV nextmin = 0;
- New(1109, cp, 2*tlen, UV);
+ Newx(cp, 2*tlen, UV);
i = 0;
transv = newSVpvn("",0);
while (t < tend) {
(var = (OP *) Perl_Slab_Alloc(aTHX_ m,size))
#define FreeOp(p) Perl_Slab_Free(aTHX_ p)
#else
-#define NewOp(m, var, c, type) Newz(m, var, c, type)
+#define NewOp(m, var, c, type) Newxz(var, c, type)
#define NewOpSz(m, var, size) \
(var = (OP*)safemalloc(size), memzero(var, size))
#define FreeOp(p) Safefree(p)
incompartment++;
if (c)
- Newz(728, subs, c, char);
+ Newxz(subs, c, char);
while (n--) {
rc = pRexxRegisterFunctionExe(handlerNames[n], handlers[n]);
if (rc == RXFUNC_DEFINED)
s = cmd;
while (*s) {
if (*s == '\n') { /* Is not preceeded by \r! */
- New(728, cmd, 2*strlen(cmd)+1, char);
+ Newx(cmd, 2*strlen(cmd)+1, char);
s = ocmd;
t = cmd;
while (*s) {
if ((items % 2) == 0)
Perl_croak(aTHX_ "Name/values should come in pairs in REXX_eval_with()");
- New(730, names, n, char*);
- New(730, cvs, n, SV*);
+ Newx(names, n, char*);
+ Newx(cvs, n, SV*);
/* XXX Unfinished... */
RETVAL = Nullsv;
Safefree(names);
Renew(thread_join_data, thread_join_count, thread_join_t);
Zero(thread_join_data + oc, thread_join_count - oc, thread_join_t);
} else {
- Newz(1323, thread_join_data, thread_join_count, thread_join_t);
+ Newxz(thread_join_data, thread_join_count, thread_join_t);
}
}
if (thread_join_data[tid].state != pthreads_st_none) {
return 0;
}
}
- New(1322, pbuffer, buf_len, char);
+ Newx(pbuffer, buf_len, char);
/* QSS_PROCESS | QSS_MODULE | QSS_SEMAPHORES | QSS_SHARED */
rc = QuerySysState(flags, pid, pbuffer, buf_len);
while (rc == ERROR_BUFFER_OVERFLOW) {
if (strnEQ(cmd,"/bin/sh",7) && isSPACE(cmd[7])) {
STRLEN l = strlen(PL_sh_path);
- New(1302, news, strlen(cmd) - 7 + l + 1, char);
+ Newx(news, strlen(cmd) - 7 + l + 1, char);
strcpy(news, PL_sh_path);
strcpy(news + l, cmd + 7);
cmd = news;
}
/* cmd="a" may lead to "sh", "-c", "\"$@\"", "a", "a.cmd", NULL */
- New(1303,PL_Argv, (s - cmd + 11) / 2, char*);
+ Newx(PL_Argv, (s - cmd + 11) / 2, char*);
PL_Cmd = savepvn(cmd, s-cmd);
a = PL_Argv;
for (s = PL_Cmd; *s;) {
STRLEN n_a;
if (sp > mark) {
- New(1301,PL_Argv, sp - mark + 3, char*);
+ Newx(PL_Argv, sp - mark + 3, char*);
a = PL_Argv;
if (mark < sp && SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) {
c++;
e = e + strlen(e) + 1;
}
- New(1307, env, c + 1, char*);
+ Newx(env, c + 1, char*);
ep = env;
e = pib->pib_pchenv;
while (c--) {
if (perl_sh_installed) {
int l = strlen(perl_sh_installed);
- New(1304, PL_sh_path, l + 1, char);
+ Newx(PL_sh_path, l + 1, char);
memcpy(PL_sh_path, perl_sh_installed, l + 1);
} else if ( (shell = getenv("PERL_SH_DRIVE")) ) {
- New(1304, PL_sh_path, strlen(SH_PATH) + 1, char);
+ Newx(PL_sh_path, strlen(SH_PATH) + 1, char);
strcpy(PL_sh_path, SH_PATH);
PL_sh_path[0] = shell[0];
} else if ( (shell = getenv("PERL_SH_DIR")) ) {
while (l && (shell[l-1] == '/' || shell[l-1] == '\\'))
l--;
- New(1304, PL_sh_path, l + 8, char);
+ Newx(PL_sh_path, l + 8, char);
strncpy(PL_sh_path, shell, l);
strcpy(PL_sh_path + l, "/sh.exe");
for (i = 0; i < l; i++) {
if (s[l-1] == '/' || s[l-1] == '\\') { /* EMX mkdir fails... */
if (l >= sizeof b)
- New(1305, buf, l + 1, char);
+ Newx(buf, l + 1, char);
strcpy(buf,s);
while (l > 1 && (s[l-1] == '/' || s[l-1] == '\\'))
l--;
if (s[l-1] == '/' || s[l-1] == '\\') { /* EMX mkdir fails... */
if (l >= sizeof b)
- New(1305, buf, l + 1, char);
+ Newx(buf, l + 1, char);
strcpy(buf,s);
while (l > 1 && (s[l-1] == '/' || s[l-1] == '\\'))
l--;
CvPADLIST(PL_compcv) = pad_new(0);
#ifdef USE_5005THREADS
CvOWNER(PL_compcv) = 0;
- New(666, CvMUTEXP(PL_compcv), 1, perl_mutex);
+ Newx(CvMUTEXP(PL_compcv), 1, perl_mutex);
MUTEX_INIT(CvMUTEXP(PL_compcv));
#endif /* USE_5005THREADS */
PL_stack_sp = PL_stack_base;
PL_stack_max = PL_stack_base + AvMAX(PL_curstack);
- New(50,PL_tmps_stack,REASONABLE(128),SV*);
+ Newx(PL_tmps_stack,REASONABLE(128),SV*);
PL_tmps_floor = -1;
PL_tmps_ix = -1;
PL_tmps_max = REASONABLE(128);
- New(54,PL_markstack,REASONABLE(32),I32);
+ Newx(PL_markstack,REASONABLE(32),I32);
PL_markstack_ptr = PL_markstack;
PL_markstack_max = PL_markstack + REASONABLE(32);
SET_MARK_OFFSET;
- New(54,PL_scopestack,REASONABLE(32),I32);
+ Newx(PL_scopestack,REASONABLE(32),I32);
PL_scopestack_ix = 0;
PL_scopestack_max = REASONABLE(32);
- New(54,PL_savestack,REASONABLE(128),ANY);
+ Newx(PL_savestack,REASONABLE(128),ANY);
PL_savestack_ix = 0;
PL_savestack_max = REASONABLE(128);
}
#endif
XPV *xpv;
- Newz(53, thr, 1, struct perl_thread);
+ Newxz(thr, 1, struct perl_thread);
PL_curcop = &PL_compiling;
thr->interp = PERL_GET_INTERP;
thr->cvcache = newHV();
thr->flags = THRf_R_JOINABLE;
MUTEX_INIT(&thr->mutex);
/* Handcraft thrsv similarly to mess_sv */
- New(53, PL_thrsv, 1, SV);
- Newz(53, xpv, 1, XPV);
+ Newx(PL_thrsv, 1, SV);
+ Newxz(xpv, 1, XPV);
SvFLAGS(PL_thrsv) = SVt_PV;
SvANY(PL_thrsv) = (void*)xpv;
SvREFCNT(PL_thrsv) = 1 << 30; /* practically infinite */
}
}
}
- Newz('I',f,PERLIO_TABLE_SIZE,PerlIO);
+ Newxz(f,PERLIO_TABLE_SIZE,PerlIO);
if (!f) {
return NULL;
}
PerlIO_list_alloc(pTHX)
{
PerlIO_list_t *list;
- Newz('L', list, 1, PerlIO_list_t);
+ Newxz(list, 1, PerlIO_list_t);
list->refcnt = 1;
return list;
}
if (list->array)
Renew(list->array, list->len, PerlIO_pair_t);
else
- New('l', list->array, list->len, PerlIO_pair_t);
+ Newx(list->array, list->len, PerlIO_pair_t);
}
p = &(list->array[list->cur++]);
p->funcs = funcs;
goto mismatch;
}
/* Real layer with a data area */
- Newc('L',l,tab->size,char,PerlIOl);
+ Newxc(l,tab->size,char,PerlIOl);
if (l && f) {
Zero(l, tab->size, char);
l->next = *f;
if (!b->buf) {
if (!b->bufsiz)
b->bufsiz = 4096;
- b->buf = Newz('B',b->buf,b->bufsiz, STDCHAR);
+ b->buf = Newxz(b->buf,b->bufsiz, STDCHAR);
if (!b->buf) {
b->buf = (STDCHAR *) & b->oneword;
b->bufsiz = sizeof(b->oneword);
=for hackers
Found in file handy.h
-=item New
+=item Newx
The XSUB-writer's interface to the C C<malloc> function.
- void New(int id, void* ptr, int nitems, type)
+ void Newx(void* ptr, int nitems, type)
=for hackers
Found in file handy.h
-=item Newc
+=item Newxc
The XSUB-writer's interface to the C C<malloc> function, with
cast.
- void Newc(int id, void* ptr, int nitems, type, cast)
+ void Newxc(void* ptr, int nitems, type, cast)
=for hackers
Found in file handy.h
-=item Newz
+=item Newxz
The XSUB-writer's interface to the C C<malloc> function. The allocated
memory is zeroed with C<memzero>.
- void Newz(int id, void* ptr, int nitems, type)
+In 5.9.3, we removed the 1st parameter, a debug aid, from the api. It
+was used to uniquely identify each usage of these allocation
+functions, but was deemed unnecessary with the availability of better
+memory tracking tools, valgrind for example.
+
+ void Newxz(void* ptr, int nitems, type)
=for hackers
Found in file handy.h
if (pos > PL_maxscream) {
if (PL_maxscream < 0) {
PL_maxscream = pos + 80;
- New(301, PL_screamfirst, 256, I32);
- New(302, PL_screamnext, PL_maxscream, I32);
+ Newx(PL_screamfirst, 256, I32);
+ Newx(PL_screamnext, PL_maxscream, I32);
}
else {
PL_maxscream = pos + pos / 4;
else {
GP *gp;
gp_free((GV*)sv);
- Newz(602, gp, 1, GP);
+ Newxz(gp, 1, GP);
GvGP(sv) = gp_ref(gp);
GvSV(sv) = NEWSV(72,0);
GvLINE(sv) = CopLINE(PL_curcop);
tmps -= len;
if (nwide) {
- Newz(0, result, targlen + 1, U8);
+ Newxz(result, targlen + 1, U8);
while (tmps < send) {
const UV c = utf8n_to_uvchr(tmps, send-tmps, &l, UTF8_ALLOW_ANYUV);
tmps += UTF8SKIP(tmps);
SvUTF8_on(TARG);
}
else {
- Newz(0, result, nchar + 1, U8);
+ Newxz(result, nchar + 1, U8);
while (tmps < send) {
const U8 c = (U8)utf8n_to_uvchr(tmps, 0, &l, UTF8_ALLOW_ANY);
tmps += UTF8SKIP(tmps);
if (diff < 0) { /* shrinking the area */
if (newlen) {
- New(451, tmparyval, newlen, SV*); /* so remember insertion */
+ Newx(tmparyval, newlen, SV*); /* so remember insertion */
Copy(MARK, tmparyval, newlen, SV*);
}
}
else { /* no, expanding (or same) */
if (length) {
- New(452, tmparyval, length, SV*); /* so remember deletion */
+ Newx(tmparyval, length, SV*); /* so remember deletion */
Copy(AvARRAY(ary)+offset, tmparyval, length, SV*);
}
i = 6 + rx->nparens * 2;
#endif
if (!p)
- New(501, p, i, UV);
+ Newx(p, i, UV);
else
Renew(p, i, UV);
*rsp = (void*)p;
s = base;
base = Nullch;
- New(804, fops, maxops, U32);
+ Newx(fops, maxops, U32);
fpc = fops;
if (s < send) {
if (checksum) {
if (!PL_bitcount) {
int bits;
- Newz(601, PL_bitcount, 256, char);
+ Newxz(PL_bitcount, 256, char);
for (bits = 1; bits < 256; bits++) {
if (bits & 1) PL_bitcount[bits]++;
if (bits & 2) PL_bitcount[bits]++;
}
len = (from_end-from_ptr)*UTF8_EXPAND+(from_ptr-from_start)+1;
- New('U', to_start, len, char);
+ Newx(to_start, len, char);
Copy(from_start, to_start, from_ptr-from_start, char);
to_ptr = to_start + (from_ptr-from_start);
- New('U', marks, sym_ptr->level+2, const char *);
+ Newx(marks, sym_ptr->level+2, const char *);
for (group=sym_ptr; group; group = group->previous)
marks[group->level] = from_start + group->strbeg;
marks[sym_ptr->level+1] = from_end+1;
if ((norm = is_an_int(from, len)) == NULL)
Perl_croak(aTHX_ "Can only compress unsigned integers in pack");
- New('w', result, len, char);
+ Newx(result, len, char);
in = result + len;
done = FALSE;
while (!done) *--in = div128(norm, &done) | 0x80;
}
if (nmemb <= SMALLSORT) aux = small; /* use stack for aux array */
- else { New(799,aux,nmemb,gptr); } /* allocate auxilliary array */
+ else { Newx(aux,nmemb,gptr); } /* allocate auxilliary array */
level = 0;
stackp = stack;
stackp->runs = dynprep(aTHX_ base, aux, nmemb, cmp);
/* Small arrays can use the stack, big ones must be allocated */
if (nmemb <= SMALLSORT) indir = small;
- else { New(1799, indir, nmemb, gptr *); }
+ else { Newx(indir, nmemb, gptr *); }
/* Copy pointers to original array elements into indirect array */
for (n = nmemb, pp = indir, q = list1; n--; ) *pp++ = q++;
#if BYTEORDER != 0x1234 && BYTEORDER != 0x12345678
s = SvPVX(sv);
- New(403, fd_sets[i], growsize, char);
+ Newx(fd_sets[i], growsize, char);
for (offset = 0; offset < growsize; offset += masksize) {
for (j = 0, k=ORDERBYTE; j < masksize; j++, (k >>= 4))
fd_sets[i][j+offset] = s[(k % masksize) + offset];
PerlIO *myfp;
int anum = 1;
- New(666, cmdline, strlen(cmd) + (strlen(filename) * 2) + 10, char);
+ Newx(cmdline, strlen(cmd) + (strlen(filename) * 2) + 10, char);
strcpy(cmdline, cmd);
strcat(cmdline, " ");
for (s = cmdline + strlen(cmdline); *filename; ) {
void
Perl_reentrant_init(pTHX) {
#ifdef USE_REENTRANT_API
- New(31337, PL_reentrant_buffer, 1, REENTR);
+ Newx(PL_reentrant_buffer, 1, REENTR);
Perl_reentrant_size(aTHX);
#ifdef HAS_ASCTIME_R
- New(31338, PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size, char);
+ Newx(PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size, char);
#endif /* HAS_ASCTIME_R */
#ifdef HAS_CRYPT_R
#if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
#endif
#endif /* HAS_CRYPT_R */
#ifdef HAS_CTIME_R
- New(31338, PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size, char);
+ Newx(PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size, char);
#endif /* HAS_CTIME_R */
#ifdef HAS_DRAND48_R
#endif /* HAS_DRAND48_R */
# ifdef USE_GRENT_FPTR
PL_reentrant_buffer->_grent_fptr = NULL;
# endif
- New(31338, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, char);
+ Newx(PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, char);
#endif /* HAS_GETGRNAM_R */
#ifdef HAS_GETHOSTBYNAME_R
#if !(GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD)
- New(31338, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, char);
+ Newx(PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, char);
#endif
#endif /* HAS_GETHOSTBYNAME_R */
#ifdef HAS_GETLOGIN_R
- New(31338, PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size, char);
+ Newx(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size, char);
#endif /* HAS_GETLOGIN_R */
#ifdef HAS_GETNETBYNAME_R
#if !(GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD)
- New(31338, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, char);
+ Newx(PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, char);
#endif
#endif /* HAS_GETNETBYNAME_R */
#ifdef HAS_GETPROTOBYNAME_R
#if !(GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD)
- New(31338, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size, char);
+ Newx(PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size, char);
#endif
#endif /* HAS_GETPROTOBYNAME_R */
#ifdef HAS_GETPWNAM_R
# ifdef USE_PWENT_FPTR
PL_reentrant_buffer->_pwent_fptr = NULL;
# endif
- New(31338, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, char);
+ Newx(PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, char);
#endif /* HAS_GETPWNAM_R */
#ifdef HAS_GETSERVBYNAME_R
#if !(GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD)
- New(31338, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, char);
+ Newx(PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, char);
#endif
#endif /* HAS_GETSERVBYNAME_R */
#ifdef HAS_GETSPNAM_R
# ifdef USE_SPENT_FPTR
PL_reentrant_buffer->_spent_fptr = NULL;
# endif
- New(31338, PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size, char);
+ Newx(PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size, char);
#endif /* HAS_GETSPNAM_R */
#ifdef HAS_GMTIME_R
#endif /* HAS_GMTIME_R */
PL_reentrant_buffer->_readdir64_struct = (struct dirent64*)safemalloc(PL_reentrant_buffer->_readdir64_size);
#endif /* HAS_READDIR64_R */
#ifdef HAS_SETLOCALE_R
- New(31338, PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size, char);
+ Newx(PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size, char);
#endif /* HAS_SETLOCALE_R */
#ifdef HAS_SRANDOM_R
#endif /* HAS_SRANDOM_R */
#ifdef HAS_STRERROR_R
- New(31338, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size, char);
+ Newx(PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size, char);
#endif /* HAS_STRERROR_R */
#ifdef HAS_TTYNAME_R
- New(31338, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size, char);
+ Newx(PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size, char);
#endif /* HAS_TTYNAME_R */
#endif /* USE_REENTRANT_API */
sub pushinitfree {
my $func = shift;
push @init, <<EOF;
- New(31338, PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
+ Newx(PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
EOF
push @free, <<EOF;
Safefree(PL_reentrant_buffer->_${func}_buffer);
EOF
push @init, <<EOF;
#if !($D)
- New(31338, PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
+ Newx(PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
#endif
EOF
push @free, <<EOF;
void
Perl_reentrant_init(pTHX) {
#ifdef USE_REENTRANT_API
- New(31337, PL_reentrant_buffer, 1, REENTR);
+ Newx(PL_reentrant_buffer, 1, REENTR);
Perl_reentrant_size(aTHX);
@init
#endif /* USE_REENTRANT_API */
} STMT_END
#define TRIE_LIST_NEW(state) STMT_START { \
- Newz( 1023, trie->states[ state ].trans.list, \
+ Newxz( trie->states[ state ].trans.list, \
4, reg_trie_trans_le ); \
TRIE_LIST_CUR( state ) = 1; \
TRIE_LIST_LEN( state ) = 4; \
GET_RE_DEBUG_FLAGS_DECL;
- Newz( 848200, trie, 1, reg_trie_data );
+ Newxz( trie, 1, reg_trie_data );
trie->refcount = 1;
RExC_rx->data->data[ data_slot ] = (void*)trie;
- Newz( 848201, trie->charmap, 256, U16 );
+ Newxz( trie->charmap, 256, U16 );
DEBUG_r({
trie->words = newAV();
trie->revcharmap = newAV();
STRLEN transcount = 1;
- Newz( 848204, trie->states, trie->charcount + 2, reg_trie_state );
+ Newxz( trie->states, trie->charcount + 2, reg_trie_state );
TRIE_LIST_NEW(1);
next_alloc = 2;
PerlIO_printf( Perl_debug_log, "\n\n" );
});
- Newz( 848203, trie->trans, transcount ,reg_trie_trans );
+ Newxz( trie->trans, transcount ,reg_trie_trans );
{
U32 state;
U32 tp = 0;
*/
- Newz( 848203, trie->trans, ( trie->charcount + 1 ) * trie->uniquecharcount + 1,
+ Newxz( trie->trans, ( trie->charcount + 1 ) * trie->uniquecharcount + 1,
reg_trie_trans );
- Newz( 848204, trie->states, trie->charcount + 2, reg_trie_state );
+ Newxz( trie->states, trie->charcount + 2, reg_trie_state );
next_alloc = trie->uniquecharcount + 1;
for ( cur = first ; cur < last ; cur = regnext( cur ) ) {
RExC_rx->data->count += n;
}
else {
- Newc(1207, RExC_rx->data, sizeof(*RExC_rx->data) + sizeof(void*) * (n - 1),
+ Newxc(RExC_rx->data, sizeof(*RExC_rx->data) + sizeof(void*) * (n - 1),
char, struct reg_data);
- New(1208, RExC_rx->data->what, n, U8);
+ Newx(RExC_rx->data->what, n, U8);
RExC_rx->data->count = n;
}
Copy(s, RExC_rx->data->what + RExC_rx->data->count - n, n, U8);
RExC_whilem_seen = 15;
/* Allocate space and initialize. */
- Newc(1001, r, sizeof(regexp) + (unsigned)RExC_size * sizeof(regnode),
+ Newxc(r, sizeof(regexp) + (unsigned)RExC_size * sizeof(regnode),
char, regexp);
if (r == NULL)
FAIL("Regexp out of space");
r->startp = 0; /* Useful during FAIL. */
r->endp = 0; /* Useful during FAIL. */
- Newz(1304, r->offsets, 2*RExC_size+1, U32); /* MJD 20001228 */
+ Newxz(r->offsets, 2*RExC_size+1, U32); /* MJD 20001228 */
if (r->offsets) {
r->offsets[0] = RExC_size;
}
/* XXXX To minimize changes to RE engine we always allocate
3-units-long substrs field. */
- Newz(1004, r->substrs, 1, struct reg_substr_data);
+ Newxz(r->substrs, 1, struct reg_substr_data);
StructCopy(&zero_scan_data, &data, scan_data_t);
/* XXXX Should not we check for something else? Usually it is OPEN1... */
{
const I32 n = add_data(pRExC_state, 1, "f");
- New(1006, RExC_rx->data->data[n], 1,
+ Newx(RExC_rx->data->data[n], 1,
struct regnode_charclass_class);
StructCopy(data.start_class,
(struct regnode_charclass_class*)RExC_rx->data->data[n],
{
const I32 n = add_data(pRExC_state, 1, "f");
- New(1006, RExC_rx->data->data[n], 1,
+ Newx(RExC_rx->data->data[n], 1,
struct regnode_charclass_class);
StructCopy(data.start_class,
(struct regnode_charclass_class*)RExC_rx->data->data[n],
r->reganch |= ROPT_EVAL_SEEN;
if (RExC_seen & REG_SEEN_CANY)
r->reganch |= ROPT_CANY_SEEN;
- Newz(1002, r->startp, RExC_npar, I32);
- Newz(1002, r->endp, RExC_npar, I32);
+ Newxz(r->startp, RExC_npar, I32);
+ Newxz(r->endp, RExC_npar, I32);
PL_regdata = r->data; /* for regprop() */
DEBUG_COMPILE_r(regdump(r));
return(r);
SAVEDESTRUCTOR_X(restore_pos, 0);
}
if (!PL_reg_curpm) {
- Newz(22, PL_reg_curpm, 1, PMOP);
+ Newxz(PL_reg_curpm, 1, PMOP);
#ifdef USE_ITHREADS
{
SV* repointer = newSViv(0);
if(PL_reg_start_tmp)
Renew(PL_reg_start_tmp, PL_reg_start_tmpl, char*);
else
- New(22, PL_reg_start_tmp, PL_reg_start_tmpl, char*);
+ Newx(PL_reg_start_tmp, PL_reg_start_tmpl, char*);
}
/* XXXX What this code is doing here?!!! There should be no need
}
else {
PL_reg_poscache_size = size;
- Newz(29, PL_reg_poscache, size, char);
+ Newxz(PL_reg_poscache, size, char);
}
DEBUG_EXECUTE_r(
PerlIO_printf(Perl_debug_log,
Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
{
PERL_SI *si;
- New(56, si, 1, PERL_SI);
+ Newx(si, 1, PERL_SI);
si->si_stack = newAV();
AvREAL_off(si->si_stack);
av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
si->si_cxmax = cxitems - 1;
si->si_cxix = -1;
si->si_type = PERLSI_UNDEF;
- New(56, si->si_cxstack, cxitems, PERL_CONTEXT);
+ Newx(si->si_cxstack, cxitems, PERL_CONTEXT);
/* Without any kind of initialising PUSHSUBST()
* in pp_subst() will read uninitialised heap. */
Poison(si->si_cxstack, cxitems, PERL_CONTEXT);
if (empty) {
register GP *gp;
- Newz(602, gp, 1, GP);
+ Newxz(gp, 1, GP);
if (GvCVu(gv))
PL_sub_generation++; /* taking a method out of circulation */
}
else {
char *chunk; /* must use New here to match call to */
- New(704,chunk,PERL_ARENA_SIZE,char); /* Safefree() in sv_free_arenas() */
+ Newx(chunk,PERL_ARENA_SIZE,char); /* Safefree() in sv_free_arenas() */
sv_add_arena(chunk, PERL_ARENA_SIZE, 0);
}
uproot_SV(sv);
char *start;
const char *end;
const size_t count = PERL_ARENA_SIZE/size;
- New(0, start, count*size, char);
+ Newx(start, count*size, char);
*((void **) start) = *arena_root;
*arena_root = (void *)start;
}
}
- New(616, mg->mg_ptr, mg->mg_len + 1 + left, char);
+ Newx(mg->mg_ptr, mg->mg_len + 1 + left, char);
Copy("(?", mg->mg_ptr, 2, char);
Copy(reflags, mg->mg_ptr+2, left, char);
Copy(":", mg->mg_ptr+left+2, 1, char);
if (SvTYPE(sv) < SVt_PVMG) {
SvUPGRADE(sv, SVt_PVMG);
}
- Newz(702,mg, 1, MAGIC);
+ Newxz(mg, 1, MAGIC);
mg->mg_moremagic = SvMAGIC(sv);
SvMAGIC_set(sv, mg);
if ((*mgp)->mg_ptr)
*cachep = (STRLEN *) (*mgp)->mg_ptr;
else {
- Newz(0, *cachep, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN);
+ Newxz(*cachep, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN);
(*mgp)->mg_ptr = (char *) *cachep;
}
assert(*cachep);
assert(mg);
if (!mg->mg_ptr) {
- Newz(0, cache, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN);
+ Newxz(cache, PERL_MAGIC_UTF8_CACHESIZE * 2, STRLEN);
mg->mg_ptr = (char *) cache;
}
assert(cache);
/*The big, slow, and stupid way. */
#ifdef USE_HEAP_INSTEAD_OF_STACK /* Even slower way. */
STDCHAR *buf = 0;
- New(0, buf, 8192, STDCHAR);
+ Newx(buf, 8192, STDCHAR);
assert(buf);
#else
STDCHAR buf[8192];
if (PL_efloatsize < need) {
Safefree(PL_efloatbuf);
PL_efloatsize = need + 20; /* more fudge */
- New(906, PL_efloatbuf, PL_efloatsize, char);
+ Newx(PL_efloatbuf, PL_efloatsize, char);
PL_efloatbuf[0] = '\0';
}
len = r->offsets[0];
npar = r->nparens+1;
- Newc(0, ret, sizeof(regexp) + (len+1)*sizeof(regnode), char, regexp);
+ Newxc(ret, sizeof(regexp) + (len+1)*sizeof(regnode), char, regexp);
Copy(r->program, ret->program, len+1, regnode);
- New(0, ret->startp, npar, I32);
+ Newx(ret->startp, npar, I32);
Copy(r->startp, ret->startp, npar, I32);
- New(0, ret->endp, npar, I32);
+ Newx(ret->endp, npar, I32);
Copy(r->startp, ret->startp, npar, I32);
- New(0, ret->substrs, 1, struct reg_substr_data);
+ Newx(ret->substrs, 1, struct reg_substr_data);
for (s = ret->substrs->data, i = 0; i < 3; i++, s++) {
s->min_offset = r->substrs->data[i].min_offset;
s->max_offset = r->substrs->data[i].max_offset;
const int count = r->data->count;
int i;
- Newc(0, d, sizeof(struct reg_data) + count*sizeof(void *),
+ Newxc(d, sizeof(struct reg_data) + count*sizeof(void *),
char, struct reg_data);
- New(0, d->what, count, U8);
+ Newx(d->what, count, U8);
d->count = count;
for (i = 0; i < count; i++) {
break;
case 'f':
/* This is cheating. */
- New(0, d->data[i], 1, struct regnode_charclass_class);
+ Newx(d->data[i], 1, struct regnode_charclass_class);
StructCopy(r->data->data[i], d->data[i],
struct regnode_charclass_class);
ret->regstclass = (regnode*)d->data[i];
else
ret->data = NULL;
- New(0, ret->offsets, 2*len+1, U32);
+ Newx(ret->offsets, 2*len+1, U32);
Copy(r->offsets, ret->offsets, 2*len+1, U32);
ret->precomp = SAVEPVN(r->precomp, r->prelen);
return ret;
/* create anew and remember what it is */
- Newz(0, ret, 1, GP);
+ Newxz(ret, 1, GP);
ptr_table_store(PL_ptr_table, gp, ret);
/* clone */
for (; mg; mg = mg->mg_moremagic) {
MAGIC *nmg;
- Newz(0, nmg, 1, MAGIC);
+ Newxz(nmg, 1, MAGIC);
if (mgprev)
mgprev->mg_moremagic = nmg;
else
Perl_ptr_table_new(pTHX)
{
PTR_TBL_t *tbl;
- Newz(0, tbl, 1, PTR_TBL_t);
+ Newxz(tbl, 1, PTR_TBL_t);
tbl->tbl_max = 511;
tbl->tbl_items = 0;
- Newz(0, tbl->tbl_ary, tbl->tbl_max + 1, PTR_TBL_ENT_t*);
+ Newxz(tbl->tbl_ary, tbl->tbl_max + 1, PTR_TBL_ENT_t*);
return tbl;
}
SSize_t items = AvFILLp((AV*)sstr) + 1;
src_ary = AvARRAY((AV*)sstr);
- Newz(0, dst_ary, AvMAX((AV*)sstr)+1, SV*);
+ Newxz(dst_ary, AvMAX((AV*)sstr)+1, SV*);
ptr_table_store(PL_ptr_table, src_ary, dst_ary);
SvPV_set(dstr, (char*)dst_ary);
AvALLOC((AV*)dstr) = dst_ary;
XPVHV * const dxhv = (XPVHV*)SvANY(dstr);
XPVHV * const sxhv = (XPVHV*)SvANY(sstr);
char *darray;
- New(0, darray,
- PERL_HV_ARRAY_ALLOC_BYTES(dxhv->xhv_max+1)
+ Newx(darray, PERL_HV_ARRAY_ALLOC_BYTES(dxhv->xhv_max+1)
+ (SvOOK(sstr) ? sizeof(struct xpvhv_aux) : 0),
char);
HvARRAY(dstr) = (HE**)darray;
return ncxs;
/* create anew and remember what it is */
- Newz(56, ncxs, max + 1, PERL_CONTEXT);
+ Newxz(ncxs, max + 1, PERL_CONTEXT);
ptr_table_store(PL_ptr_table, cxs, ncxs);
while (ix >= 0) {
return nsi;
/* create anew and remember what it is */
- Newz(56, nsi, 1, PERL_SI);
+ Newxz(nsi, 1, PERL_SI);
ptr_table_store(PL_ptr_table, si, nsi);
nsi->si_stack = av_dup_inc(si->si_stack, param);
void (*dptr) (void*);
void (*dxptr) (pTHX_ void*);
- Newz(54, nss, max, ANY);
+ Newxz(nss, max, ANY);
while (ix > 0) {
I32 i = POPINT(ss,ix);
/* interpreter atexit processing */
PL_exitlistlen = proto_perl->Iexitlistlen;
if (PL_exitlistlen) {
- New(0, PL_exitlist, PL_exitlistlen, PerlExitListEntry);
+ Newx(PL_exitlist, PL_exitlistlen, PerlExitListEntry);
Copy(proto_perl->Iexitlist, PL_exitlist, PL_exitlistlen, PerlExitListEntry);
}
else
PL_bitcount = Nullch; /* reinits on demand */
if (proto_perl->Ipsig_pend) {
- Newz(0, PL_psig_pend, SIG_SIZE, int);
+ Newxz(PL_psig_pend, SIG_SIZE, int);
}
else {
PL_psig_pend = (int*)NULL;
}
if (proto_perl->Ipsig_ptr) {
- Newz(0, PL_psig_ptr, SIG_SIZE, SV*);
- Newz(0, PL_psig_name, SIG_SIZE, SV*);
+ Newxz(PL_psig_ptr, SIG_SIZE, SV*);
+ Newxz(PL_psig_name, SIG_SIZE, SV*);
for (i = 1; i < SIG_SIZE; i++) {
PL_psig_ptr[i] = sv_dup_inc(proto_perl->Ipsig_ptr[i], param);
PL_psig_name[i] = sv_dup_inc(proto_perl->Ipsig_name[i], param);
PL_tmps_ix = proto_perl->Ttmps_ix;
PL_tmps_max = proto_perl->Ttmps_max;
PL_tmps_floor = proto_perl->Ttmps_floor;
- Newz(50, PL_tmps_stack, PL_tmps_max, SV*);
+ Newxz(PL_tmps_stack, PL_tmps_max, SV*);
i = 0;
while (i <= PL_tmps_ix) {
PL_tmps_stack[i] = sv_dup_inc(proto_perl->Ttmps_stack[i], param);
/* next PUSHMARK() sets *(PL_markstack_ptr+1) */
i = proto_perl->Tmarkstack_max - proto_perl->Tmarkstack;
- Newz(54, PL_markstack, i, I32);
+ Newxz(PL_markstack, i, I32);
PL_markstack_max = PL_markstack + (proto_perl->Tmarkstack_max
- proto_perl->Tmarkstack);
PL_markstack_ptr = PL_markstack + (proto_perl->Tmarkstack_ptr
* NOTE: unlike the others! */
PL_scopestack_ix = proto_perl->Tscopestack_ix;
PL_scopestack_max = proto_perl->Tscopestack_max;
- Newz(54, PL_scopestack, PL_scopestack_max, I32);
+ Newxz(PL_scopestack, PL_scopestack_max, I32);
Copy(proto_perl->Tscopestack, PL_scopestack, PL_scopestack_ix, I32);
/* NOTE: si_dup() looks at PL_markstack */
* NOTE: unlike the others! */
PL_savestack_ix = proto_perl->Tsavestack_ix;
PL_savestack_max = proto_perl->Tsavestack_max;
- /*Newz(54, PL_savestack, PL_savestack_max, ANY);*/
+ /*Newxz(PL_savestack, PL_savestack_max, ANY);*/
PL_savestack = ss_dup(proto_perl, param);
}
else {
PL_lex_defer = 0;
PL_expect = XSTATE;
PL_lex_brackets = 0;
- New(899, PL_lex_brackstack, 120, char);
- New(899, PL_lex_casestack, 12, char);
+ Newx(PL_lex_brackstack, 120, char);
+ Newx(PL_lex_casestack, 12, char);
PL_lex_casemods = 0;
*PL_lex_casestack = '\0';
PL_lex_dojoin = 0;
PL_lex_dojoin = FALSE;
PL_lex_brackets = 0;
- New(899, PL_lex_brackstack, 120, char);
- New(899, PL_lex_casestack, 12, char);
+ Newx(PL_lex_brackstack, 120, char);
+ Newx(PL_lex_casestack, 12, char);
PL_lex_casemods = 0;
*PL_lex_casestack = '\0';
PL_lex_starts = 0;
while (s < PL_bufend && isSPACE(*s))
s++;
if (s < PL_bufend) {
- Newz(899,newargv,PL_origargc+3,char*);
+ Newxz(newargv,PL_origargc+3,char*);
newargv[1] = s;
while (s < PL_bufend && !isSPACE(*s))
s++;
}
no_more:
- New(803, tbl, complement&&!del?258:256, short);
+ Newx(tbl, complement&&!del?258:256, short);
o = newPVOP(OP_TRANS, 0, (char*)tbl);
o->op_private &= ~OPpTRANS_ALL;
o->op_private |= del|squash|complement|
I32 newlen;
filter_add(utf16rev_textfilter, NULL);
- New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ Newx(news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
utf16_to_utf8_reversed(s, news,
PL_bufend - (char*)s - 1,
&newlen);
I32 newlen;
filter_add(utf16_textfilter, NULL);
- New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ Newx(news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
utf16_to_utf8(s, news,
PL_bufend - (char*)s,
&newlen);
if (count) {
U8* tmps;
I32 newlen;
- New(898, tmps, SvCUR(sv) * 3 / 2 + 1, U8);
+ Newx(tmps, SvCUR(sv) * 3 / 2 + 1, U8);
Copy(SvPVX_const(sv), tmps, old, char);
utf16_to_utf8((U8*)SvPVX_const(sv) + old, tmps + old,
SvCUR(sv) - old, &newlen);
if (count) {
U8* tmps;
I32 newlen;
- New(898, tmps, SvCUR(sv) * 3 / 2 + 1, U8);
+ Newx(tmps, SvCUR(sv) * 3 / 2 + 1, U8);
Copy(SvPVX_const(sv), tmps, old, char);
utf16_to_utf8((U8*)SvPVX_const(sv) + old, tmps + old,
SvCUR(sv) - old, &newlen);
*is_utf8 = 0;
- Newz(801, d, (*len) - count + 1, U8);
+ Newxz(d, (*len) - count + 1, U8);
s = start; start = d;
while (s < send) {
U8 c = *s++;
U8 *d;
U8 *dst;
- Newz(801, d, (*len) * 2 + 1, U8);
+ Newxz(d, (*len) * 2 + 1, U8);
dst = d;
while (s < send) {
else {
char *newaddr;
const STRLEN pvlen = strlen(pv)+1;
- New(902,newaddr,pvlen,char);
+ Newx(newaddr,pvlen,char);
return memcpy(newaddr,pv,pvlen);
}
{
register char *newaddr;
- New(903,newaddr,len+1,char);
+ Newx(newaddr,len+1,char);
/* Give a meaning to NULL pointer mainly for the use in sv_magic() */
if (pv) {
/* might not be null terminated */
register char *newaddr;
++len;
- New(903,newaddr,len,char);
+ Newx(newaddr,len,char);
return (char *) CopyD(pv,newaddr,len,char);
}
return PL_mess_sv;
/* Create as PVMG now, to avoid any upgrading later */
- New(905, sv, 1, SV);
- Newz(905, any, 1, XPVMG);
+ Newx(sv, 1, SV);
+ Newxz(any, 1, XPVMG);
SvFLAGS(sv) = SVt_PVMG;
SvANY(sv) = (void*)any;
SvPV_set(sv, 0);
val = "";
}
vlen = strlen(val);
- New(904, envstr, nlen+vlen+2, char);
+ Newx(envstr, nlen+vlen+2, char);
my_setenv_format(envstr, nam, nlen, val, vlen);
(void)PerlEnv_putenv(envstr);
Safefree(envstr);
} STMT_END;
#endif
buflen = 64;
- New(0, buf, buflen, char);
+ Newx(buf, buflen, char);
len = strftime(buf, buflen, fmt, &mytm);
/*
** The following is needed to handle to the situation where
const int fmtlen = strlen(fmt);
const int bufsize = fmtlen + buflen;
- New(0, buf, bufsize, char);
+ Newx(buf, bufsize, char);
while (buf) {
buflen = strftime(buf, bufsize, fmt, &mytm);
if (buflen > 0 && buflen < bufsize)
status = FAIL;
if (sp > mark)
{
- New(401,PL_Argv, sp - mark + 1, char*);
+ Newx(PL_Argv, sp - mark + 1, char*);
a = PL_Argv;
while (++mark <= sp)
{
}
}
- New(402,PL_Argv, (s - cmd) / 2 + 2, char*);
+ Newx(PL_Argv, (s - cmd) / 2 + 2, char*);
PL_Cmd = savepvn(cmd, s-cmd);
a = PL_Argv;
for (s = PL_Cmd; *s;)
Renew(__my_getenv_eqv,LNM$C_NAMLENGTH*midx+1,char);
}
else {
- New(1380,__my_getenv_eqv,LNM$C_NAMLENGTH*midx+1,char);
+ Newx(__my_getenv_eqv,LNM$C_NAMLENGTH*midx+1,char);
}
eqv = __my_getenv_eqv;
}
Renew(__my_getenv_len_eqv,LNM$C_NAMLENGTH*midx+1,char);
}
else {
- New(1381,__my_getenv_len_eqv,LNM$C_NAMLENGTH*midx+1,char);
+ Newx(__my_getenv_len_eqv,LNM$C_NAMLENGTH*midx+1,char);
}
buf = __my_getenv_len_eqv;
}
defflags &= ~CLI$M_TRUSTED;
} while (retsts == LIB$_INVARG && (flags | CLI$M_TRUSTED));
_ckvmssts(retsts);
- if (!buf) New(1322,buf,mbxbufsiz + 1,char);
+ if (!buf) Newx(buf,mbxbufsiz + 1,char);
if (seenhv) SvREFCNT_dec(seenhv);
seenhv = newHV();
while (1) {
nseg = PERL_LNM_MAX_ALLOWED_INDEX + 1;
}
- New(1382,ilist,nseg+1,struct itmlst_3);
+ Newx(ilist,nseg+1,struct itmlst_3);
ile = ilist;
if (!ile) {
set_errno(ENOMEM); set_vaxc_errno(SS$_INSFMEM);
if ((fp = tmpfile())) return fp;
- New(1323,cp,L_tmpnam+24,char);
+ Newx(cp,L_tmpnam+24,char);
strcpy(cp,"Sys$Scratch:");
tmpnam(cp+strlen(cp));
strcat(cp,".Perltmp");
unsigned int dviitm = DVI$_DEVBUFSIZ;
int j, n;
- New(1368, p, 1, Pipe);
+ Newx(p, 1, Pipe);
create_mbx(aTHX_ &p->chan_in , &d_mbx1);
create_mbx(aTHX_ &p->chan_out, &d_mbx2);
DSC$K_CLASS_S, mbx2};
unsigned int dviitm = DVI$_DEVBUFSIZ;
- New(1367, p, 1, Pipe);
+ Newx(p, 1, Pipe);
create_mbx(aTHX_ &p->chan_in , &d_mbx1);
create_mbx(aTHX_ &p->chan_out, &d_mbx2);
_ckvmssts(lib$getdvi(&dviitm, &p->chan_in, 0, &p->bufsize));
- New(1367, p->buf, p->bufsize, char);
+ Newx(p->buf, p->bufsize, char);
p->shut_on_empty = FALSE;
p->info = 0;
p->type = 0;
}
}
- New(1366, p, 1, Pipe);
+ Newx(p, 1, Pipe);
p->fd_out = dup(fd);
create_mbx(aTHX_ &p->chan_in, &d_mbx);
_ckvmssts(lib$getdvi(&dviitm, &p->chan_in, 0, &p->bufsize));
- New(1366, p->buf, p->bufsize+1, char);
+ Newx(p->buf, p->bufsize+1, char);
p->shut_on_empty = FALSE;
p->retry = 0;
p->info = 0;
/* the . directory from @INC comes last */
- New(1370,p,1,PLOC);
+ Newx(p,1,PLOC);
p->next = head_PLOC;
head_PLOC = p;
strcpy(p->dir,"./");
if (x) x[1] = '\0';
if ((unixdir = tounixpath(temp, Nullch)) != Nullch) {
- New(1370,p,1,PLOC);
+ Newx(p,1,PLOC);
p->next = head_PLOC;
head_PLOC = p;
strncpy(p->dir,unixdir,sizeof(p->dir)-1);
if ((unixdir = tounixpath(dir, Nullch)) == Nullch)
continue;
- New(1370,p,1,PLOC);
+ Newx(p,1,PLOC);
p->next = head_PLOC;
head_PLOC = p;
strncpy(p->dir,unixdir,sizeof(p->dir)-1);
#ifdef ARCHLIB_EXP
if ((unixdir = tounixpath(ARCHLIB_EXP, Nullch)) != Nullch) {
- New(1370,p,1,PLOC);
+ Newx(p,1,PLOC);
p->next = head_PLOC;
head_PLOC = p;
strncpy(p->dir,unixdir,sizeof(p->dir)-1);
*psts = sts;
return Nullfp;
}
- New(1301,info,1,Info);
+ Newx(info,1,Info);
strcpy(mode,in_mode);
info->mode = *mode;
return NULL;
}
if (!outbuf) {
- if (ts) out = New(1319,outbuf,NAM$C_MAXRSS+1,char);
+ if (ts) out = Newx(outbuf,NAM$C_MAXRSS+1,char);
else outbuf = __rmsexpand_retbuf;
}
if ((isunix = (strchr(filespec,'/') != NULL))) {
}
retlen = dirlen + (addmfd ? 13 : 6);
if (buf) retspec = buf;
- else if (ts) New(1309,retspec,retlen+1,char);
+ else if (ts) Newx(retspec,retlen+1,char);
else retspec = __fileify_retbuf;
if (addmfd) {
dirlen = lastdir - dir;
if (dirnam.nam$l_fnb & NAM$M_EXP_NAME) {
/* They provided at least the name; we added the type, if necessary, */
if (buf) retspec = buf; /* in sys$parse() */
- else if (ts) New(1311,retspec,dirnam.nam$b_esl+1,char);
+ else if (ts) Newx(retspec,dirnam.nam$b_esl+1,char);
else retspec = __fileify_retbuf;
strcpy(retspec,esa);
dirnam.nam$b_nop |= NAM$M_SYNCHK; dirnam.nam$l_rlf = NULL;
/* There's more than one directory in the path. Just roll back. */
*cp1 = term;
if (buf) retspec = buf;
- else if (ts) New(1311,retspec,retlen+7,char);
+ else if (ts) Newx(retspec,retlen+7,char);
else retspec = __fileify_retbuf;
strcpy(retspec,esa);
}
}
retlen = dirnam.nam$b_esl - 9; /* esa - '][' - '].DIR;1' */
if (buf) retspec = buf;
- else if (ts) New(1312,retspec,retlen+16,char);
+ else if (ts) Newx(retspec,retlen+16,char);
else retspec = __fileify_retbuf;
cp1 = strstr(esa,"][");
if (!cp1) cp1 = strstr(esa,"]<");
}
else { /* This is a top-level dir. Add the MFD to the path. */
if (buf) retspec = buf;
- else if (ts) New(1312,retspec,retlen+16,char);
+ else if (ts) Newx(retspec,retlen+16,char);
else retspec = __fileify_retbuf;
cp1 = esa;
cp2 = retspec;
/* Trap simple rooted lnms, and return lnm:[000000] */
if (!strcmp(trndir+trnlen-2,".]")) {
if (buf) retpath = buf;
- else if (ts) New(1318,retpath,strlen(dir)+10,char);
+ else if (ts) Newx(retpath,strlen(dir)+10,char);
else retpath = __pathify_retbuf;
strcpy(retpath,dir);
strcat(retpath,":[000000]");
}
}
if (buf) retpath = buf;
- else if (ts) New(1313,retpath,retlen+1,char);
+ else if (ts) Newx(retpath,retlen+1,char);
else retpath = __pathify_retbuf;
strncpy(retpath,dir,retlen-1);
if (retpath[retlen-2] != '/') { /* If the path doesn't already end */
dir[dirfab.fab$b_fns-1] == '>' ||
dir[dirfab.fab$b_fns-1] == ':') { /* It's already a VMS 'path' */
if (buf) retpath = buf;
- else if (ts) New(1314,retpath,strlen(dir)+1,char);
+ else if (ts) Newx(retpath,strlen(dir)+1,char);
else retpath = __pathify_retbuf;
strcpy(retpath,dir);
return retpath;
*(dirnam.nam$l_type + 1) = '\0';
retlen = dirnam.nam$l_type - esa + 2;
if (buf) retpath = buf;
- else if (ts) New(1314,retpath,retlen,char);
+ else if (ts) Newx(retpath,retlen,char);
else retpath = __pathify_retbuf;
strcpy(retpath,esa);
dirnam.nam$b_nop |= NAM$M_SYNCHK; dirnam.nam$l_rlf = NULL;
{ expand++; cp1 +=2; } /* VMS '...' ==> Unix '/.../' */
}
}
- New(1315,rslt,retlen+2+2*expand,char);
+ Newx(rslt,retlen+2+2*expand,char);
}
else rslt = __tounixspec_retbuf;
if (strchr(spec,'/') != NULL) {
if (path == NULL) return NULL;
if (buf) rslt = buf;
- else if (ts) New(1316,rslt,strlen(path)+9,char);
+ else if (ts) Newx(rslt,strlen(path)+9,char);
else rslt = __tovmsspec_retbuf;
if (strpbrk(path,"]:>") ||
(dirend = strrchr(path,'/')) == NULL) {
if (buf) return buf;
else if (ts) {
vmslen = strlen(vmsified);
- New(1317,cp,vmslen+1,char);
+ Newx(cp,vmslen+1,char);
memcpy(cp,vmsified,vmslen);
cp[vmslen] = '\0';
return cp;
if (buf) return buf;
else if (ts) {
unixlen = strlen(unixified);
- New(1317,cp,unixlen+1,char);
+ Newx(cp,unixlen+1,char);
memcpy(cp,unixified,unixlen);
cp[unixlen] = '\0';
return cp;
* Allocate and fill in the new argument vector, Some Unix's terminate
* the list with an extra null pointer.
*/
- New(1302, argv, item_count+1, char *);
+ Newx(argv, item_count+1, char *);
*av = argv;
for (j = 0; j < item_count; ++j, list_head = list_head->next)
argv[j] = list_head->value;
{
if (*head == 0)
{
- New(1303,*head,1,struct list_item);
+ Newx(*head,1,struct list_item);
*tail = *head;
}
else {
- New(1304,(*tail)->next,1,struct list_item);
+ Newx((*tail)->next,1,struct list_item);
*tail = (*tail)->next;
}
(*tail)->value = value;
char *string;
char *c;
- New(1305,string,resultspec.dsc$w_length+1,char);
+ Newx(string,resultspec.dsc$w_length+1,char);
strncpy(string, resultspec.dsc$a_pointer, resultspec.dsc$w_length);
string[resultspec.dsc$w_length] = '\0';
if (NULL == had_version)
exit(SS$_ABORT);
}
if (jpilist[1].bufadr != rlst) Safefree(jpilist[1].bufadr);
- jpilist[1].bufadr = New(1320,mask,rsz,unsigned long int);
+ jpilist[1].bufadr = Newx(mask,rsz,unsigned long int);
jpilist[1].buflen = rsz * sizeof(unsigned long int);
_ckvmssts_noperl(sys$getjpiw(0,NULL,NULL,&jpilist[1],iosb,NULL,NULL));
_ckvmssts_noperl(iosb[0]);
if (will_taint) {
char **newargv, **oldargv;
oldargv = *argvp;
- New(1320,newargv,(*argcp)+2,char *);
+ Newx(newargv,(*argcp)+2,char *);
newargv[0] = oldargv[0];
- New(1320,newargv[1],3,char);
+ Newx(newargv[1],3,char);
strcpy(newargv[1], "-T");
Copy(&oldargv[1],&newargv[2],(*argcp)-1,char **);
(*argcp)++;
for (tabidx = 0;
len = my_trnlnm("PERL_ENV_TABLES",eqv,tabidx);
tabidx++) {
- if (!tabidx) New(1321,tabvec,tabct,struct dsc$descriptor_s *);
+ if (!tabidx) Newx(tabvec,tabct,struct dsc$descriptor_s *);
else if (tabidx >= tabct) {
tabct += 8;
Renew(tabvec,tabct,struct dsc$descriptor_s *);
}
- New(1322,tabvec[tabidx],1,struct dsc$descriptor_s);
+ Newx(tabvec[tabidx],1,struct dsc$descriptor_s);
tabvec[tabidx]->dsc$w_length = 0;
tabvec[tabidx]->dsc$b_dtype = DSC$K_DTYPE_T;
tabvec[tabidx]->dsc$b_class = DSC$K_CLASS_D;
return NULL;
}
/* Get memory for the handle, and the pattern. */
- New(1306,dd,1,DIR);
- New(1307,dd->pattern,strlen(dir)+sizeof "*.*" + 1,char);
+ Newx(dd,1,DIR);
+ Newx(dd->pattern,strlen(dir)+sizeof "*.*" + 1,char);
/* Fill in the fields; mainly playing with the descriptor. */
(void)sprintf(dd->pattern, "%s*.*",dir);
dd->pat.dsc$b_dtype = DSC$K_DTYPE_T;
dd->pat.dsc$b_class = DSC$K_CLASS_S;
#if defined(USE_ITHREADS)
- New(1308,dd->mutex,1,perl_mutex);
+ Newx(dd->mutex,1,perl_mutex);
MUTEX_INIT( (perl_mutex *) dd->mutex );
#else
dd->mutex = NULL;
/* Add the version wildcard, ignoring the "*.*" put on before */
i = strlen(dd->pattern);
- New(1308,text,i + e->d_namlen + 3,char);
+ Newx(text,i + e->d_namlen + 3,char);
(void)strcpy(text, dd->pattern);
(void)sprintf(&text[i - 3], "%s;*", e->d_name);
cmdlen += rlen ? rlen + 1 : 0;
}
}
- New(401,PL_Cmd,cmdlen+1,char);
+ Newx(PL_Cmd,cmdlen+1,char);
if (tmps && *tmps) {
strcpy(PL_Cmd,tmps);
register char *s, *rest, *cp, *wordbreak;
register int isdcl;
- New(402,vmscmd,sizeof(struct dsc$descriptor_s),struct dsc$descriptor_s);
+ Newx(vmscmd,sizeof(struct dsc$descriptor_s),struct dsc$descriptor_s);
vmscmd->dsc$a_pointer = NULL;
vmscmd->dsc$b_dtype = DSC$K_DTYPE_T;
vmscmd->dsc$b_class = DSC$K_CLASS_S;
if (check_img && isdcl) return RMS$_FNF;
if (cando_by_name(S_IXUSR,0,resspec)) {
- New(402,vmscmd->dsc$a_pointer,7 + s - resspec + (rest ? strlen(rest) : 0),char);
+ Newx(vmscmd->dsc$a_pointer,7 + s - resspec + (rest ? strlen(rest) : 0),char);
if (!isdcl) {
strcpy(vmscmd->dsc$a_pointer,"$ MCR ");
if (suggest_quote) *suggest_quote = 1;
struct stat sbuf; /* native stat; we don't need flex_stat */
if (!sockflagsize || fdoff > sockflagsize) {
if (sockflags) Renew( sockflags,fdoff+2,unsigned int);
- else New (1324,sockflags,fdoff+2,unsigned int);
+ else Newx (sockflags,fdoff+2,unsigned int);
memset(sockflags+sockflagsize,0,fdoff + 2 - sockflagsize);
sockflagsize = fdoff + 2;
}
&usrprodsc.dsc$w_length,0));
/* allocate space for the profile and get it filled in */
- New(1330,usrprodsc.dsc$a_pointer,usrprodsc.dsc$w_length,char);
+ Newx(usrprodsc.dsc$a_pointer,usrprodsc.dsc$w_length,char);
_ckvmssts(sys$create_user_profile(&usrdsc,&usrprolst,0,usrprodsc.dsc$a_pointer,
&usrprodsc.dsc$w_length,0));
dTHX;
int length;
char* ptr;
- New(0, ptr, MAX_PATH+1, char);
+ Newx(ptr, MAX_PATH+1, char);
if(ptr) {
m_pvDir->GetCurrentDirectoryA(MAX_PATH+1, ptr);
length = strlen(ptr);
// add the additional space used by changes made to the environment
dwSize += CalculateEnvironmentSpace();
- New(1, lpStr, dwSize, char);
+ Newx(lpStr, dwSize, char);
lpPtr = lpStr;
if(lpStr != NULL) {
// build the local environment
int slen = strlen(str);
register char *ret;
register char **retv;
- New(1307, ret, slen+2, char);
- New(1308, retv, (slen+3)/2, char*);
+ Newx(ret, slen+2, char);
+ Newx(retv, (slen+3)/2, char*);
retstart = ret;
retvstart = retv;
return -1;
get_shell();
- New(1306, argv, (sp - mark) + w32_perlshell_items + 2, char*);
+ Newx(argv, (sp - mark) + w32_perlshell_items + 2, char*);
if (SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) {
++mark;
/* Save an extra exec if possible. See if there are shell
* metacharacters in it */
if (!has_shell_metachars(cmd)) {
- New(1301,argv, strlen(cmd) / 2 + 2, char*);
- New(1302,cmd2, strlen(cmd) + 1, char);
+ Newx(argv, strlen(cmd) / 2 + 2, char*);
+ Newx(cmd2, strlen(cmd) + 1, char);
strcpy(cmd2, cmd);
a = argv;
for (s = cmd2; *s;) {
char **argv;
int i = -1;
get_shell();
- New(1306, argv, w32_perlshell_items + 2, char*);
+ Newx(argv, w32_perlshell_items + 2, char*);
while (++i < w32_perlshell_items)
argv[i] = w32_perlshell_vec[i];
argv[i++] = cmd;
return NULL;
/* Get us a DIR structure */
- Newz(1303, dirp, 1, DIR);
+ Newxz(dirp, 1, DIR);
/* Create the search pattern */
strcpy(scanname, filename);
dirp->size = 128;
else
dirp->size = idx;
- New(1304, dirp->start, dirp->size, char);
+ Newx(dirp->start, dirp->size, char);
strcpy(dirp->start, ptr);
dirp->nfiles++;
dirp->end = dirp->curr = dirp->start;
if (name) {
if (USING_WIDE()) {
length = strlen(name)+1;
- New(1309,wCuritem,length,WCHAR);
+ Newx(wCuritem,length,WCHAR);
A2WHELPER(name, wCuritem, length*sizeof(WCHAR));
wVal = wcschr(wCuritem, '=');
if (wVal) {
Safefree(wCuritem);
}
else {
- New(1309,curitem,strlen(name)+1,char);
+ Newx(curitem,strlen(name)+1,char);
strcpy(curitem, name);
val = strchr(curitem, '=');
if (val) {
DEBUG_p(PerlIO_printf(Perl_debug_log, "\n"));
argc = index;
- New(1310, cmd, len, char);
+ Newx(cmd, len, char);
ptr = cmd;
if (bat_file && !IsWin95()) {
/* worst case: PATH is a single directory; we need additional space
* to append "/", ".exe" and trailing "\0" */
- New(0, fullcmd, (pathstr ? strlen(pathstr) : 0) + cmdlen + 6, char);
+ Newx(fullcmd, (pathstr ? strlen(pathstr) : 0) + cmdlen + 6, char);
curfullcmd = fullcmd;
while (1) {
GetCurrentDirectoryA(MAX_PATH+1, szfilename);
}
- New(0, ptr, strlen(szfilename)+1, char);
+ Newx(ptr, strlen(szfilename)+1, char);
strcpy(ptr, szfilename);
return ptr;
}
/* if command name contains dquotes, must remove them */
if (strchr(cname, '"')) {
cmd = cname;
- New(0,cname,clen+1,char);
+ Newx(cname,clen+1,char);
clen = 0;
while (*cmd) {
if (*cmd != '"') {
w32_perlshell_vec = (char**)NULL;
w32_perlshell_items = 0;
w32_fdpid = newAV();
- New(1313, w32_children, 1, child_tab);
+ Newx(w32_children, 1, child_tab);
w32_num_children = 0;
# ifdef USE_ITHREADS
w32_pseudo_id = 0;
- New(1313, w32_pseudo_children, 1, child_tab);
+ Newx(w32_pseudo_children, 1, child_tab);
w32_num_pseudo_children = 0;
# endif
w32_timerid = 0;
dst->perlshell_vec = (char**)NULL;
dst->perlshell_items = 0;
dst->fdpid = newAV();
- Newz(1313, dst->children, 1, child_tab);
+ Newxz(dst->children, 1, child_tab);
dst->pseudo_id = 0;
- Newz(1313, dst->pseudo_children, 1, child_tab);
+ Newxz(dst->pseudo_children, 1, child_tab);
dst->timerid = 0;
dst->poll_count = 0;
Copy(src->sigtable,dst->sigtable,SIG_SIZE,Sighandler_t);
if (lpwStr && argc) {
while (argc--) {
length = WideCharToMultiByte(CP_UTF8, 0, lpwStr[--wargc], -1, NULL, 0, NULL, NULL);
- Newz(0, psz, length, char);
+ Newxz(psz, length, char);
WideCharToMultiByte(CP_UTF8, 0, lpwStr[wargc], -1, psz, length, NULL, NULL);
argv[argc] = psz;
}
/*
* If we get here, then fd is actually a socket.
*/
- Newz(1310, fp, 1, FILE); /* XXX leak, good thing this code isn't used */
+ Newxz(fp, 1, FILE); /* XXX leak, good thing this code isn't used */
if(fp == NULL) {
errno = ENOMEM;
return NULL;
WSAPROTOCOL_INFOW *proto_buffers;
int protocols_available = 0;
- New(1, proto_buffers, proto_buffers_len / sizeof(WSAPROTOCOL_INFOW),
+ Newx(proto_buffers, proto_buffers_len / sizeof(WSAPROTOCOL_INFOW),
WSAPROTOCOL_INFOW);
if ((protocols_available = WSCEnumProtocols(NULL, proto_buffers,
dTHX;
int length;
char* ptr;
- New(0, ptr, MAX_PATH+1, char);
+ Newx(ptr, MAX_PATH+1, char);
if(ptr) {
m_pvDir->GetCurrentDirectoryA(MAX_PATH+1, ptr);
length = strlen(ptr);
// add the additional space used by changes made to the environment
dwSize += CalculateEnvironmentSpace();
- New(1, lpStr, dwSize, char);
+ Newx(lpStr, dwSize, char);
lpPtr = lpStr;
if(lpStr != NULL) {
// build the local environment
int slen = strlen(str);
register char *ret;
register char **retv;
- New(1307, ret, slen+2, char);
- New(1308, retv, (slen+3)/2, char*);
+ Newx(ret, slen+2, char);
+ Newx(retv, (slen+3)/2, char*);
retstart = ret;
retvstart = retv;
/* Save an extra exec if possible. See if there are shell
* metacharacters in it */
if (!has_shell_metachars(cmd)) {
- New(1301,argv, strlen(cmd) / 2 + 2, char*);
- New(1302,cmd2, strlen(cmd) + 1, char);
+ Newx(argv, strlen(cmd) / 2 + 2, char*);
+ Newx(cmd2, strlen(cmd) + 1, char);
strcpy(cmd2, cmd);
a = argv;
for (s = cmd2; *s;) {
char **argv;
int i = -1;
get_shell();
- New(1306, argv, w32_perlshell_items + 2, char*);
+ Newx(argv, w32_perlshell_items + 2, char*);
while (++i < w32_perlshell_items)
argv[i] = w32_perlshell_vec[i];
argv[i++] = cmd;
return NULL;
/* Get us a DIR structure */
- Newz(1303, dirp, 1, DIR);
+ Newxz(dirp, 1, DIR);
/* Create the search pattern */
strcpy(scanname, filename);
dirp->size = 128;
else
dirp->size = idx;
- New(1304, dirp->start, dirp->size, char);
+ Newx(dirp->start, dirp->size, char);
strcpy(dirp->start, ptr);
dirp->nfiles++;
dirp->end = dirp->curr = dirp->start;
DEBUG_p(PerlIO_printf(Perl_debug_log, "\n"));
argc = index;
- New(1310, cmd, len, char);
+ Newx(cmd, len, char);
ptr = cmd;
if (bat_file) {
/* look in PATH */
pathstr = PerlEnv_getenv("PATH");
- New(0, fullcmd, MAX_PATH+1, char);
+ Newx(fullcmd, MAX_PATH+1, char);
curfullcmd = fullcmd;
while (1) {
GetCurrentDirectoryA(MAX_PATH+1, szfilename);
}
- New(0, ptr, strlen(szfilename)+1, char);
+ Newx(ptr, strlen(szfilename)+1, char);
strcpy(ptr, szfilename);
return ptr;
}
/* if command name contains dquotes, must remove them */
if (strchr(cname, '"')) {
cmd = cname;
- New(0,cname,clen+1,char);
+ Newx(cname,clen+1,char);
clen = 0;
while (*cmd) {
if (*cmd != '"') {
w32_perlshell_tokens = Nullch;
w32_perlshell_items = -1;
w32_fdpid = newAV(); /* XX needs to be in Perl_win32_init()? */
- New(1313, w32_children, 1, child_tab);
+ Newx(w32_children, 1, child_tab);
w32_num_children = 0;
newXS("Win32::GetCwd", w32_GetCwd, file);
w32_perlshell_vec = (char**)NULL;
w32_perlshell_items = 0;
w32_fdpid = newAV();
- New(1313, w32_children, 1, child_tab);
+ Newx(w32_children, 1, child_tab);
w32_num_children = 0;
# ifdef USE_ITHREADS
w32_pseudo_id = 0;
- New(1313, w32_pseudo_children, 1, child_tab);
+ Newx(w32_pseudo_children, 1, child_tab);
w32_num_pseudo_children = 0;
# endif
w32_init_socktype = 0;
dst->perlshell_vec = (char**)NULL;
dst->perlshell_items = 0;
dst->fdpid = newAV();
- Newz(1313, dst->children, 1, child_tab);
+ Newxz(dst->children, 1, child_tab);
dst->pseudo_id = 0;
- Newz(1313, dst->pseudo_children, 1, child_tab);
+ Newxz(dst->pseudo_children, 1, child_tab);
dst->thr_intern.Winit_socktype = 0;
dst->timerid = 0;
dst->poll_count = 0;