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)
88g_canonicalize_filename (
const gchar *filename,
89 const gchar *relative_to)
91 gchar *canon, *
input, *output, *after_root, *output_start;
93 g_return_val_if_fail (relative_to == NULL || g_path_is_absolute (relative_to), NULL);
95 if (!g_path_is_absolute (filename))
97 gchar *cwd_allocated = NULL;
100 if (relative_to != NULL)
103 cwd = cwd_allocated = g_get_current_dir ();
105 canon = g_build_filename (cwd, filename, NULL);
106 g_free (cwd_allocated);
110 canon = g_strdup (filename);
113 after_root = (
char *)g_path_skip_root (canon);
115 if (after_root == NULL)
121 return g_build_filename (G_DIR_SEPARATOR_S, filename, NULL);
125 for (output = after_root - 1;
126 (output >= canon) && G_IS_DIR_SEPARATOR (*output);
128 *output = G_DIR_SEPARATOR;
135 if (*output == G_DIR_SEPARATOR)
142 if (after_root - output == 1)
146 output_start = output;
151 g_assert (
input > canon && G_IS_DIR_SEPARATOR (
input[-1]));
152 g_assert (output > canon && G_IS_DIR_SEPARATOR (output[-1]));
153 g_assert (
input >= output);
156 while (G_IS_DIR_SEPARATOR (
input[0]))
160 if (
input[0] ==
'.' && (
input[1] == 0 || G_IS_DIR_SEPARATOR (
input[1])))
168 else if (
input[0] ==
'.' &&
input[1] ==
'.' &&
169 (
input[2] == 0 || G_IS_DIR_SEPARATOR (
input[2])))
171 if (output > output_start)
177 while (!G_IS_DIR_SEPARATOR (output[-1]) && output > output_start);
187 while (*
input && !G_IS_DIR_SEPARATOR (*
input))
188 *output++ = *
input++;
192 *output++ = G_DIR_SEPARATOR;
198 if (output > output_start && G_IS_DIR_SEPARATOR (output[-1]))
208#if !GLIB_CHECK_VERSION(2, 60, 0)
210#define g_queue_clear_full queue_clear_full
222queue_clear_full (GQueue * queue, GDestroyNotify free_func)
226 while ((data = g_queue_pop_head (queue)) != NULL)
232#if !GLIB_CHECK_VERSION(2, 61, 2)
234typedef volatile gint gatomicrefcount;
264static inline gboolean
265g_array_binary_search (GArray *array,
268 guint *out_match_index)
270 gboolean result = FALSE;
271 GRealArray *_array = (GRealArray *) array;
272 guint left, middle, right;
275 g_return_val_if_fail (_array != NULL, FALSE);
278 if (G_LIKELY(_array->
len))
281 right = _array->
len - 1;
283 while (left <= right)
285 middle = left + (right - left) / 2;
295 else if ( middle > 0)
302 if (result && out_match_index != NULL)
303 *out_match_index = middle;
309#if !GLIB_CHECK_VERSION(2, 64, 0)
336static inline gpointer
337g_array_steal (GArray *array,
343 g_return_val_if_fail (array != NULL, NULL);
345 rarray = (GRealArray *) array;
368static inline gpointer *
369g_ptr_array_steal (GPtrArray *array,
372 GRealPtrArray *rarray;
375 g_return_val_if_fail (array != NULL, NULL);
377 rarray = (GRealPtrArray *) array;
383 rarray->pdata = NULL;
399static inline guint8 *g_byte_array_steal (GByteArray *array,
402 return (guint8 *) g_array_steal ((GArray *) array, len);
406#if !GLIB_CHECK_VERSION(2, 68, 0)
419g_memdup2(
const void *mem,
size_t byte_size)
423 if (mem && byte_size != 0) {
424 new_mem = g_malloc(byte_size);
425 memcpy(new_mem, mem, byte_size);
434#if !GLIB_CHECK_VERSION(2, 74, 0)
435#ifndef G_REGEX_DEFAULT
436#define G_REGEX_DEFAULT ((GRegexCompileFlags)0)
440#if !GLIB_CHECK_VERSION(2, 74, 0)
441#ifndef G_REGEX_MATCH_DEFAULT
442#define G_REGEX_MATCH_DEFAULT ((GRegexMatchFlags)0)
446#if !GLIB_CHECK_VERSION(2, 88, 0)
447#ifndef G_NSEC_PER_SEC
448#define G_NSEC_PER_SEC 1000000000
Internal implementation of GArray, holding the backing buffer and allocation metadata.
Definition glib-compat.h:240
guint len
Definition glib-compat.h:242
guint elt_size
Definition glib-compat.h:244
GDestroyNotify clear_func
Definition glib-compat.h:248
guint alloc
Definition glib-compat.h:243
guint zero_terminated
Definition glib-compat.h:245
gatomicrefcount ref_count
Definition glib-compat.h:247
guint8 * data
Definition glib-compat.h:241
guint clear
Definition glib-compat.h:246
Internal implementation of GPtrArray, holding the backing pointer buffer and allocation metadata.
Definition glib-compat.h:316
guint len
Definition glib-compat.h:318
GDestroyNotify element_free_func
Definition glib-compat.h:322
guint alloc
Definition glib-compat.h:319
gatomicrefcount ref_count
Definition glib-compat.h:320
gpointer * pdata
Definition glib-compat.h:317
guint8 null_terminated
Definition glib-compat.h:321
Represents a single decoded TCP segment extracted from a captured frame for graph analysis.
Definition tap-tcp-stream.h:56
int(* compare_func)(const void *a, const void *b)
Function pointer type for comparing two values.
Definition wmem_tree-int.h:106