[perl-Glib] Add a fallback implementation of SvMAGIC_set



commit 3296eb2062a9cc10acf87652949eb3420da5c875
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sat Dec 10 00:36:55 2011 +0100

    Add a fallback implementation of SvMAGIC_set
    
    This macro apparently wasn't yet defined in perl 5.8.0.
    
    Based on a patch by Sisyphus.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=665266

 GObject.xs |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/GObject.xs b/GObject.xs
index a5bd5d2..77f49e4 100644
--- a/GObject.xs
+++ b/GObject.xs
@@ -135,6 +135,13 @@ _gperl_find_mg (SV * sv)
 	return NULL;
 }
 
+/* copied from ppport.h, needed for older perls (< 5.8.8?) */
+#ifndef SvMAGIC_set
+#  define SvMAGIC_set(sv, val)           \
+                STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
+                (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END
+#endif
+
 /*
  * Remove the association between a pointer attached to C<sv> using
  * C<_gperl_attach_mg> and the C<sv>.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]