summaryrefslogtreecommitdiff
path: root/op.c
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 /op.c
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 'op.c')
-rw-r--r--op.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/op.c b/op.c
index acffe22457..ac9a41e9d2 100644
--- a/op.c
+++ b/op.c
@@ -717,7 +717,7 @@ S_cop_free(pTHX_ COP* cop)
CopSTASH_free(cop);
if (! specialWARN(cop->cop_warnings))
PerlMemShared_free(cop->cop_warnings);
- Perl_refcounted_he_free(aTHX_ cop->cop_hints_hash);
+ cophh_free(CopHINTHASH_get(cop));
}
STATIC void
@@ -3735,12 +3735,12 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
pmop->op_pmflags |= RXf_PMf_UNICODE;
}
if (PL_hints & HINT_RE_FLAGS) {
- SV *reflags = Perl_refcounted_he_fetch(aTHX_
- PL_compiling.cop_hints_hash, 0, STR_WITH_LEN("reflags"), 0, 0
+ SV *reflags = Perl_refcounted_he_fetch_pvn(aTHX_
+ PL_compiling.cop_hints_hash, STR_WITH_LEN("reflags"), 0, 0
);
if (reflags && SvOK(reflags)) pmop->op_pmflags |= SvIV(reflags);
- reflags = Perl_refcounted_he_fetch(aTHX_
- PL_compiling.cop_hints_hash, 0, STR_WITH_LEN("reflags_dul"), 0, 0
+ reflags = Perl_refcounted_he_fetch_pvn(aTHX_
+ PL_compiling.cop_hints_hash, STR_WITH_LEN("reflags_dul"), 0, 0
);
if (reflags && SvOK(reflags)) {
pmop->op_pmflags &= ~(RXf_PMf_LOCALE|RXf_PMf_UNICODE);
@@ -4798,12 +4798,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
CopHINTS and a possible value in cop_hints_hash, so no need to copy it.
*/
cop->cop_warnings = DUP_WARNINGS(PL_curcop->cop_warnings);
- cop->cop_hints_hash = PL_curcop->cop_hints_hash;
- if (cop->cop_hints_hash) {
- HINTS_REFCNT_LOCK;
- cop->cop_hints_hash->refcounted_he_refcnt++;
- HINTS_REFCNT_UNLOCK;
- }
+ CopHINTHASH_set(cop, cophh_copy(CopHINTHASH_get(PL_curcop)));
if (label) {
Perl_store_cop_label(aTHX_ cop, label, strlen(label), 0);