Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
wmem_core.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <glib.h>
#include <ws_symbol_export.h>
#include <ws_attributes.h>
#include <ws_posix_compat.h>

Go to the source code of this file.

Macros

#define wmem_new(allocator, type)    ((type*)wmem_alloc((allocator), sizeof(type)))
 
#define wmem_safe_mult_type_size(type, num)    ((((num) <= 0) || ((size_t)sizeof(type) > (G_MAXSSIZE / (size_t)(num)))) ? 0 : (sizeof(type) * (num)))
 
#define wmem_alloc_array(allocator, type, num)    ((type*)wmem_alloc((allocator), wmem_safe_mult_type_size(type, (num))))
 
#define wmem_new0(allocator, type)    ((type*)wmem_alloc0((allocator), sizeof(type)))
 
#define wmem_alloc0_array(allocator, type, num)    ((type*)wmem_alloc0((allocator), wmem_safe_mult_type_size(type, (num))))
 

Typedefs

typedef struct _wmem_allocator_t wmem_allocator_t
 
typedef enum _wmem_allocator_type_t wmem_allocator_type_t
 

Enumerations

enum  _wmem_allocator_type_t { WMEM_ALLOCATOR_SIMPLE , WMEM_ALLOCATOR_BLOCK , WMEM_ALLOCATOR_STRICT , WMEM_ALLOCATOR_BLOCK_FAST }
 

Functions

WS_DLL_PUBLIC void * wmem_alloc (wmem_allocator_t *allocator, const size_t size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(2)
 
WS_DLL_PUBLIC void * wmem_alloc0 (wmem_allocator_t *allocator, const size_t size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(2)
 
WS_DLL_PUBLIC void wmem_free (wmem_allocator_t *allocator, void *ptr)
 
WS_DLL_PUBLIC void * wmem_realloc (wmem_allocator_t *allocator, void *ptr, const size_t size) G_GNUC_ALLOC_SIZE(3)
 
WS_DLL_PUBLIC void wmem_free_all (wmem_allocator_t *allocator)
 
WS_DLL_PUBLIC void wmem_gc (wmem_allocator_t *allocator)
 
WS_DLL_PUBLIC void wmem_destroy_allocator (wmem_allocator_t *allocator)
 
WS_DLL_PUBLIC wmem_allocator_twmem_allocator_new (const wmem_allocator_type_t type)
 
WS_DLL_PUBLIC void wmem_init (void)
 
WS_DLL_PUBLIC void wmem_cleanup (void)
 
WS_DLL_PUBLIC void wmem_enter_scope (wmem_allocator_t *allocator)
 
WS_DLL_PUBLIC void wmem_leave_scope (wmem_allocator_t *allocator)
 
WS_DLL_PUBLIC bool wmem_in_scope (wmem_allocator_t *allocator)
 

Detailed Description

Definitions for the Wireshark Memory Manager Core Copyright 2012, Evan Huus eapac.nosp@m.he@g.nosp@m.mail..nosp@m.com

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later