aboutsummaryrefslogtreecommitdiff
path: root/deps/sysobj_early
diff options
context:
space:
mode:
authorbigbear <ns@bigbear.dk>2024-02-08 03:08:54 +0100
committerbigbear <ns@bigbear.dk>2024-02-08 19:52:53 +0100
commit33d6c7101cee251b91b4f01b2ddde55b4b2d50d9 (patch)
tree49ae675f7d68b90415db69bfcd21fe84fa74013d /deps/sysobj_early
parent1dc1f18804969c191346b064cd232d3f5959b13c (diff)
FIX back ports
Diffstat (limited to 'deps/sysobj_early')
-rw-r--r--deps/sysobj_early/gui/uri_handler.c5
-rw-r--r--deps/sysobj_early/src/auto_free.c39
2 files changed, 37 insertions, 7 deletions
diff --git a/deps/sysobj_early/gui/uri_handler.c b/deps/sysobj_early/gui/uri_handler.c
index 055dbaca..de9f64a7 100644
--- a/deps/sysobj_early/gui/uri_handler.c
+++ b/deps/sysobj_early/gui/uri_handler.c
@@ -21,6 +21,11 @@
#include <stdio.h>
#include "uri_handler.h"
+//compatibility
+#ifndef G_SPAWN_DEFAULT
+#define G_SPAWN_DEFAULT 0
+#endif
+
static uri_handler uri_func = NULL;
void uri_set_function(uri_handler f) {
diff --git a/deps/sysobj_early/src/auto_free.c b/deps/sysobj_early/src/auto_free.c
index 8439681f..9a10e27a 100644
--- a/deps/sysobj_early/src/auto_free.c
+++ b/deps/sysobj_early/src/auto_free.c
@@ -33,7 +33,17 @@ static struct {
} af_stats;
#endif
-static GMutex free_lock;
+//Compatibility
+#ifndef G_SOURCE_REMOVE
+ #define G_SOURCE_REMOVE FALSE
+#endif
+
+#ifndef G_SOURCE_CONTINUE
+ #define G_SOURCE_CONTINUE TRUE
+#endif
+
+
+static GMutex *free_lock = NULL;
static GSList *free_list = NULL;
static gboolean free_final = FALSE;
static GTimer *auto_free_timer = NULL;
@@ -95,10 +105,15 @@ gpointer auto_free_ex_(gpointer p, GDestroyNotify f, const char *file, int line,
z->line = line;
z->func = func;
z->stamp = af_elapsed();
- g_mutex_lock(&free_lock);
+#if GLIB_CHECK_VERSION(2,32,0)
+ if(free_lock==NULL) {free_lock=g_new(GMutex,1);g_mutex_init(free_lock);}
+#else
+ if(free_lock==NULL) free_lock=g_mutex_new();
+#endif
+ g_mutex_lock(free_lock);
free_list = g_slist_prepend(free_list, z);
sysobj_stats.auto_free_len++;
- g_mutex_unlock(&free_lock);
+ g_mutex_unlock(free_lock);
return p;
}
@@ -113,10 +128,15 @@ gpointer auto_free_on_exit_ex_(gpointer p, GDestroyNotify f, const char *file, i
z->line = line;
z->func = func;
z->stamp = -1.0;
- g_mutex_lock(&free_lock);
+#if GLIB_CHECK_VERSION(2,32,0)
+ if(free_lock==NULL) g_mutex_init(free_lock);
+#else
+ if(free_lock==NULL) free_lock=g_mutex_new();
+#endif
+ g_mutex_lock(free_lock);
free_list = g_slist_prepend(free_list, z);
sysobj_stats.auto_free_len++;
- g_mutex_unlock(&free_lock);
+ g_mutex_unlock(free_lock);
return p;
}
@@ -140,7 +160,12 @@ static void free_auto_free_ex(gboolean thread_final) {
if (!free_list) return;
- g_mutex_lock(&free_lock);
+#if GLIB_CHECK_VERSION(2,32,0)
+ if(free_lock==NULL) {free_lock=g_new(GMutex,1);g_mutex_init(free_lock);}
+#else
+ if(free_lock==NULL) free_lock=g_mutex_new();
+#endif
+ g_mutex_lock(free_lock);
if (DEBUG_AUTO_FREE)
auto_free_msg("%llu total items in queue, but will free from thread %p only... ", sysobj_stats.auto_free_len, this_thread);
for(l = free_list; l; l = n) {
@@ -174,7 +199,7 @@ static void free_auto_free_ex(gboolean thread_final) {
auto_free_msg("... freed %llu (from thread %p)", fc, this_thread);
sysobj_stats.auto_freed += fc;
sysobj_stats.auto_free_len -= fc;
- g_mutex_unlock(&free_lock);
+ g_mutex_unlock(free_lock);
}
void free_auto_free_thread_final() {