#include <stdio.h>
#include <stdlib.h>
#include <derive-c/alloc/trait.h>
#include <derive-c/core/prelude.h>
Go to the source code of this file.
|
| | DC_ZERO_SIZED (stdalloc) |
| | An allocator for the standard allocator, which only has global state,.
|
| static stdalloc * | get () |
| static void * | malloc (stdalloc *self, size_t size) |
| static void * | realloc (stdalloc *self, void *ptr, size_t size) |
| static void * | calloc (stdalloc *self, size_t count, size_t size) |
| static void | free (stdalloc *self, void *ptr) |
| static void | debug (stdalloc const *self, dc_debug_fmt fmt, FILE *stream) |
| | DC_TRAIT_ALLOC (stdalloc) |
◆ calloc()
| void * calloc |
( |
stdalloc * | self, |
|
|
size_t | count, |
|
|
size_t | size ) |
|
static |
Definition at line 32 of file std.h.
32 {
35}
static INDEX_TYPE size(SELF const *self)
#define DC_ASSUME(expr,...)
static void * calloc(stdalloc *self, size_t count, size_t size)
◆ DC_TRAIT_ALLOC()
| DC_TRAIT_ALLOC |
( |
stdalloc | | ) |
|
◆ DC_ZERO_SIZED()
| DC_ZERO_SIZED |
( |
stdalloc | | ) |
|
An allocator for the standard allocator, which only has global state,.
◆ debug()
| void debug |
( |
stdalloc const * | self, |
|
|
dc_debug_fmt | fmt, |
|
|
FILE * | stream ) |
|
static |
Definition at line 43 of file std.h.
43 {
44 (void)fmt;
45 fprintf(
stream,
"stdalloc@%p { }", self);
46}
static FILE * stream(SELF *self)
Opens a file for.
◆ free()
| void free |
( |
stdalloc * | self, |
|
|
void * | ptr ) |
|
static |
Definition at line 37 of file std.h.
37 {
41}
static void free(stdalloc *self, void *ptr)
◆ get()
Definition at line 14 of file std.h.
14 {
15 static stdalloc instance = {};
16 return &instance;
17}
◆ malloc()
| void * malloc |
( |
stdalloc * | self, |
|
|
size_t | size ) |
|
static |
Definition at line 19 of file std.h.
19 {
22}
static void * malloc(stdalloc *self, size_t size)
◆ realloc()
| void * realloc |
( |
stdalloc * | self, |
|
|
void * | ptr, |
|
|
size_t | size ) |
|
static |
Definition at line 24 of file std.h.
24 {
26 if (ptr) {
28 }
30}
static void * malloc(SELF *self, size_t size)
static void * realloc(stdalloc *self, void *ptr, size_t size)