summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NetWare/nw5.c10
-rw-r--r--av.c8
-rw-r--r--bytecode.pl2
-rw-r--r--cygwin/cygwin.c2
-rw-r--r--djgpp/djgpp.c2
-rw-r--r--doio.c6
-rw-r--r--doop.c12
-rw-r--r--dump.c2
-rw-r--r--ext/B/B/C.pm4
-rw-r--r--ext/B/C/C.xs2
-rw-r--r--ext/ByteLoader/bytecode.h4
-rw-r--r--ext/ByteLoader/byterun.c2
-rw-r--r--ext/Devel/DProf/DProf.xs2
-rw-r--r--ext/DynaLoader/dl_aix.xs4
-rw-r--r--ext/DynaLoader/dl_next.xs2
-rw-r--r--ext/DynaLoader/dl_vms.xs4
-rw-r--r--ext/File/Glob/bsd_glob.c6
-rw-r--r--ext/ODBM_File/ODBM_File.xs2
-rw-r--r--ext/Opcode/Opcode.xs2
-rw-r--r--ext/POSIX/POSIX.xs6
-rw-r--r--ext/Socket/Socket.xs2
-rw-r--r--ext/XS/Typemap/Typemap.xs2
-rw-r--r--gv.c14
-rw-r--r--handy.h22
-rw-r--r--hv.c28
-rw-r--r--locale.c2
-rw-r--r--op.c2
-rw-r--r--op.h2
-rw-r--r--os2/OS2/REXX/REXX.xs8
-rw-r--r--os2/os2.c22
-rw-r--r--perl.c16
-rw-r--r--perlio.c10
-rw-r--r--pod/perlapi.pod17
-rw-r--r--pp.c14
-rw-r--r--pp_ctl.c4
-rw-r--r--pp_pack.c8
-rw-r--r--pp_sort.c4
-rw-r--r--pp_sys.c4
-rw-r--r--reentr.c28
-rw-r--r--reentr.pl6
-rw-r--r--regcomp.c32
-rw-r--r--regexec.c6
-rw-r--r--scope.c6
-rw-r--r--sv.c67
-rw-r--r--toke.c20
-rw-r--r--utf8.c4
-rw-r--r--util.c16
-rw-r--r--vmesa/vmesa.c4
-rw-r--r--vms/vms.c94
-rw-r--r--win32/perlhost.h4
-rw-r--r--win32/win32.c38
-rw-r--r--win32/win32sck.c4
-rw-r--r--wince/perlhost.h4
-rw-r--r--wince/wince.c32
54 files changed, 322 insertions, 308 deletions
diff --git a/NetWare/nw5.c b/NetWare/nw5.c
index 397d41a205..aac80317d4 100644
--- a/NetWare/nw5.c
+++ b/NetWare/nw5.c
@@ -922,8 +922,8 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
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;
@@ -987,8 +987,8 @@ do_spawn2(char *cmd, int exectype)
/* 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;) {
@@ -1027,7 +1027,7 @@ do_spawn2(char *cmd, int exectype)
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;
diff --git a/av.c b/av.c
index 2c68efb357..1b540656ab 100644
--- a/av.c
+++ b/av.c
@@ -132,7 +132,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
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*));
@@ -154,7 +154,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
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 */
@@ -386,7 +386,7 @@ Perl_av_make(pTHX_ register I32 size, register SV **strp)
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;
@@ -409,7 +409,7 @@ Perl_av_fake(pTHX_ register I32 size, register SV **strp)
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);
diff --git a/bytecode.pl b/bytecode.pl
index bc527bb645..63b512070b 100644
--- a/bytecode.pl
+++ b/bytecode.pl
@@ -112,7 +112,7 @@ byterun(pTHX_ register struct byteloader_state *bstate)
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;
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c
index 18d4db5425..21f3b3437e 100644
--- a/cygwin/cygwin.c
+++ b/cygwin/cygwin.c
@@ -118,7 +118,7 @@ do_spawn (char *cmd)
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;) {
diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c
index d770cefb96..e2260d5ed6 100644
--- a/djgpp/djgpp.c
+++ b/djgpp/djgpp.c
@@ -193,7 +193,7 @@ doshell:
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;) {
diff --git a/doio.c b/doio.c
index c1b11d3e6c..e9b37ca98b 100644
--- a/doio.c
+++ b/doio.c
@@ -1459,7 +1459,7 @@ Perl_do_aexec5(pTHX_ SV *really, register SV **mark, register SV **sp,
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)
@@ -1605,7 +1605,7 @@ Perl_do_exec3(pTHX_ char *cmd, int fd, int do_report)
}
}
- 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;) {
@@ -2181,7 +2181,7 @@ Perl_do_semop(pTHX_ SV **mark, SV **sp)
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++;
diff --git a/doop.c b/doop.c
index 6ec3613082..3604b94b75 100644
--- a/doop.c
+++ b/doop.c
@@ -60,7 +60,7 @@ S_do_trans_simple(pTHX_ SV *sv)
/* 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;
@@ -190,7 +190,7 @@ S_do_trans_complex(pTHX_ SV *sv)
}
else { /* isutf8 */
if (grows)
- New(0, d, len*2+1, U8);
+ Newx(d, len*2+1, U8);
else
d = s;
dstart = d;
@@ -337,7 +337,7 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)
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;
}
@@ -477,7 +477,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv)
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;
}
@@ -1170,7 +1170,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
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;
@@ -1185,7 +1185,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
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() */
}
diff --git a/dump.c b/dump.c
index 9448df03da..ee65a629c2 100644
--- a/dump.c
+++ b/dump.c
@@ -1682,7 +1682,7 @@ S_debprof(pTHX_ const OP *o)
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];
}
diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm
index 51b357ef52..5c3c6ba84f 100644
--- a/ext/B/B/C.pm
+++ b/ext/B/B/C.pm
@@ -659,7 +659,7 @@ sub savepvn {
# 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, '';
@@ -1579,7 +1579,7 @@ EOT
#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";
diff --git a/ext/B/C/C.xs b/ext/B/C/C.xs
index 92e4ce535f..b7fb7fad5f 100644
--- a/ext/B/C/C.xs
+++ b/ext/B/C/C.xs
@@ -16,7 +16,7 @@ my_runops(pTHX)
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;
diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h
index 70a7238347..99ffd7f22d 100644
--- a/ext/ByteLoader/bytecode.h
+++ b/ext/ByteLoader/bytecode.h
@@ -31,7 +31,7 @@ typedef char *pvindex;
#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; \
@@ -63,7 +63,7 @@ typedef char *pvindex;
#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)
diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c
index 065a0299d7..7c62351946 100644
--- a/ext/ByteLoader/byterun.c
+++ b/ext/ByteLoader/byterun.c
@@ -54,7 +54,7 @@ byterun(pTHX_ register struct byteloader_state *bstate)
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;
diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs
index 39a604d920..f91e3c5c1b 100644
--- a/ext/Devel/DProf/DProf.xs
+++ b/ext/Devel/DProf/DProf.xs
@@ -738,7 +738,7 @@ BOOT:
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);
diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs
index 43e0c0307e..ea6de7b198 100644
--- a/ext/DynaLoader/dl_aix.xs
+++ b/ext/DynaLoader/dl_aix.xs
@@ -228,7 +228,7 @@ void *dlopen(char *path, int mode)
mp->refCnt++;
return mp;
}
- Newz(1000,mp,1,Module);
+ Newxz(mp,1,Module);
if (mp == NULL) {
dl_errvalid++;
strcpy(dl_errbuf, "Newz: ");
@@ -568,7 +568,7 @@ static int readExports(ModulePtr mp)
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: ");
diff --git a/ext/DynaLoader/dl_next.xs b/ext/DynaLoader/dl_next.xs
index 078d92c8e3..265800b2af 100644
--- a/ext/DynaLoader/dl_next.xs
+++ b/ext/DynaLoader/dl_next.xs
@@ -163,7 +163,7 @@ static void TransferError(NXStream *s)
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);
}
diff --git a/ext/DynaLoader/dl_vms.xs b/ext/DynaLoader/dl_vms.xs
index 03ddcb2441..4d2a93aca6 100644
--- a/ext/DynaLoader/dl_vms.xs
+++ b/ext/DynaLoader/dl_vms.xs
@@ -274,7 +274,7 @@ dl_load_file(filespec, flags)
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);
@@ -288,7 +288,7 @@ dl_load_file(filespec, flags)
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,
diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c
index 31d3aa45ac..78a8c647ec 100644
--- a/ext/File/Glob/bsd_glob.c
+++ b/ext/File/Glob/bsd_glob.c
@@ -332,7 +332,7 @@ bsd_glob(const char *pattern, int flags,
/* 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);
@@ -1009,7 +1009,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limitp)
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);
@@ -1030,7 +1030,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limitp)
;
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);
diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs
index 95dedfff9d..695d3927c9 100644
--- a/ext/ODBM_File/ODBM_File.xs
+++ b/ext/ODBM_File/ODBM_File.xs
@@ -92,7 +92,7 @@ odbm_TIEHASH(dbtype, filename, flags, mode)
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) {
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index 50c0a4f02c..a699ebfde4 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -510,7 +510,7 @@ opmask_add(opset)
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);
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 255be886bb..818e8618e2 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -586,7 +586,7 @@ new(packname = "POSIX::SigSet", ...)
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)));
@@ -631,7 +631,7 @@ new(packname = "POSIX::Termios", ...)
CODE:
{
#ifdef I_TERMIOS
- New(0, RETVAL, 1, struct termios);
+ Newx(RETVAL, 1, struct termios);
#else
not_here("termios");
RETVAL = 0;
@@ -1328,7 +1328,7 @@ sigaction(sig, optaction, oldaction = 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;
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
index 56443400f5..2650cac9a6 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -272,7 +272,7 @@ inet_ntoa(ip_address_sv)
* 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),
diff --git a/ext/XS/Typemap/Typemap.xs b/ext/XS/Typemap/Typemap.xs
index 853b4abd2b..3e448676f3 100644
--- a/ext/XS/Typemap/Typemap.xs
+++ b/ext/XS/Typemap/Typemap.xs
@@ -48,7 +48,7 @@ static intOpq xst_anintopq;
/* T_ARRAY - allocate some memory */
intArray * intArrayPtr( int nelem ) {
intArray * array;
- New(0, array, nelem, intArray);
+ Newx(array, nelem, intArray);
return array;
}
diff --git a/gv.c b/gv.c
index d1678d0c73..fd8367c4da 100644
--- a/gv.c
+++ b/gv.c
@@ -101,7 +101,7 @@ Perl_gv_fetchfile(pTHX_ const char *name)
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] = '<';
@@ -139,7 +139,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi)
} 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;
@@ -654,7 +654,7 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 create)
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++] = ':';
@@ -735,7 +735,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
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++] = ':';
@@ -948,9 +948,9 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
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);
diff --git a/handy.h b/handy.h
index 228490f5b7..d0366c3e3c 100644
--- a/handy.h
+++ b/handy.h
@@ -534,17 +534,22 @@ C<id> is an integer id between 0 and 1299 (used to identify leaks).
=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.
@@ -618,10 +623,15 @@ hopefully catches attempts to access uninitialized memory.
#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) \
diff --git a/hv.c b/hv.c
index 00aabc03a0..f1598cbee8 100644
--- a/hv.c
+++ b/hv.c
@@ -41,7 +41,7 @@ S_more_he(pTHX)
{
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;
@@ -94,7 +94,7 @@ S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags)
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;
@@ -163,7 +163,7 @@ Perl_he_dup(pTHX_ HE *e, bool shared, CLONE_PARAMS* param)
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));
}
@@ -464,7 +464,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
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;
@@ -609,7 +609,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
#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;
@@ -789,7 +789,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
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;
@@ -1155,7 +1155,7 @@ S_hsplit(pTHX_ HV *hv)
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;
@@ -1233,7 +1233,7 @@ S_hsplit(pTHX_ HV *hv)
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);
@@ -1325,7 +1325,7 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax)
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;
@@ -1347,7 +1347,7 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax)
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;
@@ -1419,7 +1419,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
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... */
@@ -1747,7 +1747,7 @@ S_hv_auxinit(pTHX_ HV *hv) {
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);
@@ -1962,7 +1962,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags)
/* 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;
@@ -2343,7 +2343,7 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
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);
diff --git a/locale.c b/locale.c
index 40d2a4415e..145bed79b3 100644
--- a/locale.c
+++ b/locale.c
@@ -570,7 +570,7 @@ Perl_mem_collxfrm(pTHX_ const char *s, STRLEN len, STRLEN *xlen)
/* 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;
diff --git a/op.c b/op.c
index b06267869f..4faa42e97b 100644
--- a/op.c
+++ b/op.c
@@ -2441,7 +2441,7 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
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) {
diff --git a/op.h b/op.h
index f949179c72..5a39d1e220 100644
--- a/op.h
+++ b/op.h
@@ -516,7 +516,7 @@ struct loop {
(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)
diff --git a/os2/OS2/REXX/REXX.xs b/os2/OS2/REXX/REXX.xs
index 43bdcac144..fb6ae2a9cf 100644
--- a/os2/OS2/REXX/REXX.xs
+++ b/os2/OS2/REXX/REXX.xs
@@ -80,7 +80,7 @@ exec_in_REXX_with(pTHX_ char *cmd, int c, char **handlerNames, RexxFunctionHandl
incompartment++;
if (c)
- Newz(728, subs, c, char);
+ Newxz(subs, c, char);
while (n--) {
rc = pRexxRegisterFunctionExe(handlerNames[n], handlers[n]);
if (rc == RXFUNC_DEFINED)
@@ -90,7 +90,7 @@ exec_in_REXX_with(pTHX_ char *cmd, int c, char **handlerNames, RexxFunctionHandl
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) {
@@ -553,8 +553,8 @@ _REXX_eval_with(cmd,...)
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);
diff --git a/os2/os2.c b/os2/os2.c
index 776031d17b..b81977e020 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -360,7 +360,7 @@ pthread_startit(void *arg1)
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) {
@@ -789,7 +789,7 @@ get_sysinfo(ULONG pid, ULONG flags)
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) {
@@ -1374,7 +1374,7 @@ do_spawn3(pTHX_ char *cmd, int execf, int flag)
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;
@@ -1447,7 +1447,7 @@ do_spawn3(pTHX_ char *cmd, int execf, int flag)
}
/* 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;) {
@@ -1481,7 +1481,7 @@ os2_aspawn4(pTHX_ SV *really, register SV **vmark, register SV **vsp, int execin
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))) {
@@ -4377,7 +4377,7 @@ check_emx_runtime(char **env, EXCEPTIONREGISTRATIONRECORD *preg)
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--) {
@@ -4436,10 +4436,10 @@ Perl_OS2_init3(char **env, void **preg, int flags)
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")) ) {
@@ -4447,7 +4447,7 @@ Perl_OS2_init3(char **env, void **preg, int flags)
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++) {
@@ -4567,7 +4567,7 @@ my_rmdir (__const__ char *s)
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--;
@@ -4592,7 +4592,7 @@ my_mkdir (__const__ char *s, long perm)
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--;
diff --git a/perl.c b/perl.c
index 4bafb31e30..e7796a44f9 100644
--- a/perl.c
+++ b/perl.c
@@ -1988,7 +1988,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
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 */
@@ -4315,22 +4315,22 @@ Perl_init_stacks(pTHX)
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);
}
@@ -4913,7 +4913,7 @@ S_init_main_thread(pTHX)
#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();
@@ -4923,8 +4923,8 @@ S_init_main_thread(pTHX)
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 */
diff --git a/perlio.c b/perlio.c
index e7d0b91085..2276f4c339 100644
--- a/perlio.c
+++ b/perlio.c
@@ -521,7 +521,7 @@ PerlIO_allocate(pTHX)
}
}
}
- Newz('I',f,PERLIO_TABLE_SIZE,PerlIO);
+ Newxz(f,PERLIO_TABLE_SIZE,PerlIO);
if (!f) {
return NULL;
}
@@ -571,7 +571,7 @@ PerlIO_list_t *
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;
}
@@ -603,7 +603,7 @@ PerlIO_list_push(pTHX_ PerlIO_list_t *list, PerlIO_funcs *funcs, SV *arg)
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;
@@ -1168,7 +1168,7 @@ PerlIO_push(pTHX_ PerlIO *f, PERLIO_FUNCS_DECL(*tab), const char *mode, SV *arg)
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;
@@ -3881,7 +3881,7 @@ PerlIOBuf_get_base(pTHX_ PerlIO *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);
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index 6b603bf774..b3deaf6238 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -1598,31 +1598,36 @@ optimise.
=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
diff --git a/pp.c b/pp.c
index 150daddb79..039aeba63b 100644
--- a/pp.c
+++ b/pp.c
@@ -642,8 +642,8 @@ PP(pp_study)
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;
@@ -807,7 +807,7 @@ PP(pp_undef)
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);
@@ -2424,7 +2424,7 @@ PP(pp_complement)
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);
@@ -2436,7 +2436,7 @@ PP(pp_complement)
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);
@@ -4199,7 +4199,7 @@ PP(pp_splice)
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*);
}
@@ -4259,7 +4259,7 @@ PP(pp_splice)
}
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*);
}
diff --git a/pp_ctl.c b/pp_ctl.c
index a0c7b08661..7460d775fe 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -314,7 +314,7 @@ Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx)
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;
@@ -3660,7 +3660,7 @@ S_doparseform(pTHX_ SV *sv)
s = base;
base = Nullch;
- New(804, fops, maxops, U32);
+ Newx(fops, maxops, U32);
fpc = fops;
if (s < send) {
diff --git a/pp_pack.c b/pp_pack.c
index a5e1c8e0f4..2bcb731f68 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1492,7 +1492,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
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]++;
@@ -2453,11 +2453,11 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) {
}
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;
@@ -3392,7 +3392,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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;
diff --git a/pp_sort.c b/pp_sort.c
index b605b02a08..9592edb323 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -375,7 +375,7 @@ S_mergesortsv(pTHX_ gptr *base, size_t nmemb, SVCOMPARE_t cmp, U32 flags)
}
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);
@@ -1358,7 +1358,7 @@ S_qsortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp, U32 flags)
/* 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++;
diff --git a/pp_sys.c b/pp_sys.c
index d05c547966..b126647d8b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1107,7 +1107,7 @@ PP(pp_sselect)
#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];
@@ -3725,7 +3725,7 @@ S_dooneliner(pTHX_ const char *cmd, const char *filename)
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; ) {
diff --git a/reentr.c b/reentr.c
index 9aa62bf3e5..0657791462 100644
--- a/reentr.c
+++ b/reentr.c
@@ -149,10 +149,10 @@ Perl_reentrant_size(pTHX) {
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
@@ -160,7 +160,7 @@ Perl_reentrant_init(pTHX) {
#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 */
@@ -168,42 +168,42 @@ Perl_reentrant_init(pTHX) {
# 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 */
@@ -218,15 +218,15 @@ Perl_reentrant_init(pTHX) {
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 */
diff --git a/reentr.pl b/reentr.pl
index a16f33c213..fd19d51cf7 100644
--- a/reentr.pl
+++ b/reentr.pl
@@ -349,7 +349,7 @@ sub pushssif {
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);
@@ -597,7 +597,7 @@ EOF
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;
@@ -812,7 +812,7 @@ Perl_reentrant_size(pTHX) {
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 */
diff --git a/regcomp.c b/regcomp.c
index 57f5834dea..eab68b337d 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -814,7 +814,7 @@ and would end up looking like:
} 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; \
@@ -846,10 +846,10 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
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();
@@ -968,7 +968,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
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;
@@ -1078,7 +1078,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
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;
@@ -1185,9 +1185,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
*/
- 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 ) ) {
@@ -2757,9 +2757,9 @@ S_add_data(pTHX_ RExC_state_t *pRExC_state, I32 n, const char *s)
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);
@@ -2872,7 +2872,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
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");
@@ -2895,7 +2895,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
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;
}
@@ -2934,7 +2934,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
/* 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... */
@@ -3113,7 +3113,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
{
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],
@@ -3169,7 +3169,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
{
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],
@@ -3193,8 +3193,8 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
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);
diff --git a/regexec.c b/regexec.c
index f705021616..f302259fcc 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2146,7 +2146,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos)
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);
@@ -2192,7 +2192,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos)
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
@@ -3554,7 +3554,7 @@ S_regmatch(pTHX_ regnode *prog)
}
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,
diff --git a/scope.c b/scope.c
index 04fbec1a7c..5ef74ecc3d 100644
--- a/scope.c
+++ b/scope.c
@@ -46,7 +46,7 @@ PERL_SI *
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);
@@ -57,7 +57,7 @@ Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
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);
@@ -254,7 +254,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty)
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 */
diff --git a/sv.c b/sv.c
index d92d82acb7..268cb3a3b4 100644
--- a/sv.c
+++ b/sv.c
@@ -230,7 +230,7 @@ S_more_sv(pTHX)
}
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);
@@ -1087,7 +1087,7 @@ S_more_bodies (pTHX_ void **arena_root, void **root, size_t size)
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;
@@ -3152,7 +3152,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
}
}
- 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);
@@ -4917,7 +4917,7 @@ Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtable,
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);
@@ -5868,7 +5868,7 @@ S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i,
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);
@@ -6190,7 +6190,7 @@ Perl_sv_pos_b2u(pTHX_ register SV* sv, I32* offsetp)
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);
@@ -6789,7 +6789,7 @@ thats_really_all_folks:
/*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];
@@ -9599,7 +9599,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
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';
}
@@ -9857,15 +9857,15 @@ Perl_re_dup(pTHX_ const REGEXP *r, CLONE_PARAMS *param)
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;
@@ -9879,9 +9879,9 @@ Perl_re_dup(pTHX_ const REGEXP *r, CLONE_PARAMS *param)
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++) {
@@ -9897,7 +9897,7 @@ Perl_re_dup(pTHX_ const REGEXP *r, CLONE_PARAMS *param)
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];
@@ -9928,7 +9928,7 @@ Perl_re_dup(pTHX_ const REGEXP *r, CLONE_PARAMS *param)
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);
@@ -10002,7 +10002,7 @@ Perl_gp_dup(pTHX_ GP *gp, CLONE_PARAMS* param)
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 */
@@ -10036,7 +10036,7 @@ Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS* param)
for (; mg; mg = mg->mg_moremagic) {
MAGIC *nmg;
- Newz(0, nmg, 1, MAGIC);
+ Newxz(nmg, 1, MAGIC);
if (mgprev)
mgprev->mg_moremagic = nmg;
else
@@ -10100,10 +10100,10 @@ PTR_TBL_t *
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;
}
@@ -10548,7 +10548,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param)
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;
@@ -10580,8 +10580,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param)
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;
@@ -10669,7 +10668,7 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
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) {
@@ -10759,7 +10758,7 @@ Perl_si_dup(pTHX_ PERL_SI *si, CLONE_PARAMS* param)
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);
@@ -10843,7 +10842,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* 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);
@@ -11533,7 +11532,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
/* 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
@@ -11750,15 +11749,15 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
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);
@@ -11776,7 +11775,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
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);
@@ -11785,7 +11784,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
/* 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
@@ -11797,7 +11796,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
* 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 */
@@ -11817,7 +11816,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
* 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 {
diff --git a/toke.c b/toke.c
index 22a975c134..9438a71fad 100644
--- a/toke.c
+++ b/toke.c
@@ -570,8 +570,8 @@ Perl_lex_start(pTHX_ SV *line)
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;
@@ -1206,8 +1206,8 @@ S_sublex_push(pTHX)
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;
@@ -2846,7 +2846,7 @@ Perl_yylex(pTHX)
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++;
@@ -9411,7 +9411,7 @@ S_scan_trans(pTHX_ char *start)
}
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|
@@ -10766,7 +10766,7 @@ S_swallow_bom(pTHX_ U8 *s)
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);
@@ -10792,7 +10792,7 @@ S_swallow_bom(pTHX_ U8 *s)
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);
@@ -10870,7 +10870,7 @@ utf16_textfilter(pTHX_ int idx, SV *sv, int maxlen)
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);
@@ -10891,7 +10891,7 @@ utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen)
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);
diff --git a/utf8.c b/utf8.c
index cdf24ce794..599edf1c09 100644
--- a/utf8.c
+++ b/utf8.c
@@ -857,7 +857,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8)
*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++;
@@ -893,7 +893,7 @@ Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len)
U8 *d;
U8 *dst;
- Newz(801, d, (*len) * 2 + 1, U8);
+ Newxz(d, (*len) * 2 + 1, U8);
dst = d;
while (s < send) {
diff --git a/util.c b/util.c
index 4c2d6640ef..8b51d21b62 100644
--- a/util.c
+++ b/util.c
@@ -764,7 +764,7 @@ Perl_savepv(pTHX_ const char *pv)
else {
char *newaddr;
const STRLEN pvlen = strlen(pv)+1;
- New(902,newaddr,pvlen,char);
+ Newx(newaddr,pvlen,char);
return memcpy(newaddr,pv,pvlen);
}
@@ -788,7 +788,7 @@ Perl_savepvn(pTHX_ const char *pv, register I32 len)
{
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 */
@@ -843,7 +843,7 @@ Perl_savesvpv(pTHX_ SV *sv)
register char *newaddr;
++len;
- New(903,newaddr,len,char);
+ Newx(newaddr,len,char);
return (char *) CopyD(pv,newaddr,len,char);
}
@@ -863,8 +863,8 @@ S_mess_alloc(pTHX)
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);
@@ -1528,7 +1528,7 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
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);
@@ -3634,7 +3634,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in
} 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
@@ -3657,7 +3657,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in
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)
diff --git a/vmesa/vmesa.c b/vmesa/vmesa.c
index 8bc733b5b7..7e3635f357 100644
--- a/vmesa/vmesa.c
+++ b/vmesa/vmesa.c
@@ -121,7 +121,7 @@ do_aspawn(SV* really, SV **mark, SV **sp)
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)
{
@@ -260,7 +260,7 @@ do_spawn(char *cmd, int execf)
}
}
- 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;)
diff --git a/vms/vms.c b/vms/vms.c
index e7687ac7ae..41c907be4e 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -359,7 +359,7 @@ Perl_my_getenv(pTHX_ const char *lnm, bool sys)
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;
}
@@ -444,7 +444,7 @@ Perl_my_getenv_len(pTHX_ const char *lnm, unsigned long *len, bool sys)
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;
}
@@ -612,7 +612,7 @@ prime_env_iter(void)
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) {
@@ -823,7 +823,7 @@ Perl_vmssetenv(pTHX_ const char *lnm, const char *eqv, struct dsc$descriptor_s *
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);
@@ -1190,7 +1190,7 @@ my_tmpfile(void)
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");
@@ -1757,7 +1757,7 @@ pipe_tochild_setup(pTHX_ char *rmbx, char *wmbx)
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);
@@ -1926,12 +1926,12 @@ pipe_infromchild_setup(pTHX_ char *rmbx, char *wmbx)
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;
@@ -2049,11 +2049,11 @@ pipe_mbxtofd_setup(pTHX_ int fd, char *out)
}
}
- 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;
@@ -2153,7 +2153,7 @@ store_pipelocs(pTHX)
/* 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,"./");
@@ -2170,7 +2170,7 @@ store_pipelocs(pTHX)
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);
@@ -2194,7 +2194,7 @@ store_pipelocs(pTHX)
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);
@@ -2205,7 +2205,7 @@ store_pipelocs(pTHX)
#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);
@@ -2438,7 +2438,7 @@ safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
*psts = sts;
return Nullfp;
}
- New(1301,info,1,Info);
+ Newx(info,1,Info);
strcpy(mode,in_mode);
info->mode = *mode;
@@ -2965,7 +2965,7 @@ mp_do_rmsexpand(pTHX_ char *filespec, char *outbuf, int ts, char *defspec, unsig
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))) {
@@ -3269,7 +3269,7 @@ static char *mp_do_fileify_dirspec(pTHX_ char *dir,char *buf,int ts)
}
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;
@@ -3353,7 +3353,7 @@ static char *mp_do_fileify_dirspec(pTHX_ char *dir,char *buf,int ts)
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;
@@ -3378,7 +3378,7 @@ static char *mp_do_fileify_dirspec(pTHX_ char *dir,char *buf,int ts)
/* 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);
}
@@ -3395,7 +3395,7 @@ static char *mp_do_fileify_dirspec(pTHX_ char *dir,char *buf,int ts)
}
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,"]<");
@@ -3424,7 +3424,7 @@ static char *mp_do_fileify_dirspec(pTHX_ char *dir,char *buf,int ts)
}
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;
@@ -3479,7 +3479,7 @@ static char *mp_do_pathify_dirspec(pTHX_ char *dir,char *buf, int ts)
/* 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]");
@@ -3519,7 +3519,7 @@ static char *mp_do_pathify_dirspec(pTHX_ char *dir,char *buf, int ts)
}
}
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 */
@@ -3564,7 +3564,7 @@ static char *mp_do_pathify_dirspec(pTHX_ char *dir,char *buf, int ts)
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;
@@ -3625,7 +3625,7 @@ static char *mp_do_pathify_dirspec(pTHX_ char *dir,char *buf, int ts)
*(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;
@@ -3667,7 +3667,7 @@ static char *mp_do_tounixspec(pTHX_ char *spec, char *buf, int ts)
{ 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) {
@@ -3786,7 +3786,7 @@ static char *mp_do_tovmsspec(pTHX_ char *path, char *buf, int ts) {
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) {
@@ -3933,7 +3933,7 @@ static char *mp_do_tovmspath(pTHX_ char *path, char *buf, int ts) {
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;
@@ -3962,7 +3962,7 @@ static char *mp_do_tounixpath(pTHX_ char *path, char *buf, int ts) {
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;
@@ -4180,7 +4180,7 @@ mp_getredirection(pTHX_ int *ac, char ***av)
* 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;
@@ -4275,11 +4275,11 @@ static void add_item(struct list_item **head,
{
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;
@@ -4352,7 +4352,7 @@ unsigned long int zero = 0, sts;
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)
@@ -4592,7 +4592,7 @@ vms_image_init(int *argcp, char ***argvp)
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]);
@@ -4616,9 +4616,9 @@ vms_image_init(int *argcp, char ***argvp)
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)++;
@@ -4645,12 +4645,12 @@ vms_image_init(int *argcp, char ***argvp)
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;
@@ -4881,8 +4881,8 @@ Perl_opendir(pTHX_ char *name)
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);
@@ -4894,7 +4894,7 @@ Perl_opendir(pTHX_ char *name)
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;
@@ -4950,7 +4950,7 @@ collectversions(pTHX_ DIR *dd)
/* 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);
@@ -5179,7 +5179,7 @@ setup_argstr(pTHX_ SV *really, SV **mark, SV **sp)
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);
@@ -5213,7 +5213,7 @@ setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote,
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;
@@ -5303,7 +5303,7 @@ setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote,
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;
@@ -5502,7 +5502,7 @@ FILE *my_fdopen(int fd, const char *mode)
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;
}
@@ -6836,7 +6836,7 @@ Perl_cando_by_name(pTHX_ I32 bit, Uid_t effective, char *fname)
&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));
diff --git a/win32/perlhost.h b/win32/perlhost.h
index e7963cc117..fcc3e0a5ac 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -2216,7 +2216,7 @@ CPerlHost::GetChildDir(void)
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);
@@ -2263,7 +2263,7 @@ CPerlHost::CreateLocalEnvironmentStrings(VDir &vDir)
// 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
diff --git a/win32/win32.c b/win32/win32.c
index 7423b0b8a2..86bf44ec40 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -472,8 +472,8 @@ tokenize(const char *str, char **dest, char ***destv)
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;
@@ -542,7 +542,7 @@ Perl_do_aspawn(pTHX_ SV *really, SV **mark, SV **sp)
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;
@@ -630,8 +630,8 @@ do_spawn2(pTHX_ char *cmd, int exectype)
/* 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;) {
@@ -668,7 +668,7 @@ do_spawn2(pTHX_ char *cmd, int exectype)
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;
@@ -756,7 +756,7 @@ win32_opendir(const char *filename)
return NULL;
/* Get us a DIR structure */
- Newz(1303, dirp, 1, DIR);
+ Newxz(dirp, 1, DIR);
/* Create the search pattern */
strcpy(scanname, filename);
@@ -817,7 +817,7 @@ win32_opendir(const char *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;
@@ -1481,7 +1481,7 @@ win32_putenv(const char *name)
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) {
@@ -1492,7 +1492,7 @@ win32_putenv(const char *name)
Safefree(wCuritem);
}
else {
- New(1309,curitem,strlen(name)+1,char);
+ Newx(curitem,strlen(name)+1,char);
strcpy(curitem, name);
val = strchr(curitem, '=');
if (val) {
@@ -3651,7 +3651,7 @@ create_command_line(char *cname, STRLEN clen, const char * const *args)
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()) {
@@ -3755,7 +3755,7 @@ qualified_path(const char *cmd)
/* 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) {
@@ -3870,7 +3870,7 @@ win32_get_childdir(void)
GetCurrentDirectoryA(MAX_PATH+1, szfilename);
}
- New(0, ptr, strlen(szfilename)+1, char);
+ Newx(ptr, strlen(szfilename)+1, char);
strcpy(ptr, szfilename);
return ptr;
}
@@ -3918,7 +3918,7 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
/* 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 != '"') {
@@ -5133,11 +5133,11 @@ Perl_sys_intern_init(pTHX)
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;
@@ -5190,9 +5190,9 @@ Perl_sys_intern_dup(pTHX_ struct interp_intern *src, struct interp_intern *dst)
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);
@@ -5220,7 +5220,7 @@ win32_argv2utf8(int argc, char** argv)
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;
}
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 051b442bd4..2795104b34 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -125,7 +125,7 @@ my_fdopen(int fd, char *mode)
/*
* 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;
@@ -413,7 +413,7 @@ open_ifs_socket(int af, int type, int protocol)
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,
diff --git a/wince/perlhost.h b/wince/perlhost.h
index a71f108e7a..2359464290 100644
--- a/wince/perlhost.h
+++ b/wince/perlhost.h
@@ -2228,7 +2228,7 @@ CPerlHost::GetChildDir(void)
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);
@@ -2275,7 +2275,7 @@ CPerlHost::CreateLocalEnvironmentStrings(VDir &vDir)
// 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
diff --git a/wince/wince.c b/wince/wince.c
index c73c4b82a4..e498f077c1 100644
--- a/wince/wince.c
+++ b/wince/wince.c
@@ -414,8 +414,8 @@ tokenize(const char *str, char **dest, char ***destv)
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;
@@ -541,8 +541,8 @@ do_spawn2(pTHX_ char *cmd, int exectype)
/* 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;) {
@@ -579,7 +579,7 @@ do_spawn2(pTHX_ char *cmd, int exectype)
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;
@@ -667,7 +667,7 @@ win32_opendir(const char *filename)
return NULL;
/* Get us a DIR structure */
- Newz(1303, dirp, 1, DIR);
+ Newxz(dirp, 1, DIR);
/* Create the search pattern */
strcpy(scanname, filename);
@@ -716,7 +716,7 @@ win32_opendir(const char *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;
@@ -1727,7 +1727,7 @@ create_command_line(char *cname, STRLEN clen, const char * const *args)
DEBUG_p(PerlIO_printf(Perl_debug_log, "\n"));
argc = index;
- New(1310, cmd, len, char);
+ Newx(cmd, len, char);
ptr = cmd;
if (bat_file) {
@@ -1828,7 +1828,7 @@ qualified_path(const char *cmd)
/* look in PATH */
pathstr = PerlEnv_getenv("PATH");
- New(0, fullcmd, MAX_PATH+1, char);
+ Newx(fullcmd, MAX_PATH+1, char);
curfullcmd = fullcmd;
while (1) {
@@ -1947,7 +1947,7 @@ win32_get_childdir(void)
GetCurrentDirectoryA(MAX_PATH+1, szfilename);
}
- New(0, ptr, strlen(szfilename)+1, char);
+ Newx(ptr, strlen(szfilename)+1, char);
strcpy(ptr, szfilename);
return ptr;
}
@@ -1994,7 +1994,7 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
/* 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 != '"') {
@@ -2625,7 +2625,7 @@ Perl_init_os_extras(void)
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);
@@ -2937,11 +2937,11 @@ Perl_sys_intern_init(pTHX)
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;
@@ -2974,9 +2974,9 @@ Perl_sys_intern_dup(pTHX_ struct interp_intern *src, struct interp_intern *dst)
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;