summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-10-20 22:21:42 -0600
committerKarl Williamson <khw@cpan.org>2015-12-22 13:16:51 -0700
commitdc6b097813c9fe5e64d21ab1f4a4b15db79eef09 (patch)
tree744e9ae23c3afba7881cddf8acdc02a8a54cf3c3
parent2863dafa090626922ead4c80d687c71c1a0afc55 (diff)
downloadperl-dc6b097813c9fe5e64d21ab1f4a4b15db79eef09.tar.gz
perlapi: Clarify 'string' vs. buffer
A string strictly is NUL terminated, but our terminology is lax
-rw-r--r--autodoc.pl5
-rw-r--r--handy.h45
2 files changed, 28 insertions, 22 deletions
diff --git a/autodoc.pl b/autodoc.pl
index 865ee08114..ff548fc96b 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -396,6 +396,11 @@ not part of the public API, and should not be used by extension writers at
all. For these reasons, blindly using functions listed in proto.h is to be
avoided when writing extensions.
+In Perl, unlike C, a string of characters may generally contain embedded
+C<NUL> characters. Sometimes in the documentation a Perl string is referred
+to as a "buffer" to distinguish it from a C string, but sometimes they are
+both just referred to as strings.
+
Note that all Perl API global variables must be referenced with the C<PL_>
prefix. Again, those not listed here are not to be used by extension writers,
and can be changed or removed without notice; same with macros.
diff --git a/handy.h b/handy.h
index 228662fdb7..60ec83c4b9 100644
--- a/handy.h
+++ b/handy.h
@@ -421,37 +421,38 @@ string/length pair.
=head1 Miscellaneous Functions
=for apidoc Am|bool|strNE|char* s1|char* s2
-Test two strings to see if they are different. Returns true or
-false.
+Test two C<NUL>-terminated strings to see if they are different. Returns true
+or false.
=for apidoc Am|bool|strEQ|char* s1|char* s2
-Test two strings to see if they are equal. Returns true or false.
+Test two C<NUL>-terminated strings to see if they are equal. Returns true or
+false.
=for apidoc Am|bool|strLT|char* s1|char* s2
-Test two strings to see if the first, C<s1>, is less than the second,
-C<s2>. Returns true or false.
+Test two C<NUL>-terminated strings to see if the first, C<s1>, is less than the
+second, C<s2>. Returns true or false.
=for apidoc Am|bool|strLE|char* s1|char* s2
-Test two strings to see if the first, C<s1>, is less than or equal to the
-second, C<s2>. Returns true or false.
+Test two C<NUL>-terminated strings to see if the first, C<s1>, is less than or
+equal to the second, C<s2>. Returns true or false.
=for apidoc Am|bool|strGT|char* s1|char* s2
-Test two strings to see if the first, C<s1>, is greater than the second,
-C<s2>. Returns true or false.
+Test two C<NUL>-terminated strings to see if the first, C<s1>, is greater than
+the second, C<s2>. Returns true or false.
=for apidoc Am|bool|strGE|char* s1|char* s2
-Test two strings to see if the first, C<s1>, is greater than or equal to
-the second, C<s2>. Returns true or false.
+Test two C<NUL>-terminated strings to see if the first, C<s1>, is greater than
+or equal to the second, C<s2>. Returns true or false.
=for apidoc Am|bool|strnNE|char* s1|char* s2|STRLEN len
-Test two strings to see if they are different. The C<len> parameter
-indicates the number of bytes to compare. Returns true or false. (A
+Test two C<NUL>-terminated strings to see if they are different. The C<len>
+parameter indicates the number of bytes to compare. Returns true or false. (A
wrapper for C<strncmp>).
=for apidoc Am|bool|strnEQ|char* s1|char* s2|STRLEN len
-Test two strings to see if they are equal. The C<len> parameter indicates
-the number of bytes to compare. Returns true or false. (A wrapper for
-C<strncmp>).
+Test two C<NUL>-terminated strings to see if they are equal. The C<len>
+parameter indicates the number of bytes to compare. Returns true or false. (A
+wrapper for C<strncmp>).
=for apidoc Am|bool|memEQ|char* s1|char* s2|STRLEN len
Test two buffers (which may contain embedded C<NUL> characters, to see if they
@@ -540,9 +541,9 @@ C<isWORDCHAR_uni(0x100)> returns TRUE, since 0x100 is LATIN CAPITAL LETTER A
WITH MACRON in Unicode, and is a word character.
Variant C<isFOO_utf8> is like C<isFOO_uni>, but the input is a pointer to a
-(known to be well-formed) UTF-8 encoded string (C<U8*> or C<char*>). The
-classification of just the first (possibly multi-byte) character in the string
-is tested.
+(known to be well-formed) UTF-8 encoded string (C<U8*> or C<char*>, and
+possibly containing embedded C<NUL> characters). The classification of just
+the first (possibly multi-byte) character in the string is tested.
Variant C<isFOO_LC> is like the C<isFOO_A> and C<isFOO_L1> variants, but the
result is based on the current locale, which is what C<LC> in the name stands
@@ -559,9 +560,9 @@ returns the same as C<isFOO_LC> for input code points less than 256, and
returns the hard-coded, not-affected-by-locale, Unicode results for larger ones.
Variant C<isFOO_LC_utf8> is like C<isFOO_LC_uvchr>, but the input is a pointer
-to a (known to be well-formed) UTF-8 encoded string (C<U8*> or C<char*>). The
-classification of just the first (possibly multi-byte) character in the string
-is tested.
+to a (known to be well-formed) UTF-8 encoded string (C<U8*> or C<char*>, and
+possibly containing embedded C<NUL> characters). The classification of just
+the first (possibly multi-byte) character in the string is tested.
=for apidoc Am|bool|isALPHA|char ch
Returns a boolean indicating whether the specified character is an