aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndersBroman <anders.broman@ericsson.com>2017-11-23 14:06:34 +0100
committerAnders Broman <a.broman58@gmail.com>2017-11-23 14:46:20 +0000
commit243fa8c4416c00ff1958fe837c401028ef7ca901 (patch)
treeaa1feffd63b806199615386bdb0fe924cb10a66b
parentb6f5ee68f646715db094e55aa33b0810d0da1814 (diff)
[glib-compat] g_async_queue_timeout_pop() needed for older glibs
(2.31.18) Change-Id: I727c8548c29b3409fab819dce072e86153232911 Reviewed-on: https://code.wireshark.org/review/24550 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/register.c1
-rw-r--r--wsutil/glib-compat.c19
-rw-r--r--wsutil/glib-compat.h4
3 files changed, 24 insertions, 0 deletions
diff --git a/epan/register.c b/epan/register.c
index 63973c684a..877f7ff223 100644
--- a/epan/register.c
+++ b/epan/register.c
@@ -12,6 +12,7 @@
#include "ws_attributes.h"
#include <glib.h>
+#include <wsutil/glib-compat.h>
#include "epan/dissectors/dissectors.h"
static const char *cur_cb_name = NULL;
diff --git a/wsutil/glib-compat.c b/wsutil/glib-compat.c
index 4691a5576f..7dd67d16a7 100644
--- a/wsutil/glib-compat.c
+++ b/wsutil/glib-compat.c
@@ -110,6 +110,25 @@ g_ptr_array_new_full(guint reserved_size,
}
#endif /* GLIB_CHECK_VERSION(2, 30, 0)*/
+#if !GLIB_CHECK_VERSION(2,31,18)
+/**
+Code copied from dumpcap.c
+*/
+gpointer
+g_async_queue_timeout_pop(GAsyncQueue *queue,
+ guint64 timeout)
+{
+ GTimeVal wait_time;
+ gpointer q_status;
+
+ g_get_current_time(&wait_time);
+ g_time_val_add(&wait_time, timeout);
+ q_status = g_async_queue_timed_pop(queue, &wait_time);
+
+ return q_status;
+}
+
+#endif /* GLIB_CHECK_VERSION(2,31,18)*/
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/wsutil/glib-compat.h b/wsutil/glib-compat.h
index 54632e8ab3..1acf587c19 100644
--- a/wsutil/glib-compat.h
+++ b/wsutil/glib-compat.h
@@ -34,4 +34,8 @@ WS_DLL_PUBLIC gint64 g_get_monotonic_time (void);
WS_DLL_PUBLIC GPtrArray* g_ptr_array_new_full(guint reserved_size, GDestroyNotify element_free_func);
#endif /* !GLIB_CHECK_VERSION(2, 30, 0) */
+#if !GLIB_CHECK_VERSION(2,31,18)
+WS_DLL_PUBLIC gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout);
+#endif /* !GLIB_CHECK_VERSION(2,31,18) */
+
#endif /* GLIB_COMPAT_H */