Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
wmem_array.h
1 /* wmem_array.h
2  * Definitions for the Wireshark Memory Manager Array
3  * Copyright 2013, Evan Huus <eapache@gmail.com>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __WMEM_ARRAY_H__
13 #define __WMEM_ARRAY_H__
14 
15 #include <string.h>
16 #include <glib.h>
17 
18 #include "wmem_core.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
33 struct _wmem_array_t;
34 
35 typedef struct _wmem_array_t wmem_array_t;
36 
37 WS_DLL_PUBLIC
39 wmem_array_sized_new(wmem_allocator_t *allocator, gsize elem_size,
40  guint alloc_count)
41 G_GNUC_MALLOC;
42 
43 WS_DLL_PUBLIC
45 wmem_array_new(wmem_allocator_t *allocator, const gsize elem_size)
46 G_GNUC_MALLOC;
47 
48 WS_DLL_PUBLIC
49 void
50 wmem_array_set_null_terminator(wmem_array_t *array);
51 
52 WS_DLL_PUBLIC
53 void
54 wmem_array_bzero(wmem_array_t *array);
55 
56 WS_DLL_PUBLIC
57 void
58 wmem_array_append(wmem_array_t *array, const void *in, guint count);
59 
60 #define wmem_array_append_one(ARRAY, VAL) \
61  wmem_array_append((ARRAY), &(VAL), 1)
62 
63 WS_DLL_PUBLIC
64 void *
65 wmem_array_index(wmem_array_t *array, guint array_index);
66 
67 WS_DLL_PUBLIC
68 void
69 wmem_array_sort(wmem_array_t *array, int (*compar)(const void*,const void*));
70 
71 WS_DLL_PUBLIC
72 void *
73 wmem_array_get_raw(wmem_array_t *array);
74 
75 WS_DLL_PUBLIC
76 guint
77 wmem_array_get_count(wmem_array_t *array);
78 
82 #ifdef __cplusplus
83 }
84 #endif /* __cplusplus */
85 
86 #endif /* __WMEM_ARRAY_H__ */
87 
88 /*
89  * Editor modelines - http://www.wireshark.org/tools/modelines.html
90  *
91  * Local variables:
92  * c-basic-offset: 4
93  * tab-width: 8
94  * indent-tabs-mode: nil
95  * End:
96  *
97  * vi: set shiftwidth=4 tabstop=8 expandtab:
98  * :indentSize=4:tabSize=8:noTabs=true:
99  */
Definition: wmem_array.c:27
Definition: wmem_allocator.h:26