libcdsb/include/bits/memory.h

30 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_BITS_MEMORY_H
#define LIBCDSB_BITS_MEMORY_H
typedef struct libcdsb_stack_node {
struct libcdsb_stack_node* prev;
void* value;
} stack_t;
extern void libcdsb_stack_init (stack_t* stack) Nonnull__(1);
extern void libcdsb_stack_push (stack_t* stack, void* value) Nonnull__(1);
extern void libcdsb_stack_push_many(stack_t* stack, size_t n, ...) Nonnull__(1);
extern void* libcdsb_stack_pop (stack_t* stack) Nonnull__(1);
extern void libcdsb_stack_reverse (stack_t* stack) Nonnull__(1);
extern void libcdsb_stack_flush (stack_t* stack) Nonnull__(1);
extern void* libcdsb_aalloc (size_t a, size_t n) Warn_unused_result__;
extern void* libcdsb_malloc (size_t n) Warn_unused_result__;
extern void* libcdsb_calloc (size_t n, size_t c) Warn_unused_result__;
extern void* libcdsb_realloc(void *p, size_t n) Warn_unused_result__;
extern void libcdsb_free(void* s);
#endif /* LIBCDSB_BITS_MEMORY_H */