Add stack
This commit is contained in:
@@ -7,6 +7,16 @@
|
||||
#ifndef LIBCDSB_EXTRA_MEMORY_H
|
||||
#define LIBCDSB_EXTRA_MEMORY_H
|
||||
|
||||
typedef struct libcdsb_stack_node {
|
||||
struct libcdsb_stack_node* prev;
|
||||
void* value;
|
||||
} stack_t;
|
||||
|
||||
extern void libcdsb_stack_init (stack_t* stack);
|
||||
extern void libcdsb_stack_push (stack_t* stack, void* value);
|
||||
extern void* libcdsb_stack_pop (stack_t* stack);
|
||||
extern void libcdsb_stack_flush(stack_t* stack);
|
||||
|
||||
extern void* libcdsb_aalloc (size_t a, size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
|
||||
extern void* libcdsb_malloc (size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
|
||||
extern void* libcdsb_calloc (size_t n, size_t c) LIBCDSB_nt__ LIBCDSB_wur__;
|
||||
@@ -17,4 +27,9 @@ extern void* libcdsb_realloc(void *p, size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
|
||||
#define calloc libcdsb_calloc
|
||||
#define realloc libcdsb_realloc
|
||||
|
||||
#define stack_init libcdsb_stack_init
|
||||
#define stack_push libcdsb_stack_push
|
||||
#define stack_pop libcdsb_stack_pop
|
||||
#define stack_flush libcdsb_stack_flush
|
||||
|
||||
#endif /* LIBCDSB_EXTRA_MEMORY_H */
|
||||
|
||||
Reference in New Issue
Block a user