15#include "ws_symbol_export.h"
16#include "ws_attributes.h"
25#if !GLIB_CHECK_VERSION(2, 57, 1)
28g_hash_table_steal_extended (GHashTable *hash_table,
29 gconstpointer lookup_key,
31 gpointer *stolen_value)
34 if (g_hash_table_lookup_extended (hash_table, lookup_key, &key, &value))
37 stolen_value = &value;
39 g_hash_table_steal (hash_table, key);
43 if (stolen_key != NULL)
45 if (stolen_value != NULL)
54#if !GLIB_CHECK_VERSION(2, 60, 0)
56#define g_queue_clear_full queue_clear_full
58queue_clear_full (GQueue * queue, GDestroyNotify free_func)
62 while ((data = g_queue_pop_head (queue)) != NULL)
68#if !GLIB_CHECK_VERSION(2, 61, 2)
70typedef volatile gint gatomicrefcount;
79 guint zero_terminated ;
81 gatomicrefcount ref_count;
82 GDestroyNotify clear_func;
86g_array_binary_search (GArray *array,
89 guint *out_match_index)
91 gboolean result = FALSE;
93 guint left, middle, right;
96 g_return_val_if_fail (_array != NULL, FALSE);
99 if (G_LIKELY(_array->len))
102 right = _array->len - 1;
104 while (left <= right)
106 middle = left + (right - left) / 2;
108 val =
compare_func (_array->data + (_array->elt_size * middle), target);
116 else if ( middle > 0)
123 if (result && out_match_index != NULL)
124 *out_match_index = middle;
130#if !GLIB_CHECK_VERSION(2, 64, 0)
138 gatomicrefcount ref_count;
139 guint8 null_terminated : 1;
140 GDestroyNotify element_free_func;
143static inline gpointer
144g_array_steal (GArray *array,
150 g_return_val_if_fail (array != NULL, NULL);
153 segment = (gpointer) rarray->data;
164static inline gpointer *
165g_ptr_array_steal (GPtrArray *array,
171 g_return_val_if_fail (array != NULL, NULL);
174 segment = (gpointer *) rarray->pdata;
179 rarray->pdata = NULL;
185static inline guint8 *
186g_byte_array_steal (GByteArray *array,
189 return (guint8 *) g_array_steal ((GArray *) array, len);
193#if !GLIB_CHECK_VERSION(2, 68, 0)
195g_memdup2(
const void *mem,
size_t byte_size)
199 if (mem && byte_size != 0) {
200 new_mem = g_malloc(byte_size);
201 memcpy(new_mem, mem, byte_size);
210#if !GLIB_CHECK_VERSION(2, 74, 0)
211#ifndef G_REGEX_DEFAULT
212#define G_REGEX_DEFAULT ((GRegexCompileFlags)0)
216#if !GLIB_CHECK_VERSION(2, 74, 0)
217#ifndef G_REGEX_MATCH_DEFAULT
218#define G_REGEX_MATCH_DEFAULT ((GRegexMatchFlags)0)
Definition glib-compat.h:74
Definition glib-compat.h:134
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