36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
/* This software is licensed by the MIT License, see LICENSE file */
|
|
/* Copyright © 2022 Gregory Lirent */
|
|
|
|
#include <stddef.h>
|
|
#include "../__attributes.h"
|
|
|
|
#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__;
|
|
extern void* libcdsb_realloc(void *p, size_t n) LIBCDSB_nt__ LIBCDSB_wur__;
|
|
|
|
#define aligned_alloc libcdsb_aalloc
|
|
#define malloc libcdsb_malloc
|
|
#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 */
|