-static int a_clear_loaded_locked(pTHX_ void *cxt) {
-#define a_clear_loaded_locked(C) a_clear_loaded_locked(aTHX_ (C))
- int global_teardown = 0;
-
- if (a_loaded > 1) {
- assert(a_loaded_cxts);
- ptable_loaded_delete(a_loaded_cxts, cxt);
- --a_loaded;
- } else if (a_loaded_cxts) {
- assert(a_loaded == 1);
- ptable_loaded_free(a_loaded_cxts);
- a_loaded_cxts = NULL;
- a_loaded = 0;
- global_teardown = 1;
- }
-
- return global_teardown;
-}
-
-#else
-
-#define a_is_loaded(C) (a_loaded > 0)
-#define a_set_loaded_locked(C) ((a_loaded++ <= 0) ? 1 : 0)
-#define a_clear_loaded_locked(C) ((--a_loaded <= 0) ? 1 : 0)
-
-#endif
-
-/* ... Thread-safe hints ................................................... */
-
-#if A_WORKAROUND_REQUIRE_PROPAGATION
-
-typedef struct {
- U32 bits;
- IV require_tag;
-} a_hint_t;
-
-#define A_HINT_FREE(H) PerlMemShared_free(H)
-
-#if A_THREADSAFE
-
-#define PTABLE_NAME ptable_hints
-#define PTABLE_VAL_FREE(V) A_HINT_FREE(V)
-#define PTABLE_NEED_DELETE 0
-#define PTABLE_NEED_WALK 1
-
-#define pPTBL pTHX
-#define pPTBL_ pTHX_
-#define aPTBL aTHX
-#define aPTBL_ aTHX_
-
-#include "ptable.h"
-
-#define ptable_hints_store(T, K, V) ptable_hints_store(aTHX_ (T), (K), (V))
-#define ptable_hints_free(T) ptable_hints_free(aTHX_ (T))
-
-#endif /* A_THREADSAFE */
-
-#endif /* A_WORKAROUND_REQUIRE_PROPAGATION */
-
-#define PTABLE_NAME ptable_seen
-#define PTABLE_NEED_DELETE 0
-#define PTABLE_NEED_WALK 0
-
-#include "ptable.h"
-
-/* PerlMemShared_free() needs the [ap]PTBLMS_? default values */
-#define ptable_seen_store(T, K, V) ptable_seen_store(aPTBLMS_ (T), (K), (V))
-#define ptable_seen_clear(T) ptable_seen_clear(aPTBLMS_ (T))
-#define ptable_seen_free(T) ptable_seen_free(aPTBLMS_ (T))
-
-#define MY_CXT_KEY __PACKAGE__ "::_guts" XS_VERSION
-
-typedef struct {
- peep_t old_peep; /* This is actually the rpeep past 5.13.5 */
- ptable *seen; /* It really is a ptable_seen */
-#if A_THREADSAFE && A_WORKAROUND_REQUIRE_PROPAGATION
- ptable *tbl; /* It really is a ptable_hints */
- tTHX owner;
-#endif /* A_THREADSAFE && A_WORKAROUND_REQUIRE_PROPAGATION */
-} my_cxt_t;
-
-START_MY_CXT
-
-#if A_WORKAROUND_REQUIRE_PROPAGATION
-
-#if A_THREADSAFE
-
-typedef struct {
- ptable *tbl;
-#if A_HAS_PERL(5, 13, 2)
- CLONE_PARAMS *params;
-#else
- CLONE_PARAMS params;
-#endif
-} a_ptable_clone_ud;
-
-#if A_HAS_PERL(5, 13, 2)
-# define a_ptable_clone_ud_init(U, T, O) \
- (U).tbl = (T); \
- (U).params = Perl_clone_params_new((O), aTHX)
-# define a_ptable_clone_ud_deinit(U) Perl_clone_params_del((U).params)
-# define a_dup_inc(S, U) SvREFCNT_inc(sv_dup((S), (U)->params))
-#else
-# define a_ptable_clone_ud_init(U, T, O) \
- (U).tbl = (T); \
- (U).params.stashes = newAV(); \
- (U).params.flags = 0; \
- (U).params.proto_perl = (O)
-# define a_ptable_clone_ud_deinit(U) SvREFCNT_dec((U).params.stashes)
-# define a_dup_inc(S, U) SvREFCNT_inc(sv_dup((S), &((U)->params)))
-#endif