summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-02 23:41:21 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-02 23:41:21 +0000
commit740cce10afff4bec3346f61ab3d0f7bfa424948c (patch)
tree83c031300e2326e8d8ae399e088c4d3a42472a13 /pod
parente350b669f3dadb9da757b62a20659cbc7eca2190 (diff)
downloadperl-740cce10afff4bec3346f61ab3d0f7bfa424948c.tar.gz
Add a new function newSVpvn_flags(), which takes a third parameter of
flag bits. Right now the only flag bit is SVf_UTF8, which will call SvUTF8_on() on the new SV for you. Provide a wrapper newSVpvn_utf8(), which takes a boolean, and passes in SVf_UTF8 if that is true. Refactor the core to use it where possible. It makes the source code clearer and smaller, but seems to be swings and roundabouts on object code size. p4raw-id: //depot/perl@32807
Diffstat (limited to 'pod')
-rw-r--r--pod/perlapi.pod30
1 files changed, 30 insertions, 0 deletions
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index df9572a87f..b7cb7b30d0 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -3918,6 +3918,17 @@ incremented.
=for hackers
Found in file sv.h
+=item newSVpvn_utf8
+X<newSVpvn_utf8>
+
+Creates a new SV and copies a string into it. If utf8 is true, calls
+C<SvUTF8_on> on the new SV. Implemented as a wrapper around C<newSVpvn_flags>.
+
+ SV* newSVpvn_utf8(NULLOK const char* s, STRLEN len, U32 utf8)
+
+=for hackers
+Found in file sv.h
+
=item SvCUR
X<SvCUR>
@@ -5137,6 +5148,25 @@ C<len> bytes long. If the C<s> argument is NULL the new SV will be undefined.
=for hackers
Found in file sv.c
+=item newSVpvn_flags
+X<newSVpvn_flags>
+
+Creates a new SV and copies a string into it. The reference count for the
+SV is set to 1. Note that if C<len> is zero, Perl will create a zero length
+string. You are responsible for ensuring that the source string is at least
+C<len> bytes long. If the C<s> argument is NULL the new SV will be undefined.
+Currently the only flag bit accepted is SVf_UTF8. If this is set, then it
+will be set on the new SV. C<newSVpvn_utf8()> is a convenience wrapper for
+this function, defined as
+
+ #define newSVpvn_utf8(s, len, u) \
+ newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0)
+
+ SV* newSVpvn_flags(const char* s, STRLEN len, U32 flags)
+
+=for hackers
+Found in file sv.c
+
=item newSVpvn_share
X<newSVpvn_share>