aoc-2019-c

Advent of Code 2019 Solutions in C
git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

allocator.h (606B)


      1#pragma once
      2
      3#include <stddef.h>
      4
      5struct allocator {
      6	void *(*alloc)(const struct allocator *allocator,
      7		size_t size, int *rc);
      8	void *(*realloc)(const struct allocator *allocator,
      9		void *p, size_t size, int *rc);
     10	int (*free)(const struct allocator *allocator, void *p);
     11};
     12
     13struct strict_allocator {
     14	const struct allocator *allocator_ul;
     15	struct allocator allocator;
     16};
     17
     18void strict_allocator_init(struct strict_allocator *strict_allocator_init,
     19	const struct allocator *allocator_ul);
     20
     21extern const struct allocator stdlib_heap_allocator;
     22extern const struct allocator stdlib_strict_heap_allocator;