pixman: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 5 16:30:46 UTC 2024


 meson.build     |    9 +++++++++
 pixman/pixman.c |   15 +++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 126d61e796fde564b3a9746031cd188c8a6ecf95
Author: Lance Arsenault <lanceman at vt.edu>
Date:   Mon Nov 4 22:16:45 2024 -0500

    pixman: Add library destructor
    
    Closes: https://gitlab.freedesktop.org/pixman/pixman/-/issues/111

diff --git a/meson.build b/meson.build
index 0fd6f01..3bdf9ce 100644
--- a/meson.build
+++ b/meson.build
@@ -541,6 +541,15 @@ if cc.links('''
   config.set('TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR', 1)
 endif
 
+if cc.links('''
+    static int x = 1;
+    static void __attribute__((destructor)) destructor_function () { x = 0; }
+    int main (void) { return x; }
+    ''',
+    name : '__attribute__((destructor))')
+  config.set('TOOLCHAIN_SUPPORTS_ATTRIBUTE_DESTRUCTOR', 1)
+endif
+
 if cc.links(
     ' __float128 a = 1.0Q, b = 2.0Q; int main (void) { return a + b; }',
     name : 'Has float128 support')
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 82ec236..26e5008 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -40,6 +40,21 @@ pixman_constructor (void)
 }
 #endif
 
+#ifdef TOOLCHAIN_SUPPORTS_ATTRIBUTE_DESTRUCTOR
+static void __attribute__((destructor))
+pixman_destructor (void)
+{
+    pixman_implementation_t *imp = global_implementation;
+
+    while (imp)
+    {
+        pixman_implementation_t *cur = imp;
+        imp = imp->fallback;
+        free (cur);
+    }
+}
+#endif
+
 typedef struct operator_info_t operator_info_t;
 
 struct operator_info_t


More information about the xorg-commit mailing list