libcdsb/include/bits/memory.h

29 lines
1.1 KiB
C
Raw Normal View History

2022-06-02 11:20:55 +00:00
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <stddef.h>
2022-08-22 08:56:16 +00:00
#include "__attributes.h"
2022-06-02 11:20:55 +00:00
2022-08-22 08:56:16 +00:00
#ifndef LIBCDSB_BITS_MEMORY_H
#define LIBCDSB_BITS_MEMORY_H
2022-06-02 11:20:55 +00:00
2022-06-07 18:35:13 +00:00
typedef struct libcdsb_stack_node {
struct libcdsb_stack_node* prev;
void* value;
} stack_t;
2022-08-17 21:08:10 +00:00
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_flush (stack_t* stack) Nonnull__(1);
2022-08-15 22:36:37 +00:00
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__;
2022-06-02 11:20:55 +00:00
2022-08-17 19:20:04 +00:00
extern void libcdsb_free(void* s);
2022-08-22 08:56:16 +00:00
#endif /* LIBCDSB_BITS_MEMORY_H */