| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
wmem_strutl.h
Go to the documentation of this file.
1
12#ifndef __WMEM_STRUTL_H__
13#define __WMEM_STRUTL_H__
14
15#include <stdarg.h>
16
17#include "wmem_core.h"
18
19#ifdef __cplusplus
20 extern "C" {
21#endif /* __cplusplus */
22
44WS_DLL_PUBLIC
45 char *
46 wmem_strdup(wmem_allocator_t *allocator, const char *src)
47G_GNUC_MALLOC;
48
57#define ws_strdup(src) wmem_strdup(NULL, src)
58
72WS_DLL_PUBLIC
73 char *
74 wmem_strndup(wmem_allocator_t *allocator, const char *src, const size_t len)
75G_GNUC_MALLOC;
76
86#define ws_strndup(src, len) wmem_strndup(NULL, src, len)
87
101WS_DLL_PUBLIC
102 char *
103 wmem_strdup_printf(wmem_allocator_t *allocator, const char *fmt, ...)
104G_GNUC_MALLOC G_GNUC_PRINTF(2, 3);
105
114#define ws_strdup_printf(...) wmem_strdup_printf(NULL, __VA_ARGS__)
115
129WS_DLL_PUBLIC
130 char *
131 wmem_strdup_vprintf(wmem_allocator_t *allocator, const char *fmt, va_list ap)
132G_GNUC_MALLOC;
133
143#define ws_strdup_vprintf(fmt, ap) wmem_strdup_vprintf(NULL, fmt, ap)
144
156WS_DLL_PUBLIC
157 const uint8_t *ws_memmem(const void *haystack, size_t haystack_len,
158 const void *needle, size_t needle_len);
159
163#ifdef __cplusplus
164}
165#endif /* __cplusplus */
166
167#endif /* __WMEM_STRUTL_H__ */
168
169/*
170 * Editor modelines - https://www.wireshark.org/tools/modelines.html
171 *
172 * Local variables:
173 * c-basic-offset: 4
174 * tab-width: 8
175 * indent-tabs-mode: nil
176 * End:
177 *
178 * vi: set shiftwidth=4 tabstop=8 expandtab:
179 * :indentSize=4:tabSize=8:noTabs=true:
180 */
wmem_strndup
WS_DLL_PUBLIC char * wmem_strndup(wmem_allocator_t *allocator, const char *src, const size_t len) G_GNUC_MALLOC
Duplicate a string up to a specified length using the given memory allocator.
Definition wmem_strutl.c:36
wmem_strdup_vprintf
WS_DLL_PUBLIC char * wmem_strdup_vprintf(wmem_allocator_t *allocator, const char *fmt, va_list ap) G_GNUC_MALLOC
Allocate and format a string using a va_list and the specified memory allocator.
Definition wmem_strutl.c:83
wmem_strdup_printf
WS_DLL_PUBLIC char * wmem_strdup_printf(wmem_allocator_t *allocator, const char *fmt,...) G_GNUC_MALLOC G_GNUC_PRINTF(2
Allocate and format a string using the specified memory allocator.
ws_memmem
WS_DLL_PUBLIC const uint8_t * ws_memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
Return the first occurrence of needle in haystack.
Definition wmem_strutl.c:120
wmem_strdup
WS_DLL_PUBLIC char * wmem_strdup(wmem_allocator_t *allocator, const char *src) G_GNUC_MALLOC
Duplicate a string using the specified memory allocator.
Definition wmem_strutl.c:20
_wmem_allocator_t
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
wmem_core.h