summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-14 15:34:03 +0100
committerNicholas Clark <nick@ccl4.org>2010-10-14 15:34:03 +0100
commit8dcfe2e99a72fe7951b4d15325e1541232823204 (patch)
tree7b0edba8780704e5b45a5650320f0f1489bb783b /universal.c
parent610f23459d57294735f494ba0a95e50f62231358 (diff)
downloadperl-8dcfe2e99a72fe7951b4d15325e1541232823204.tar.gz
Move remaining Tie::Hash::NamedCapture XS code to NamedCapture.xs
Now all the support code for %+ and %- is contained in the module in ext/
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c78
1 files changed, 0 insertions, 78 deletions
diff --git a/universal.c b/universal.c
index 194631830e..73910ea414 100644
--- a/universal.c
+++ b/universal.c
@@ -1254,78 +1254,6 @@ XS(XS_re_regexp_pattern)
/* NOT-REACHED */
}
-static void
-S_named_capture_common(pTHX_ CV *const cv, const bool fatal, const int expect,
- const bool discard, const U32 action)
-{
- dVAR;
- dXSARGS;
- REGEXP * rx;
- U32 flags;
- SV * ret;
-
- if (items != expect)
- croak_xs_usage(cv, expect == 2 ? "$key"
- : (expect == 3 ? "$key, $value" : ""));
-
- rx = PL_curpm ? PM_GETRE(PL_curpm) : NULL;
-
- if (!rx || !SvROK(ST(0))) {
- if (fatal)
- Perl_croak_no_modify(aTHX);
- else
- XSRETURN_UNDEF;
- }
-
- SP -= items;
- PUTBACK;
-
- flags = (U32)SvUV(SvRV(MUTABLE_SV(ST(0))));
- ret = RX_ENGINE(rx)->named_buff(aTHX_ (rx), expect >= 2 ? ST(1) : NULL,
- expect >= 3 ? ST(2) : NULL, flags | action);
-
- if (discard) {
- /* Called with G_DISCARD, so our return stack state is thrown away.
- Hence if we were returned anything, free it immediately. */
- SvREFCNT_dec(ret);
- XSRETURN_EMPTY;
- }
-
- SPAGAIN;
- PUSHs(ret ? sv_2mortal(ret) : &PL_sv_undef);
- XSRETURN(1);
-}
-
-XS(XS_Tie_Hash_NamedCapture_FETCH)
-{
- S_named_capture_common(aTHX_ cv, FALSE, 2, FALSE, RXapif_FETCH);
-}
-
-XS(XS_Tie_Hash_NamedCapture_STORE)
-{
- S_named_capture_common(aTHX_ cv, TRUE, 3, TRUE, RXapif_STORE);
-}
-
-XS(XS_Tie_Hash_NamedCapture_DELETE)
-{
- S_named_capture_common(aTHX_ cv, TRUE, 2, FALSE, RXapif_DELETE);
-}
-
-XS(XS_Tie_Hash_NamedCapture_CLEAR)
-{
- S_named_capture_common(aTHX_ cv, TRUE, 1, TRUE, RXapif_CLEAR);
-}
-
-XS(XS_Tie_Hash_NamedCapture_EXISTS)
-{
- S_named_capture_common(aTHX_ cv, FALSE, 2, FALSE, RXapif_EXISTS);
-}
-
-XS(XS_Tie_Hash_NamedCapture_SCALAR)
-{
- S_named_capture_common(aTHX_ cv, FALSE, 1, FALSE, RXapif_SCALAR);
-}
-
struct xsub_details {
const char *name;
XSUBADDR_t xsub;
@@ -1376,12 +1304,6 @@ struct xsub_details details[] = {
{"re::regnames", XS_re_regnames, ";$"},
{"re::regnames_count", XS_re_regnames_count, ""},
{"re::regexp_pattern", XS_re_regexp_pattern, "$"},
- {"Tie::Hash::NamedCapture::FETCH", XS_Tie_Hash_NamedCapture_FETCH, NULL},
- {"Tie::Hash::NamedCapture::STORE", XS_Tie_Hash_NamedCapture_STORE, NULL},
- {"Tie::Hash::NamedCapture::DELETE", XS_Tie_Hash_NamedCapture_DELETE, NULL},
- {"Tie::Hash::NamedCapture::CLEAR", XS_Tie_Hash_NamedCapture_CLEAR, NULL},
- {"Tie::Hash::NamedCapture::EXISTS", XS_Tie_Hash_NamedCapture_EXISTS, NULL},
- {"Tie::Hash::NamedCapture::SCALAR", XS_Tie_Hash_NamedCapture_SCALAR, NULL},
};
void