summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@covalent.net>2001-02-12 01:22:45 -0800
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-12 22:59:11 +0000
commit24f81a43516329e25358da5cf5b11ee0116287bd (patch)
treec6624eadec46cb1455d156b55d4d13df6f2b789f /perl.h
parent5ca7ba5e9f8716627179afcceb815f98090e3bd4 (diff)
downloadperl-24f81a43516329e25358da5cf5b11ee0116287bd.tar.gz
Re: [patch] context for 'U' magic functions
Message-ID: <Pine.LNX.4.21.0102120919040.26437-100000@mako.covalent.net> plus the suggestion by Nick Ing-Simmons to name the macro as PERL_MG_UFUNC to avoid namespace pollution, plus add the advice by Doug for XS writers to perl.h p4raw-id: //depot/perl@8774
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/perl.h b/perl.h
index 498e6e39ee..df90a651be 100644
--- a/perl.h
+++ b/perl.h
@@ -2192,11 +2192,32 @@ Gid_t getegid (void);
#endif
struct ufuncs {
- I32 (*uf_val)(IV, SV*);
- I32 (*uf_set)(IV, SV*);
+ I32 (*uf_val)(pTHX_ IV, SV*);
+ I32 (*uf_set)(pTHX_ IV, SV*);
IV uf_index;
};
+/* In pre-5.7-Perls the 'U' magic didn't get the thread context.
+ * XS code wanting to be backward compatible can do something
+ * like the following:
+
+#ifndef PERL_MG_UFUNC
+/* the old way, without pTHX_ */
+#define PERL_MG_UFUNC(name,ix,sv) I32 name(IV ix, SV *sv)
+#endif
+
+static PERL_MG_UFUNC(foo_get, index, val)
+{
+ sv_setsv(val, ...);
+ return TRUE;
+}
+
+-- Doug MacEachern
+
+*/
+
+#define PERL_MG_UFUNC(name,ix,sv) I32 name(pTHX_ IV ix, SV *sv)
+
/* Fix these up for __STDC__ */
#ifndef DONT_DECLARE_STD
char *mktemp (char*);