![]() |
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Macros | |
#define | wmem_stack_count(X) wmem_list_count(X) |
Get the number of elements in a wmem stack. | |
#define | wmem_stack_push(STACK, DATA) wmem_list_prepend((STACK), (DATA)) |
Push a data element onto the top of a wmem stack. | |
#define | wmem_stack_new(ALLOCATOR) wmem_list_new(ALLOCATOR) |
Create a new wmem stack using the specified memory allocator. | |
#define | wmem_destroy_stack(STACK) wmem_destroy_list(STACK) |
Destroy a wmem stack and release its internal resources. | |
Typedefs | |
typedef wmem_list_t | wmem_stack_t |
A stack abstraction implemented as a wrapper over wmem_list_t. | |
Functions | |
WS_DLL_PUBLIC void * | wmem_stack_peek (const wmem_stack_t *stack) |
Peek at the top element of a wmem stack without removing it. | |
WS_DLL_PUBLIC void * | wmem_stack_pop (wmem_stack_t *stack) |
Pop the top element from a wmem stack. | |
A stack implementation on top of wmem.
#define wmem_destroy_stack | ( | STACK | ) | wmem_destroy_list(STACK) |
Destroy a wmem stack and release its internal resources.
Frees all internal memory associated with the given wmem_stack_t
, including its frames. This macro maps directly to wmem_destroy_list(STACK)
.
STACK | Pointer to the stack to destroy. |
#define wmem_stack_count | ( | X | ) | wmem_list_count(X) |
Get the number of elements in a wmem stack.
Returns the number of frames (elements) currently stored in the stack. This macro maps directly to wmem_list_count(X)
.
X | Pointer to a wmem_stack_t . |
#define wmem_stack_new | ( | ALLOCATOR | ) | wmem_list_new(ALLOCATOR) |
Create a new wmem stack using the specified memory allocator.
Allocates and initializes a new wmem_stack_t
, which is implemented as a wrapper over wmem_list_t
. This macro maps directly to wmem_list_new(ALLOCATOR)
.
ALLOCATOR | Pointer to a wmem_allocator_t used for memory management. |
wmem_stack_t
. #define wmem_stack_push | ( | STACK, | |
DATA | |||
) | wmem_list_prepend((STACK), (DATA)) |
Push a data element onto the top of a wmem stack.
Inserts the specified DATA
pointer at the top of the given wmem_stack_t
. This macro maps directly to wmem_list_prepend()
, maintaining LIFO semantics.
STACK | Pointer to the wmem_stack_t to modify. |
DATA | Pointer to the data to push onto the stack. |
A stack abstraction implemented as a wrapper over wmem_list_t.
The wmem stack provides LIFO (last-in, first-out) semantics using the underlying doubly-linked list structure (wmem_list_t
). All stack operations are built on top of list functions for simplicity and consistency.
WS_DLL_PUBLIC void * wmem_stack_peek | ( | const wmem_stack_t * | stack | ) |
Peek at the top element of a wmem stack without removing it.
Returns the data pointer stored in the top frame of the given wmem_stack_t
. If the stack is empty, the function returns NULL
.
stack | Pointer to the stack to inspect. |
NULL
if the stack is empty. WS_DLL_PUBLIC void * wmem_stack_pop | ( | wmem_stack_t * | stack | ) |
Pop the top element from a wmem stack.
Removes and returns the data pointer stored in the top frame of the given wmem_stack_t
. If the stack is empty, the function returns NULL
.
stack | Pointer to the stack to modify. |
NULL
if the stack was empty.