From e58d36fb84d6f1be5d106e828bb5e4ce02054276 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 19 Jul 2023 11:05:40 -0400 Subject: [PATCH] MT#56374 update glib dependency to >= 2.40 and remove related version test macros. Change-Id: I4eca21f4bf146ad8d13e775a5cd512ab1a190999 --- daemon/call.c | 4 ---- daemon/main.c | 8 -------- daemon/redis.c | 2 +- debian/control | 2 +- include/helpers.h | 33 --------------------------------- include/redis.h | 13 ------------- lib/auxlib.c | 4 ---- recording-daemon/garbage.c | 4 ---- 8 files changed, 2 insertions(+), 68 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 4b1f17248..5495af76f 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1824,12 +1824,8 @@ cps_match: } // flush out crypto suites we ended up not using - leave only one -#if GLIB_CHECK_VERSION(2,30,0) if (!g_queue_remove(cpq_in, cps_in)) ilogs(crypto, LOG_ERR, "BUG: incoming crypto suite not found in queue"); -#else - g_queue_remove(cpq_in, cps_in); -#endif crypto_params_sdes_queue_clear(cpq_in); g_queue_push_tail(cpq_in, cps_in); diff --git a/daemon/main.c b/daemon/main.c index 8760f6046..96cd901f6 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -1062,14 +1062,6 @@ static void init_everything(void) { recording_fs_init(rtpe_config.spooldir, rtpe_config.rec_method, rtpe_config.rec_format); rtpe_ssl_init(); -#if !GLIB_CHECK_VERSION(2,32,0) - g_thread_init(NULL); -#endif - -#if !(GLIB_CHECK_VERSION(2,36,0)) - g_type_init(); -#endif - #ifdef HAVE_MQTT if (mosquitto_lib_init() != MOSQ_ERR_SUCCESS) die("failed to init libmosquitto"); diff --git a/daemon/redis.c b/daemon/redis.c index 3b620d658..c26e570af 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1065,7 +1065,7 @@ static int json_get_hash(struct redis_hash *out, str *val = json_reader_get_string_value_uri_enc(root_reader); char* tmp = strdup(*members); - if (g_hash_table_insert_check(out->ht, tmp, val) != TRUE) { + if (g_hash_table_insert(out->ht, tmp, val) != TRUE) { rlog(LOG_WARNING,"Key %s already exists", tmp); goto err3; } diff --git a/debian/control b/debian/control index f3b78c3ed..484dbef8b 100644 --- a/debian/control +++ b/debian/control @@ -21,7 +21,7 @@ Build-Depends: libdigest-crc-perl, libdigest-hmac-perl, libevent-dev (>= 2.0), - libglib2.0-dev (>= 2.30), + libglib2.0-dev (>= 2.40), libhiredis-dev, libio-multiplex-perl, libio-socket-inet6-perl, diff --git a/include/helpers.h b/include/helpers.h index e86ce2bc9..ebc84dafc 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -21,28 +21,6 @@ #include "compat.h" #include "auxlib.h" -#if !(GLIB_CHECK_VERSION(2,30,0)) -#define g_atomic_int_and(atomic, val) \ -(G_GNUC_EXTENSION ({ \ -G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ -(void) (0 ? *(atomic) ^ (val) : 0); \ -(guint) __sync_fetch_and_and ((atomic), (val)); \ -})) -#define g_atomic_int_or(atomic, val) \ -(G_GNUC_EXTENSION ({ \ -G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ -(void) (0 ? *(atomic) ^ (val) : 0); \ -(guint) __sync_fetch_and_or ((atomic), (val)); \ -})) -#define g_atomic_pointer_add(atomic, val) \ -(G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : 0); \ - (void) (0 ? (val) ^ (val) : 0); \ - (gssize) __sync_fetch_and_add ((atomic), (val)); \ -})) -#endif - #if 0 && defined(__DEBUG) #define __THREAD_DEBUG 1 #endif @@ -64,17 +42,6 @@ INLINE void strdupfree(char **, const char *); GList *g_list_link(GList *, GList *); -#if !GLIB_CHECK_VERSION(2,32,0) -INLINE int g_hash_table_contains(GHashTable *h, const void *k) { - return g_hash_table_lookup(h, k) ? 1 : 0; -} -INLINE void g_queue_free_full(GQueue *q, GDestroyNotify free_func) { - void *d; - while ((d = g_queue_pop_head(q))) - free_func(d); - g_queue_free(q); -} -#endif #if !GLIB_CHECK_VERSION(2,62,0) // from https://github.com/GNOME/glib/blob/master/glib/glist.c diff --git a/include/redis.h b/include/redis.h index e28b0f463..74d05dc8f 100644 --- a/include/redis.h +++ b/include/redis.h @@ -88,19 +88,6 @@ extern struct redis *rtpe_redis_notify; -#if !GLIB_CHECK_VERSION(2,40,0) -INLINE gboolean g_hash_table_insert_check(GHashTable *h, gpointer k, gpointer v) { - gboolean ret = TRUE; - if (g_hash_table_contains(h, k)) - ret = FALSE; - g_hash_table_insert(h, k, v); - return ret; -} -#else -# define g_hash_table_insert_check g_hash_table_insert -#endif - - #define rlog(l, x...) ilog(l | LOG_FLAG_RESTORE, x) void redis_notify_loop(void *d); diff --git a/lib/auxlib.c b/lib/auxlib.c index e267dfd9c..438644488 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -307,11 +307,7 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char // process CLI arguments again so they override options from the config file c = g_option_context_new(description); g_option_context_add_main_entries(c, entries, NULL); -#if !GLIB_CHECK_VERSION(2,40,0) - g_option_context_parse_strv(c, &saved_argv, &er); -#else g_option_context_parse(c, &saved_argc, &saved_argv, &er); -#endif // finally go through our list again to look for strings that were // overwritten, and free the old values. diff --git a/recording-daemon/garbage.c b/recording-daemon/garbage.c index 2f02f5a40..0b76b7775 100644 --- a/recording-daemon/garbage.c +++ b/recording-daemon/garbage.c @@ -19,11 +19,7 @@ static volatile int garbage_thread_num; unsigned int garbage_new_thread_num(void) { -#if GLIB_CHECK_VERSION(2,30,0) return g_atomic_int_add(&garbage_thread_num, 1); -#else - return g_atomic_int_exchange_and_add(&garbage_thread_num, 1); -#endif }