diff options
author | Steve Hay <SteveHay@planit.com> | 2005-07-12 08:17:47 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2005-07-12 08:17:47 +0000 |
commit | 9f653bb54868b8547466924d4ce483acb8987efb (patch) | |
tree | c335772e50d2eb91b883f81f1636d76603814bb2 /pod | |
parent | c5008215525f2f0a2a10a4c6a997f4cccfb6d09b (diff) | |
download | perl-9f653bb54868b8547466924d4ce483acb8987efb.tar.gz |
Change New*() to Newx*() in various comments and documentation
p4raw-id: //depot/perl@25116
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlclib.pod | 6 | ||||
-rw-r--r-- | pod/perlguts.pod | 19 | ||||
-rw-r--r-- | pod/perlhack.pod | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/pod/perlclib.pod b/pod/perlclib.pod index e89a67a140..837a36da67 100644 --- a/pod/perlclib.pod +++ b/pod/perlclib.pod @@ -99,8 +99,8 @@ There is no equivalent to C<fgets>; one should use C<sv_gets> instead: Instead Of: Use: - t* p = malloc(n) New(id, p, n, t) - t* p = calloc(n, s) Newz(id, p, n, t) + t* p = malloc(n) Newx(id, p, n, t) + t* p = calloc(n, s) Newxz(id, p, n, t) p = realloc(p, n) Renew(p, n, t) memcpy(dst, src, n) Copy(src, dst, n, t) memmove(dst, src, n) Move(src, dst, n, t) @@ -132,7 +132,7 @@ instead of raw C<char *> strings: Note also the existence of C<sv_catpvf> and C<sv_vcatpvfn>, combining concatenation with formatting. -Sometimes instead of zeroing the allocated heap by using Newz() you +Sometimes instead of zeroing the allocated heap by using Newxz() you should consider "poisoning" the data. This means writing a bit pattern into it that should be illegal as pointers (and floating point numbers), and also hopefully surprising enough as integers, so that diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 34c64126cc..82910c00f7 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1490,25 +1490,20 @@ platforms, it may cause spurious malloc or free errors. The following three macros are used to initially allocate memory : - New(x, pointer, number, type); - Newc(x, pointer, number, type, cast); - Newz(x, pointer, number, type); + Newx(pointer, number, type); + Newxc(pointer, number, type, cast); + Newxz(pointer, number, type); -The first argument C<x> was a "magic cookie" that was used to keep track -of who called the macro, to help when debugging memory problems. However, -the current code makes no use of this feature (most Perl developers now -use run-time memory checkers), so this argument can be any number. - -The second argument C<pointer> should be the name of a variable that will +The first argument C<pointer> should be the name of a variable that will point to the newly allocated memory. -The third and fourth arguments C<number> and C<type> specify how many of +The second and third arguments C<number> and C<type> specify how many of the specified type of data structure should be allocated. The argument -C<type> is passed to C<sizeof>. The final argument to C<Newc>, C<cast>, +C<type> is passed to C<sizeof>. The final argument to C<Newxc>, C<cast>, should be used if the C<pointer> argument is different from the C<type> argument. -Unlike the C<New> and C<Newc> macros, the C<Newz> macro calls C<memzero> +Unlike the C<Newx> and C<Newxc> macros, the C<Newxz> macro calls C<memzero> to zero out all the newly allocated memory. =head3 Reallocation diff --git a/pod/perlhack.pod b/pod/perlhack.pod index 31dab0e9f5..f797851bef 100644 --- a/pod/perlhack.pod +++ b/pod/perlhack.pod @@ -2470,7 +2470,7 @@ your favourite debugger to discover where those pesky SVs were allocated. =head2 PERL_MEM_LOG -If compiled with C<-DPERL_MEM_LOG>, all New() and Renew() allocations +If compiled with C<-DPERL_MEM_LOG>, all Newx() and Renew() allocations and Safefree() in the Perl core go through logging functions, which is handy for breakpoint setting. If also compiled with C<-DPERL_MEM_LOG_STDERR>, the allocations and frees are logged to STDERR in these logging functions, |