summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-10-19 09:31:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-10-21 05:55:28 -0700
commit20439bc77dfeec46d94a15cf108446039e26c995 (patch)
treeea8f1eb9a1f1003a110114977d660f97d96a5bc2 /hv.h
parent53d84487fbdd2060c1a666eacaef6e34ce4a1483 (diff)
downloadperl-20439bc77dfeec46d94a15cf108446039e26c995.tar.gz
full API for cop hint hashes
Expose cop hint hashes as a type COPHH, with a cophh_* API which is a macro layer over the refcounted_he_* API. The documentation for cophh_* describes purely API-visible behaviour, whereas the refcounted_he_* documentation describes the functions mainly in terms of the implementation. Revise the cop_hints_* API, using the flags parameter consistently and reimplementing in terms of cophh_*. Use the cophh_* and cop_hints_* functions consistently where appropriate. [Modified by the committer to update two calls to Perl_refcounted_he_fetch recently added to newPMOP.]
Diffstat (limited to 'hv.h')
-rw-r--r--hv.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/hv.h b/hv.h
index 83f90d9a52..6fa3252e7a 100644
--- a/hv.h
+++ b/hv.h
@@ -451,18 +451,11 @@ C<SV*>.
between threads (because it hangs from OPs, which are shared), hence the
alternate definition and mutex. */
-#define cop_hints_fetchsv(cop, keysv, hash) \
- Perl_cop_hints_fetchpvn(aTHX_ (cop), SvPV_nolen(keysv), SvCUR(keysv), \
- (SvUTF8(keysv) ? HVhek_UTF8 : 0), (hash))
-
-#define cop_hints_fetchpv(cop, key, flags, hash) \
- Perl_cop_hints_fetchpvn(aTHX_ (cop), key, strlen(key), (flags), (hash))
-
-#define cop_hints_fetchpvs(cop, key) \
- Perl_cop_hints_fetchpvn(aTHX_ (cop), STR_WITH_LEN(key), 0, 0)
-
struct refcounted_he;
+/* flags for the refcounted_he API */
+#define REFCOUNTED_HE_KEY_UTF8 0x00000001
+
#ifdef PERL_CORE
/* Gosh. This really isn't a good name any longer. */
@@ -486,6 +479,30 @@ struct refcounted_he {
char refcounted_he_data[1];
};
+/*
+=for apidoc m|SV *|refcounted_he_fetch_pvs|const struct refcounted_he *chain|const char *key|U32 flags
+
+Like L</refcounted_he_fetch_pvn>, but takes a literal string instead of
+a string/length pair, and no precomputed hash.
+
+=cut
+*/
+
+#define refcounted_he_fetch_pvs(chain, key, flags) \
+ Perl_refcounted_he_fetch_pvn(aTHX_ chain, STR_WITH_LEN(key), 0, flags)
+
+/*
+=for apidoc m|struct refcounted_he *|refcounted_he_new_pvs|struct refcounted_he *parent|const char *key|SV *value|U32 flags
+
+Like L</refcounted_he_new_pvn>, but takes a literal string instead of
+a string/length pair, and no precomputed hash.
+
+=cut
+*/
+
+#define refcounted_he_new_pvs(parent, key, value, flags) \
+ Perl_refcounted_he_new_pvn(aTHX_ parent, STR_WITH_LEN(key), 0, value, flags)
+
/* Flag bits are HVhek_UTF8, HVhek_WASUTF8, then */
#define HVrhek_undef 0x00 /* Value is undef. */
#define HVrhek_delete 0x10 /* Value is placeholder - signifies delete. */