summaryrefslogtreecommitdiff
path: root/scope.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 /scope.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 'scope.c')
-rw-r--r--scope.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/scope.c b/scope.c
index 0d07071e4b..9c1831cfcc 100644
--- a/scope.c
+++ b/scope.c
@@ -598,17 +598,12 @@ void
Perl_save_hints(pTHX)
{
dVAR;
- if (PL_compiling.cop_hints_hash) {
- HINTS_REFCNT_LOCK;
- PL_compiling.cop_hints_hash->refcounted_he_refcnt++;
- HINTS_REFCNT_UNLOCK;
- }
+ COPHH *save_cophh = cophh_copy(CopHINTHASH_get(&PL_compiling));
if (PL_hints & HINT_LOCALIZE_HH) {
- save_pushptri32ptr(GvHV(PL_hintgv), PL_hints,
- PL_compiling.cop_hints_hash, SAVEt_HINTS);
+ save_pushptri32ptr(GvHV(PL_hintgv), PL_hints, save_cophh, SAVEt_HINTS);
GvHV(PL_hintgv) = hv_copy_hints_hv(GvHV(PL_hintgv));
} else {
- save_pushi32ptr(PL_hints, PL_compiling.cop_hints_hash, SAVEt_HINTS);
+ save_pushi32ptr(PL_hints, save_cophh, SAVEt_HINTS);
}
}
@@ -1019,8 +1014,8 @@ Perl_leave_scope(pTHX_ I32 base)
SvREFCNT_dec(MUTABLE_SV(GvHV(PL_hintgv)));
GvHV(PL_hintgv) = NULL;
}
- Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints_hash);
- PL_compiling.cop_hints_hash = (struct refcounted_he *) SSPOPPTR;
+ cophh_free(CopHINTHASH_get(&PL_compiling));
+ CopHINTHASH_set(&PL_compiling, (COPHH*)SSPOPPTR);
*(I32*)&PL_hints = (I32)SSPOPINT;
if (PL_hints & HINT_LOCALIZE_HH) {
SvREFCNT_dec(MUTABLE_SV(GvHV(PL_hintgv)));