summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-05-04 17:09:22 -0600
committerSteve Hay <steve.m.hay@googlemail.com>2014-07-14 08:35:44 +0100
commit1e3aedaa69de1e929ce08528db89513f64f56e16 (patch)
treeafcf949239407863fa92e7ca988202feeb7ed6d1
parent5744525275a652cce23dc4fac599b19c74c9d83c (diff)
downloadperl-1e3aedaa69de1e929ce08528db89513f64f56e16.tar.gz
Wrap various pod uses of NUL with C<>
This makes the uses of this consistent in our pods. Also changed one use of the word 'buffer' into 'string', the latter being more appropriate. (cherry picked from commit 6602b93363649555eb1086b0efd043f7ffa7d0b5)
-rw-r--r--inline.h2
-rw-r--r--pod/perlguts.pod18
-rw-r--r--pod/perlvms.pod4
-rw-r--r--sv.c14
-rw-r--r--sv.h4
-rw-r--r--toke.c4
-rw-r--r--util.c16
7 files changed, 31 insertions, 31 deletions
diff --git a/inline.h b/inline.h
index 518d8da5e0..0fe8a0eee1 100644
--- a/inline.h
+++ b/inline.h
@@ -290,7 +290,7 @@ S_isALNUM_lazy(pTHX_ const char* p)
/*
=for apidoc AiR|bool|is_safe_syscall|const char *pv|STRLEN len|const char *what|const char *op_name
-Test that the given C<pv> doesn't contain any internal NUL characters.
+Test that the given C<pv> doesn't contain any internal C<NUL> characters.
If it does, set C<errno> to ENOENT, optionally warn, and return FALSE.
Return TRUE if the name is safe.
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 3fb5137ef8..5fe7e566dc 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -43,7 +43,7 @@ possible to have it point to other things For example, it could point
to an array of UVs. But,
using it for non-strings requires care, as the underlying assumption of
much of the internals is that PVs are just for strings. Often, for
-example, a trailing NUL is tacked on automatically. The non-string use
+example, a trailing C<NUL> is tacked on automatically. The non-string use
is documented only in this paragraph.)
The seven routines are:
@@ -63,7 +63,7 @@ any string that perl can handle.
In the unlikely case of a SV requiring more complex initialization, you
can create an empty SV with newSV(len). If C<len> is 0 an empty SV of
type NULL is returned, else an SV of type PV is returned with len + 1 (for
-the NUL) bytes of storage allocated, accessible via SvPVX. In both cases
+the C<NUL>) bytes of storage allocated, accessible via SvPVX. In both cases
the SV has the undef value.
SV *sv = newSV(0); /* no storage allocated */
@@ -87,7 +87,7 @@ assigned by using C<sv_setpvn>, C<newSVpvn>, or C<newSVpv>, or you may
allow Perl to calculate the length by using C<sv_setpv> or by specifying
0 as the second argument to C<newSVpv>. Be warned, though, that Perl will
determine the string's length by using C<strlen>, which depends on the
-string terminating with a NUL character, and not otherwise containing
+string terminating with a C<NUL> character, and not otherwise containing
NULs.
The arguments of C<sv_setpvf> are processed like C<sprintf>, and the
@@ -105,11 +105,11 @@ the format.
The C<sv_set*()> functions are not generic enough to operate on values
that have "magic". See L<Magic Virtual Tables> later in this document.
-All SVs that contain strings should be terminated with a NUL character.
-If it is not NUL-terminated there is a risk of
+All SVs that contain strings should be terminated with a C<NUL> character.
+If it is not C<NUL>-terminated there is a risk of
core dumps and corruptions from code which passes the string to C
-functions or system calls which expect a NUL-terminated string.
-Perl's own functions typically add a trailing NUL for this reason.
+functions or system calls which expect a C<NUL>-terminated string.
+Perl's own functions typically add a trailing C<NUL> for this reason.
Nevertheless, you should be very careful when you pass a string stored
in an SV to a C function or system call.
@@ -131,7 +131,7 @@ Historically the C<SvPV> macro with the global variable C<PL_na> has been
used in this case. But that can be quite inefficient because C<PL_na> must
be accessed in thread-local storage in threaded Perl. In any case, remember
that Perl allows arbitrary strings of data that may both contain NULs and
-might not be terminated by a NUL.
+might not be terminated by a C<NUL>.
Also remember that C doesn't allow you to safely say C<foo(SvPV(s, len),
len);>. It might work with your
@@ -156,7 +156,7 @@ Perl to allocate more memory for your SV, you can use the macro
which will determine if more memory needs to be allocated. If so, it will
call the function C<sv_grow>. Note that C<SvGROW> can only increase, not
decrease, the allocated memory of an SV and that it does not automatically
-add space for the trailing NUL byte (perl's own string functions typically do
+add space for the trailing C<NUL> byte (perl's own string functions typically do
C<SvGROW(sv, len + 1)>).
If you have an SV and want to know what kind of data Perl thinks is stored
diff --git a/pod/perlvms.pod b/pod/perlvms.pod
index 27178b7424..1cfb23153c 100644
--- a/pod/perlvms.pod
+++ b/pod/perlvms.pod
@@ -1001,8 +1001,8 @@ logical name to be created, it is defined in supervisor mode.
(The same is done if an existing logical name was defined in
executive or kernel mode; an existing user or supervisor mode
logical name is reset to the new value.) If the value is an empty
-string, the logical name's translation is defined as a single NUL
-(ASCII 00) character, since a logical name cannot translate to a
+string, the logical name's translation is defined as a single C<NUL>
+(ASCII C<\0>) character, since a logical name cannot translate to a
zero-length string. (This restriction does not apply to CLI symbols
or CRTL C<environ> values; they are set to the empty string.)
An element of the CRTL C<environ> array can be set only if your
diff --git a/sv.c b/sv.c
index b43fadfbd6..3841274db2 100644
--- a/sv.c
+++ b/sv.c
@@ -3287,9 +3287,9 @@ finds something that won't fit into a byte. Otherwise it tries to not upgrade
and just use bytes. But some things that do fit into a byte are variants in
utf8, and the caller may not have been keeping track of these.)
-If the routine itself changes the string, it adds a trailing NUL. Such a NUL
-isn't guaranteed due to having other routines do the work in some input cases,
-or if the input is already flagged as being in utf8.
+If the routine itself changes the string, it adds a trailing C<NUL>. Such a
+C<NUL> isn't guaranteed due to having other routines do the work in some input
+cases, or if the input is already flagged as being in utf8.
The speed of this could perhaps be improved for many cases if someone wanted to
write a fast function that counts the number of variant characters in a string,
@@ -4857,7 +4857,7 @@ giving it to sv_usepvn, and neither should any pointers from "behind"
that pointer (e.g. ptr + 1) be used.
If C<flags> & SV_SMAGIC is true, will call SvSETMAGIC. If C<flags> &
-SV_HAS_TRAILING_NUL is true, then C<ptr[len]> must be NUL, and the realloc
+SV_HAS_TRAILING_NUL is true, then C<ptr[len]> must be C<NUL>, and the realloc
will be skipped (i.e. the buffer is actually at least 1 byte longer than
C<len>, and already meets the requirements for storing in C<SvPVX>).
@@ -5419,7 +5419,7 @@ Perl_sv_catpv_mg(pTHX_ SV *const sv, const char *const ptr)
Creates a new SV. A non-zero C<len> parameter indicates the number of
bytes of preallocated string space the SV should have. An extra byte for a
-trailing NUL is also reserved. (SvPOK is not set for the SV even if string
+trailing C<NUL> is also reserved. (SvPOK is not set for the SV even if string
space is allocated.) The reference count for the new SV is set to 1.
In 5.9.3, newSV() replaces the older NEWSV() API, and drops the first
@@ -8961,7 +8961,7 @@ Perl_newSVpv(pTHX_ const char *const s, const STRLEN len)
/*
=for apidoc newSVpvn
-Creates a new SV and copies a buffer into it, which may contain NUL characters
+Creates a new SV and copies a string into it, which may contain C<NUL> characters
(C<\0>) and other binary data. The reference count for the SV is set to 1.
Note that if C<len> is zero, Perl will create a zero length (Perl) string. You
are responsible for ensuring that the source buffer is at least
@@ -9100,7 +9100,7 @@ Perl_newSVpvn_share(pTHX_ const char *src, I32 len, U32 hash)
/*
=for apidoc newSVpv_share
-Like C<newSVpvn_share>, but takes a nul-terminated string instead of a
+Like C<newSVpvn_share>, but takes a C<NUL>-terminated string instead of a
string/length pair.
=cut
diff --git a/sv.h b/sv.h
index 6332974f7c..003112c48d 100644
--- a/sv.h
+++ b/sv.h
@@ -773,7 +773,7 @@ attributable to C<SvOOK>. See C<SvCUR>.
=for apidoc Am|char*|SvEND|SV* sv
Returns a pointer to the spot just after the last character in
the string which is in the SV, where there is usually a trailing
-null (even though Perl scalars do not strictly require it).
+C<NUL> byte (even though Perl scalars do not strictly require it).
See C<SvCUR>. Access the character as *(SvEND(sv)).
Warning: If C<SvCUR> is equal to C<SvLEN>, then C<SvEND> points to
@@ -2044,7 +2044,7 @@ has been loaded.
=for apidoc Am|char *|SvGROW|SV* sv|STRLEN len
Expands the character buffer in the SV so that it has room for the
indicated number of bytes (remember to reserve space for an extra trailing
-NUL character). Calls C<sv_grow> to perform the expansion if necessary.
+C<NUL> character). Calls C<sv_grow> to perform the expansion if necessary.
Returns a pointer to the character
buffer. SV must be of type >= SVt_PV. One
alternative is to call C<sv_grow> if you are not sure of the type of SV.
diff --git a/toke.c b/toke.c
index ea88183201..0028b18b2f 100644
--- a/toke.c
+++ b/toke.c
@@ -869,7 +869,7 @@ through normal scalar means.
Direct pointer to the end of the chunk of text currently being lexed, the
end of the lexer buffer. This is equal to C<SvPVX(PL_parser-E<gt>linestr)
-+ SvCUR(PL_parser-E<gt>linestr)>. A NUL character (zero octet) is
++ SvCUR(PL_parser-E<gt>linestr)>. A C<NUL> character (zero octet) is
always located at the end of the buffer, and does not count as part of
the buffer's contents.
@@ -936,7 +936,7 @@ Perl_lex_bufutf8(pTHX)
=for apidoc Amx|char *|lex_grow_linestr|STRLEN len
Reallocates the lexer buffer (L</PL_parser-E<gt>linestr>) to accommodate
-at least I<len> octets (including terminating NUL). Returns a
+at least I<len> octets (including terminating C<NUL>). Returns a
pointer to the reallocated buffer. This is necessary before making
any direct modification of the buffer that would increase its length.
L</lex_stuff_pvn> provides a more convenient way to insert text into
diff --git a/util.c b/util.c
index 0a0ee40654..6c3102c1c9 100644
--- a/util.c
+++ b/util.c
@@ -1034,7 +1034,7 @@ Perl_savepv(pTHX_ const char *pv)
Perl's version of what C<strndup()> would be if it existed. Returns a
pointer to a newly allocated string which is a duplicate of the first
C<len> bytes from C<pv>, plus a trailing
-NUL byte. The memory allocated for
+C<NUL> byte. The memory allocated for
the new string can be freed with the C<Safefree()> function.
On some platforms, Windows for example, all allocated memory owned by a thread
@@ -5201,17 +5201,17 @@ Perl_xs_apiversion_bootcheck(pTHX_ SV *module, const char *api_p,
=for apidoc my_strlcat
The C library C<strlcat> if available, or a Perl implementation of it.
-This operates on C NUL-terminated strings.
+This operates on C C<NUL>-terminated strings.
C<my_strlcat()> appends string C<src> to the end of C<dst>. It will append at
-most S<C<size - strlen(dst) - 1>> characters. It will then NUL-terminate,
+most S<C<size - strlen(dst) - 1>> characters. It will then C<NUL>-terminate,
unless C<size> is 0 or the original C<dst> string was longer than C<size> (in
practice this should not happen as it means that either C<size> is incorrect or
-that C<dst> is not a proper NUL-terminated string).
+that C<dst> is not a proper C<NUL>-terminated string).
Note that C<size> is the full size of the destination buffer and
-the result is guaranteed to be NUL-terminated if there is room. Note that room
-for the NUL should be included in C<size>.
+the result is guaranteed to be C<NUL>-terminated if there is room. Note that
+room for the C<NUL> should be included in C<size>.
=cut
@@ -5239,10 +5239,10 @@ Perl_my_strlcat(char *dst, const char *src, Size_t size)
=for apidoc my_strlcpy
The C library C<strlcpy> if available, or a Perl implementation of it.
-This operates on C NUL-terminated strings.
+This operates on C C<NUL>-terminated strings.
C<my_strlcpy()> copies up to S<C<size - 1>> characters from the string C<src>
-to C<dst>, NUL-terminating the result if C<size> is not 0.
+to C<dst>, C<NUL>-terminating the result if C<size> is not 0.
=cut