forked from osmocom/wireshark
Remove now-unused ephemeral stack code. And another one bites the dust...
svn path=/trunk/; revision=54436
This commit is contained in:
parent
7151a4d99e
commit
18f94609d8
44
epan/emem.c
44
epan/emem.c
|
@ -1272,50 +1272,6 @@ se_free_all(void)
|
|||
emem_free_all(&se_packet_mem);
|
||||
}
|
||||
|
||||
ep_stack_t
|
||||
ep_stack_new(void) {
|
||||
ep_stack_t s = ep_new(struct _ep_stack_frame_t*);
|
||||
*s = ep_new0(struct _ep_stack_frame_t);
|
||||
return s;
|
||||
}
|
||||
|
||||
/* for ep_stack_t we'll keep the popped frames so we reuse them instead
|
||||
of allocating new ones.
|
||||
*/
|
||||
|
||||
void *
|
||||
ep_stack_push(ep_stack_t stack, void* data)
|
||||
{
|
||||
struct _ep_stack_frame_t* frame;
|
||||
struct _ep_stack_frame_t* head = (*stack);
|
||||
|
||||
if (head->above) {
|
||||
frame = head->above;
|
||||
} else {
|
||||
frame = ep_new(struct _ep_stack_frame_t);
|
||||
head->above = frame;
|
||||
frame->below = head;
|
||||
frame->above = NULL;
|
||||
}
|
||||
|
||||
frame->payload = data;
|
||||
(*stack) = frame;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void *
|
||||
ep_stack_pop(ep_stack_t stack)
|
||||
{
|
||||
|
||||
if ((*stack)->below) {
|
||||
(*stack) = (*stack)->below;
|
||||
return (*stack)->above->payload;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
emem_tree_t *
|
||||
se_tree_create(int type, const char *name)
|
||||
{
|
||||
|
|
35
epan/emem.h
35
epan/emem.h
|
@ -102,41 +102,6 @@ gchar** ep_strsplit(const gchar* string, const gchar* delimiter, int max_tokens)
|
|||
/** release all memory allocated in the previous packet dissection */
|
||||
void ep_free_all(void);
|
||||
|
||||
|
||||
/** a stack implemented using ephemeral allocators */
|
||||
|
||||
typedef struct _ep_stack_frame_t** ep_stack_t;
|
||||
|
||||
struct _ep_stack_frame_t {
|
||||
void* payload;
|
||||
struct _ep_stack_frame_t* below;
|
||||
struct _ep_stack_frame_t* above;
|
||||
};
|
||||
|
||||
/**
|
||||
* creates an empty stack with a packet lifetime scope
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
ep_stack_t ep_stack_new(void) G_GNUC_MALLOC;
|
||||
|
||||
/**
|
||||
* pushes item into stack, returns item
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
void* ep_stack_push(ep_stack_t stack, void* item);
|
||||
|
||||
/**
|
||||
* pops an item from the stack
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
void* ep_stack_pop(ep_stack_t stack);
|
||||
|
||||
/**
|
||||
* returns the item on top of the stack without popping it
|
||||
*/
|
||||
#define ep_stack_peek(stack) ((*(stack))->payload)
|
||||
|
||||
|
||||
/* Functions for handling memory allocation and garbage collection with
|
||||
* a capture lifetime scope.
|
||||
* These functions are used to allocate memory that will only remain persistent
|
||||
|
|
Loading…
Reference in New Issue