diff options
author | Joerg Mayer <jmayer@loplof.de> | 2018-04-16 18:53:33 +0200 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2018-04-16 17:47:08 +0000 |
commit | 10134e9453eef2dfb316bac6d66edc4b4438f706 (patch) | |
tree | 5917b5628b3d7a4be4587858552bff50d3c8f0e7 /wsutil | |
parent | bb81bef5353138e4f8d80387c2a76650f79e4fb6 (diff) |
glib-compat is no longer used - it provided only code for versions < 2.32
Change-Id: I17e2c221cc40dbe9328458db9f17480c05bdc276
Reviewed-on: https://code.wireshark.org/review/26972
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/CMakeLists.txt | 2 | ||||
-rw-r--r-- | wsutil/Makefile.am | 2 | ||||
-rw-r--r-- | wsutil/glib-compat.c | 148 | ||||
-rw-r--r-- | wsutil/glib-compat.h | 35 |
4 files changed, 0 insertions, 187 deletions
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index cd5c826000..ad477791d7 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -39,7 +39,6 @@ set(WSUTIL_PUBLIC_HEADERS filesystem.h frequency-utils.h g711.h - glib-compat.h inet_addr.h inet_ipv6.h interface.h @@ -96,7 +95,6 @@ set(WSUTIL_COMMON_FILES filesystem.c frequency-utils.c g711.c - glib-compat.c inet_addr.c interface.c jsmn.c diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index 2e29e2b143..14474e57c7 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -57,7 +57,6 @@ WSUTIL_PUBLIC_INCLUDES = \ filesystem.h \ frequency-utils.h \ g711.h \ - glib-compat.h \ inet_addr.h \ inet_ipv4.h \ inet_ipv6.h \ @@ -146,7 +145,6 @@ libwsutil_la_SOURCES = \ filesystem.c \ frequency-utils.c \ g711.c \ - glib-compat.c \ inet_addr.c \ interface.c \ jsmn.c \ diff --git a/wsutil/glib-compat.c b/wsutil/glib-compat.c deleted file mode 100644 index b1181d3809..0000000000 --- a/wsutil/glib-compat.c +++ /dev/null @@ -1,148 +0,0 @@ -/* -* Provide some functions that are not present in older -* GLIB versions (down to 2.22) -* -* Wireshark - Network traffic analyzer -* By Gerald Combs <gerald@wireshark.org> -* Copyright 1998 Gerald Combs -* -* SPDX-License-Identifier: GPL-2.0-or-later -*/ -#include "config.h" - -#include <glib.h> - -#include "glib-compat.h" -#if !GLIB_CHECK_VERSION(2, 28, 0) -/** -* g_slist_free_full: -* @list: a pointer to a #GSList -* @free_func: the function to be called to free each element's data -* -* Convenience method, which frees all the memory used by a #GSList, and -* calls the specified destroy function on every element's data. -* -* Since: 2.28 -**/ -void -g_slist_free_full(GSList *list, - GDestroyNotify free_func) -{ - g_slist_foreach(list, (GFunc)free_func, NULL); - g_slist_free(list); -} - -/** -* g_list_free_full: -* @list: a pointer to a #GList -* @free_func: the function to be called to free each element's data -* -* Convenience method, which frees all the memory used by a #GList, -* and calls @free_func on every element's data. -* -* Since: 2.28 -*/ -void -g_list_free_full(GList *list, - GDestroyNotify free_func) -{ - g_list_foreach(list, (GFunc)free_func, NULL); - g_list_free(list); -} - -/** -* g_get_monotonic_time: -* -* Queries the system monotonic time. Returns value in microseconds. -* -* Since: 2.28 -*/ -gint64 g_get_monotonic_time (void) -{ - GTimeVal result; - g_get_current_time(&result); - return result.tv_sec*1000000 + result.tv_usec; -} - -#endif /* GLIB_CHECK_VERSION(2, 28, 0)*/ - -#if !GLIB_CHECK_VERSION(2, 30, 0) -/** -* g_ptr_array_new_full: -* @reserved_size: number of pointers preallocated -* @element_free_func: (allow-none): A function to free elements with -* destroy @array or %NULL -* -* Creates a new #GPtrArray with @reserved_size pointers preallocated -* and a reference count of 1. This avoids frequent reallocation, if -* you are going to add many pointers to the array. Note however that -* the size of the array is still 0. It also set @element_free_func -* for freeing each element when the array is destroyed either via -* g_ptr_array_unref(), when g_ptr_array_free() is called with -* @free_segment set to %TRUE or when removing elements. -* -* Returns: A new #GPtrArray -* -* Since: 2.30 -*/ -GPtrArray* -g_ptr_array_new_full(guint reserved_size, - GDestroyNotify element_free_func) -{ - GPtrArray *array; - - array = g_ptr_array_sized_new(reserved_size); - g_ptr_array_set_free_func(array, element_free_func); - - return array; -} -#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)*/ - - -#if !GLIB_CHECK_VERSION(2,31,0) -GThread *g_thread_new(const gchar *name, GThreadFunc func, gpointer data) -{ - GError *error = NULL; - GThread *thread; - - thread = g_thread_create(func, data, TRUE, &error); - - if G_UNLIKELY (thread == NULL) - g_error ("creating thread '%s': %s", name ? name : "", error->message); - - return thread; -} -#endif /* GLIB_CHECK_VERSION(2,31,0)*/ - -/* -* Editor modelines - http://www.wireshark.org/tools/modelines.html -* -* Local variables: -* c-basic-offset: 4 -* tab-width: 8 -* indent-tabs-mode: nil -* End: -* -* vi: set shiftwidth=4 tabstop=8 expandtab: -* :indentSize=4:tabSize=8:noTabs=true: -*/ diff --git a/wsutil/glib-compat.h b/wsutil/glib-compat.h deleted file mode 100644 index cf00cadaf6..0000000000 --- a/wsutil/glib-compat.h +++ /dev/null @@ -1,35 +0,0 @@ -/* glib-compat.h -* Definitions to provide some functions that are not present in older -* GLIB versions (down to 2.22) -* -* Wireshark - Network traffic analyzer -* By Gerald Combs <gerald@wireshark.org> -* Copyright 1998 Gerald Combs -* -* SPDX-License-Identifier: GPL-2.0-or-later -*/ -#ifndef GLIB_COMPAT_H -#define GLIB_COMPAT_H - -#include "ws_symbol_export.h" -#include "ws_attributes.h" - -#if !GLIB_CHECK_VERSION(2, 28, 0) -WS_DLL_PUBLIC void g_slist_free_full(GSList *list, GDestroyNotify free_func); -WS_DLL_PUBLIC void g_list_free_full(GList *list, GDestroyNotify free_func); -WS_DLL_PUBLIC gint64 g_get_monotonic_time (void); -#endif /* !GLIB_CHECK_VERSION(2, 28, 0) */ - -#if !GLIB_CHECK_VERSION(2, 30, 0) -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) */ - -#if !GLIB_CHECK_VERSION(2,31,0) -WS_DLL_PUBLIC GThread *g_thread_new (const gchar *name, GThreadFunc func, gpointer data); -#endif /* !GLIB_CHECK_VERSION(2,31,0) */ - -#endif /* GLIB_COMPAT_H */ |