@@ -535,55 +535,46 @@ string C<p>, creating the package if necessary.
535
535
#define CopHINTHASH_set (c ,h ) ((c)->cop_hints_hash = (h))
536
536
537
537
/*
538
- =for apidoc Am|SV *|cop_hints_fetch_pvn|const COP *cop|const char *keypv|STRLEN keylen|U32 hash|U32 flags
538
+ =for apidoc Am|SV *|cop_hints_fetch_pvn|const COP *cop|const char *key|STRLEN keylen|U32 hash|U32 flags
539
+ =for apidoc_item|SV *|cop_hints_fetch_pv |const COP *cop|const char *key |U32 hash|U32 flags
540
+ =for apidoc_item|SV *|cop_hints_fetch_pvs|const COP *cop| "key" |U32 flags
541
+ =for apidoc_item|SV *|cop_hints_fetch_sv |const COP *cop| SV *key |U32 hash|U32 flags
539
542
540
- Look up the hint entry in the cop C<cop> with the key specified by
541
- C<keypv> and C<keylen>. If C<flags> has the C<COPHH_KEY_UTF8> bit set,
542
- the key octets are interpreted as UTF-8, otherwise they are interpreted
543
- as Latin-1. C<hash> is a precomputed hash of the key string, or zero if
544
- it has not been precomputed. Returns a mortal scalar copy of the value
545
- associated with the key, or C<&PL_sv_placeholder> if there is no value
546
- associated with the key.
547
-
548
- =cut
549
- */
543
+ These look up the hint entry in the cop C<cop> with the key specified by
544
+ C<key> (and C<keylen> in the C<pvn> form), returning that value as a mortal
545
+ scalar copy, or C<&PL_sv_placeholder> if there is no value associated with the
546
+ key.
550
547
551
- #define cop_hints_fetch_pvn (cop , keypv , keylen , hash , flags ) \
552
- cophh_fetch_pvn(CopHINTHASH_get(cop), keypv, keylen, hash, flags)
548
+ The forms differ in how the key is specified.
549
+ In the plain C<pv> form, the key is a C language NUL-terminated string.
550
+ In the C<pvs> form, the key is a C language string literal.
551
+ In the C<pvn> form, an additional parameter, C<keylen>, specifies the length of
552
+ the string, which hence, may contain embedded-NUL characters.
553
+ In the C<sv> form, C<*key> is an SV, and the key is the PV extracted from that.
554
+ using C<L</SvPV_const>>.
553
555
554
- /*
555
- =for apidoc Am|SV *|cop_hints_fetch_pvs|const COP *cop|"key"|U32 flags
556
+ C<hash> is a precomputed hash of the key string, or zero if it has not been
557
+ precomputed. This parameter is omitted from the C<pvs> form, as it is computed
558
+ automatically at compile time.
556
559
557
- Like L</cop_hints_fetch_pvn>, but takes a literal string
558
- instead of a string/length pair, and no precomputed hash.
560
+ The only flag currently used from the C<flags> parameter is C<COPHH_KEY_UTF8>.
561
+ It is illegal to set this in the C<sv> form. In the C<pv*> forms, it specifies
562
+ whether the key octets are interpreted as UTF-8 (if set) or as Latin-1 (if
563
+ cleared). The C<sv> form uses the underlying SV to determine the UTF-8ness of
564
+ the octets.
559
565
560
566
=cut
561
567
*/
562
568
569
+ #define cop_hints_fetch_pvn (cop , key , keylen , hash , flags ) \
570
+ cophh_fetch_pvn(CopHINTHASH_get(cop), key, keylen, hash, flags)
571
+
563
572
#define cop_hints_fetch_pvs (cop , key , flags ) \
564
573
cophh_fetch_pvs(CopHINTHASH_get(cop), key, flags)
565
574
566
- /*
567
- =for apidoc Am|SV *|cop_hints_fetch_pv|const COP *cop|const char *key|U32 hash|U32 flags
568
-
569
- Like L</cop_hints_fetch_pvn>, but takes a nul-terminated string instead
570
- of a string/length pair.
571
-
572
- =cut
573
- */
574
-
575
575
#define cop_hints_fetch_pv (cop , key , hash , flags ) \
576
576
cophh_fetch_pv(CopHINTHASH_get(cop), key, hash, flags)
577
577
578
- /*
579
- =for apidoc Am|SV *|cop_hints_fetch_sv|const COP *cop|SV *key|U32 hash|U32 flags
580
-
581
- Like L</cop_hints_fetch_pvn>, but takes a Perl scalar instead of a
582
- string/length pair.
583
-
584
- =cut
585
- */
586
-
587
578
#define cop_hints_fetch_sv (cop , key , hash , flags ) \
588
579
cophh_fetch_sv(CopHINTHASH_get(cop), key, hash, flags)
589
580
0 commit comments