summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-03-07 15:29:28 -0700
committerKarl Williamson <khw@cpan.org>2019-03-12 10:01:30 -0600
commit83082a1983fd9a12e9f69740f60a1ce0897b68c8 (patch)
tree42d6564c5675832cda0fd56a8882865d2a60708f /hv.c
parenta3bc64163aa92603c939d88653090ec5e9aa2677 (diff)
downloadperl-83082a1983fd9a12e9f69740f60a1ce0897b68c8.tar.gz
perlapi: Clarify entry for hv_store()
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index fc90a5146b..1371b2f99a 100644
--- a/hv.c
+++ b/hv.c
@@ -260,7 +260,9 @@ if all your code does is create SVs then store them in a hash, C<hv_store>
will own the only reference to the new SV, and your code doesn't need to do
anything further to tidy up. Note that C<hv_store_ent> only reads the C<key>;
unlike C<val> it does not take ownership of it, so maintaining the correct
-reference count on C<key> is entirely the caller's responsibility. C<hv_store>
+reference count on C<key> is entirely the caller's responsibility. The reason
+it does not take ownership, is that C<key> is not used after this function
+returns, and so can be freed immediately. C<hv_store>
is not implemented as a call to C<hv_store_ent>, and does not create a temporary
SV for the key, so if your key data is not already in SV form then use
C<hv_store> in preference to C<hv_store_ent>.