2 * Definitions for the Wireshark Memory Manager Stack
3 * Copyright 2012, Evan Huus <eapache@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __WMEM_STACK_H__
13 #define __WMEM_STACK_H__
18 #include "wmem_core.h"
19 #include "wmem_list.h"
23 #endif /* __cplusplus */
27 * @defgroup wmem-stack Stack
29 * A stack implementation on top of wmem.
34 /* Wmem stack is implemented as a simple wrapper over Wmem list */
35 typedef wmem_list_t wmem_stack_t
;
37 #define wmem_stack_count(X) wmem_list_count(X)
41 wmem_stack_peek(const wmem_stack_t
*stack
);
45 wmem_stack_pop(wmem_stack_t
*stack
);
47 #define wmem_stack_push(STACK, DATA) wmem_list_prepend((STACK), (DATA))
49 #define wmem_stack_new(ALLOCATOR) wmem_list_new(ALLOCATOR)
51 #define wmem_destroy_stack(STACK) wmem_destroy_list(STACK)
58 #endif /* __cplusplus */
60 #endif /* __WMEM_STACK_H__ */
63 * Editor modelines - https://www.wireshark.org/tools/modelines.html
68 * indent-tabs-mode: nil
71 * vi: set shiftwidth=4 tabstop=8 expandtab:
72 * :indentSize=4:tabSize=8:noTabs=true: