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
20extern "C" {
21#endif /* __cplusplus */
22
44WS_DLL_PUBLIC
45char *
46wmem_strdup(wmem_allocator_t *allocator, const char *src)
47G_GNUC_MALLOC;
48
49#define ws_strdup(src) wmem_strdup(NULL, src)
50
64WS_DLL_PUBLIC
65char *
66wmem_strndup(wmem_allocator_t *allocator, const char *src, const size_t len)
67G_GNUC_MALLOC;
68
69#define ws_strndup(src, len) wmem_strndup(NULL, src, len)
70
84WS_DLL_PUBLIC
85char *
86wmem_strdup_printf(wmem_allocator_t *allocator, const char *fmt, ...)
87G_GNUC_MALLOC G_GNUC_PRINTF(2, 3);
88
89#define ws_strdup_printf(...) wmem_strdup_printf(NULL, __VA_ARGS__)
90
104WS_DLL_PUBLIC
105char *
106wmem_strdup_vprintf(wmem_allocator_t *allocator, const char *fmt, va_list ap)
107G_GNUC_MALLOC;
108
109#define ws_strdup_vprintf(fmt, ap) wmem_strdup_vprintf(NULL, fmt, ap)
110
122WS_DLL_PUBLIC
123const uint8_t *ws_memmem(const void *haystack, size_t haystack_len,
124 const void *needle, size_t needle_len);
125
129#ifdef __cplusplus
130}
131#endif /* __cplusplus */
132
133#endif /* __WMEM_STRUTL_H__ */
134
135/*
136 * Editor modelines - https://www.wireshark.org/tools/modelines.html
137 *
138 * Local variables:
139 * c-basic-offset: 4
140 * tab-width: 8
141 * indent-tabs-mode: nil
142 * End:
143 *
144 * vi: set shiftwidth=4 tabstop=8 expandtab:
145 * :indentSize=4:tabSize=8:noTabs=true:
146 */
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
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
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_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:117
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
Definition wmem_allocator.h:27