summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-04-25 00:56:32 +0100
committerDavid Mitchell <davem@iabyn.com>2010-04-25 00:56:32 +0100
commitefaf36747029c85b4d8825318cb4d485a0bb350e (patch)
tree661fdb2a9c147bd9de3544d4e322e00e59d0b292 /proto.h
parentbc354c7012685d70ce64e7f10221b03ea279af01 (diff)
downloadperl-efaf36747029c85b4d8825318cb4d485a0bb350e.tar.gz
add Perl_magic_methcall
Add a new function that wraps the setup needed to call a magic method like FETCH (the existing S_magic_methcall function has been renamed S_magic_methcall1). There is one functional change, done mainly to allow for a single clean wrapper function, and that is that the method calls are no longer wrapped with SAVETMPS/FREETMPS. Previously only about half of them had this, so some relied on the caller to free, some didn't. At least we're consistent now. Doing it this way is necessary because otherwise magic_methcall() can't return an SV (eg for POP) because it'll be a temp and get freed by FREETMPS before it gets returned. So you'd have to copy everything, which would slow things down.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/proto.h b/proto.h
index 550cd5bc9f..ad2404638b 100644
--- a/proto.h
+++ b/proto.h
@@ -1901,6 +1901,13 @@ PERL_CALLCONV int Perl_magic_wipepack(pTHX_ SV* sv, MAGIC* mg)
#define PERL_ARGS_ASSERT_MAGIC_WIPEPACK \
assert(sv); assert(mg)
+PERL_CALLCONV SV* Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags, int n, SV* arg1, SV* arg2)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_MAGIC_METHCALL \
+ assert(sv); assert(mg); assert(meth)
+
PERL_CALLCONV void Perl_markstack_grow(pTHX);
#if defined(USE_LOCALE_COLLATE)
PERL_CALLCONV int Perl_magic_setcollxfrm(pTHX_ SV* sv, MAGIC* mg)
@@ -4481,11 +4488,11 @@ STATIC int S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth)
#define PERL_ARGS_ASSERT_MAGIC_METHPACK \
assert(sv); assert(mg); assert(meth)
-STATIC int S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 f, int n, SV *val)
+STATIC SV* S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags, int n, SV *val)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
-#define PERL_ARGS_ASSERT_MAGIC_METHCALL \
+#define PERL_ARGS_ASSERT_MAGIC_METHCALL1 \
assert(sv); assert(mg); assert(meth)
STATIC void S_restore_magic(pTHX_ const void *p);