15#include "ws_symbol_export.h"
16#include "ws_attributes.h"
25#if !GLIB_CHECK_VERSION(2, 57, 1)
37g_hash_table_steal_extended (GHashTable *hash_table,
38 gconstpointer lookup_key,
40 gpointer *stolen_value)
43 if (g_hash_table_lookup_extended (hash_table, lookup_key, &key, &value))
46 stolen_value = &value;
48 g_hash_table_steal (hash_table, key);
52 if (stolen_key != NULL)
54 if (stolen_value != NULL)
63#if !GLIB_CHECK_VERSION(2, 60, 0)
65#define g_queue_clear_full queue_clear_full
77queue_clear_full (GQueue * queue, GDestroyNotify free_func)
81 while ((data = g_queue_pop_head (queue)) != NULL)
87#if !GLIB_CHECK_VERSION(2, 61, 2)
89typedef volatile gint gatomicrefcount;
98 guint zero_terminated ;
100 gatomicrefcount ref_count;
101 GDestroyNotify clear_func;
117static inline gboolean
118g_array_binary_search (GArray *array,
121 guint *out_match_index)
123 gboolean result = FALSE;
125 guint left, middle, right;
128 g_return_val_if_fail (_array != NULL, FALSE);
131 if (G_LIKELY(_array->len))
134 right = _array->len - 1;
136 while (left <= right)
138 middle = left + (right - left) / 2;
140 val =
compare_func (_array->data + (_array->elt_size * middle), target);
148 else if ( middle > 0)
155 if (result && out_match_index != NULL)
156 *out_match_index = middle;
162#if !GLIB_CHECK_VERSION(2, 64, 0)
170 gatomicrefcount ref_count;
171 guint8 null_terminated : 1;
172 GDestroyNotify element_free_func;
186static inline gpointer
187g_array_steal (GArray *array,
193 g_return_val_if_fail (array != NULL, NULL);
196 segment = (gpointer) rarray->data;
218static inline gpointer *
219g_ptr_array_steal (GPtrArray *array,
225 g_return_val_if_fail (array != NULL, NULL);
228 segment = (gpointer *) rarray->pdata;
233 rarray->pdata = NULL;
249static inline guint8 *g_byte_array_steal (GByteArray *array,
252 return (guint8 *) g_array_steal ((GArray *) array, len);
256#if !GLIB_CHECK_VERSION(2, 68, 0)
269g_memdup2(
const void *mem,
size_t byte_size)
273 if (mem && byte_size != 0) {
274 new_mem = g_malloc(byte_size);
275 memcpy(new_mem, mem, byte_size);
284#if !GLIB_CHECK_VERSION(2, 74, 0)
285#ifndef G_REGEX_DEFAULT
286#define G_REGEX_DEFAULT ((GRegexCompileFlags)0)
290#if !GLIB_CHECK_VERSION(2, 74, 0)
291#ifndef G_REGEX_MATCH_DEFAULT
292#define G_REGEX_MATCH_DEFAULT ((GRegexMatchFlags)0)
296#if !GLIB_CHECK_VERSION(2, 88, 0)
297#ifndef G_NSEC_PER_SEC
298#define G_NSEC_PER_SEC 1000000000
Definition glib-compat.h:93
Definition glib-compat.h:166
Definition tap-tcp-stream.h:43
int(* compare_func)(const void *a, const void *b)
Function pointer type for comparing two values.
Definition wmem_tree-int.h:106