Clarify docs for sv_usepvn_flags
authorFather Chrysostomos <sprout@cpan.org>
Sat, 3 Dec 2011 19:02:32 +0000 (11:02 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 4 Dec 2011 18:50:48 +0000 (10:50 -0800)
Note that the string must be the start of a mallocked block of memory,
and not a pointer to the middle of it.

sv.c

diff --git a/sv.c b/sv.c
index 0aebda2..ae97f1d 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -4606,7 +4606,9 @@ Perl_sv_sethek(pTHX_ register SV *const sv, const HEK *const hek)
 Tells an SV to use C<ptr> to find its string value.  Normally the
 string is stored inside the SV but sv_usepvn allows the SV to use an
 outside string.  The C<ptr> should point to memory that was allocated
-by C<malloc>.  The string length, C<len>, must be supplied.  By default
+by C<malloc>.  It must be the start of a mallocked block
+of memory, and not a pointer to the middle of it.  The
+string length, C<len>, must be supplied.  By default
 this function will realloc (i.e. move) the memory pointed to by C<ptr>,
 so that pointer should not be freed or used by the programmer after
 giving it to sv_usepvn, and neither should any pointers from "behind"