diff --git a/handy.h b/handy.h index 41764ac6bf3e..45824c615d07 100644 --- a/handy.h +++ b/handy.h @@ -407,13 +407,6 @@ string/length pair. Like C, but takes a literal string instead of a string/length pair. -=for apidoc_section $HV - -=for apidoc Am|SV**|hv_fetchs|HV* tb|"key"|I32 lval -Like C, but takes a literal string instead of a -string/length pair. -=for apidoc_section $lexer - =cut */ diff --git a/hv.c b/hv.c index 980fb0cf218f..9dd56add7819 100644 --- a/hv.c +++ b/hv.c @@ -416,10 +416,11 @@ In C, the key is specified by the SV C; its UTF8ness is the same as that SV. There is an additional parameter, C, which can be a valid precomputed hash value, or 0 to ask for it to be computed. -=for apidoc hv_fetch -=for apidoc_item ||hv_fetchs|HV *hv|"key"|I32 lval +=for apidoc hv_fetch +=for apidoc_item hv_fetchs -These return the SV which corresponds to the specified key in the hash. +These each return the SV which corresponds to the specified key in the hash. +They differ only in how the key is specified. In C, the key must be a C language string literal, enclosed in double quotes. It is never treated as being in UTF-8. There is no @@ -427,6 +428,7 @@ length_parameter. In C, the absolute value of C is the length of the key. If C is negative the key is assumed to be in UTF-8-encoded Unicode. +C may contain embedded NUL characters. In both, if C is set, then the fetch will be part of a store. This means that if there is no value in the hash associated with the given key, then one diff --git a/hv.h b/hv.h index ef659c0603bd..b1712ce289a9 100644 --- a/hv.h +++ b/hv.h @@ -557,6 +557,10 @@ whether it is valid to call C. #define hv_existss(hv, key) \ hv_exists((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1)) +/* +=for apidoc_defn Am|SV**|hv_fetchs|HV* hv|"key"|I32 lval +=cut +*/ #define hv_fetchs(hv, key, lval) \ hv_fetch((hv), ASSERT_IS_LITERAL(key), (sizeof(key)-1), (lval))