regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / wmem / wmem_stack.c
blob5123aad1a812480e93095835ad5c9dd6d5c32f9f
1 /* wmem_stack.c
2 * 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 #include <string.h>
13 #include <glib.h>
15 #include "wmem-int.h"
16 #include "wmem_core.h"
17 #include "wmem_stack.h"
18 #include "wmem_list.h"
20 /* Wmem stack is implemented as a simple wrapper over Wmem list */
22 void *
23 wmem_stack_peek(const wmem_stack_t *stack)
25 wmem_list_frame_t *frame;
27 frame = wmem_list_head(stack);
29 ws_assert(frame);
31 return wmem_list_frame_data(frame);
34 void *
35 wmem_stack_pop(wmem_stack_t *stack)
37 void *data;
39 data = wmem_stack_peek(stack);
41 wmem_list_remove(stack, data);
43 return data;
47 * Editor modelines - https://www.wireshark.org/tools/modelines.html
49 * Local variables:
50 * c-basic-offset: 4
51 * tab-width: 8
52 * indent-tabs-mode: nil
53 * End:
55 * vi: set shiftwidth=4 tabstop=8 expandtab:
56 * :indentSize=4:tabSize=8:noTabs=true: