Last change
on this file since bd686f0 was
fd54fef,
checked in by Michael Brooks <mlbrooks@…>, 4 years ago
|
Converting the project to use the new syntax for otype, dtype and ttytpe.
Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.
|
-
Property mode set to
100644
|
File size:
343 bytes
|
Line | |
---|
1 | |
---|
2 | #include <stdbool.h> |
---|
3 | #include <stdlib.hfa> |
---|
4 | |
---|
5 | trait allocator_c(T, allocator_t) |
---|
6 | { |
---|
7 | void realloc(allocator_t* const, size_t); |
---|
8 | }; |
---|
9 | |
---|
10 | forall(T) |
---|
11 | struct heap_allocator |
---|
12 | { |
---|
13 | T* storage; |
---|
14 | size_t capacity; |
---|
15 | }; |
---|
16 | |
---|
17 | forall(T) |
---|
18 | inline 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.