source: src/examples/gc_no_raii/bug-repro/blockers/recursive_realloc.c @ 28bc8c8

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 28bc8c8 was e8b15358, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

new set of bug repros for resolver bugs

  • Property mode set to 100644
File size: 363 bytes
Line 
1
2#include <stdbool.h>
3#include <stdlib>
4
5trait allocator_c(otype T, otype allocator_t)
6{
7        void realloc(allocator_t* const, size_t);
8};
9
10forall(otype T)
11struct heap_allocator
12{
13        T* storage;
14        size_t capacity;
15};
16
17forall(otype T)
18inline void realloc(heap_allocator(T) *const this, size_t size)
19{
20        this->storage = (T*)realloc((void*)this->storage, this->capacity);
21}
Note: See TracBrowser for help on using the repository browser.