Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros | Typedefs | Functions

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.
 

Detailed Description

A stack implementation on top of wmem.

Macro Definition Documentation

◆ wmem_destroy_stack

#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).

Parameters
STACKPointer to the stack to destroy.
Note
This does not free the data stored in the stack frames.

◆ wmem_stack_count

#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).

Parameters
XPointer to a wmem_stack_t.
Returns
Number of elements in the stack.

◆ wmem_stack_new

#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).

Parameters
ALLOCATORPointer to a wmem_allocator_t used for memory management.
Returns
Pointer to the newly created wmem_stack_t.

◆ wmem_stack_push

#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.

Parameters
STACKPointer to the wmem_stack_t to modify.
DATAPointer to the data to push onto the stack.

Typedef Documentation

◆ wmem_stack_t

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.

Function Documentation

◆ wmem_stack_peek()

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.

Parameters
stackPointer to the stack to inspect.
Returns
Pointer to the data at the top of the stack, or NULL if the stack is empty.

◆ wmem_stack_pop()

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.

Parameters
stackPointer to the stack to modify.
Returns
Pointer to the data that was at the top of the stack, or NULL if the stack was empty.