#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 (nullalloc) |
| | An allocator for the standard allocator, which only has global state,.
|
| static nullalloc | get () |
| static void * | malloc (nullalloc *self, size_t size) |
| static void * | realloc (nullalloc *self, void *ptr, size_t size) |
| static void * | calloc (nullalloc *self, size_t count, size_t size) |
| static void | free (nullalloc *self, void *ptr) |
| static void | debug (nullalloc const *self, dc_debug_fmt fmt, FILE *stream) |
| | DC_TRAIT_ALLOC (nullalloc) |
◆ calloc()
| void * calloc |
( |
nullalloc * | self, |
|
|
size_t | count, |
|
|
size_t | size ) |
|
static |
Definition at line 29 of file null.h.
29 {
30 (void)count;
33 return NULL;
34}
static INDEX_TYPE size(SELF const *self)
#define DC_ASSUME(expr,...)
◆ DC_TRAIT_ALLOC()
| DC_TRAIT_ALLOC |
( |
nullalloc | | ) |
|
◆ DC_ZERO_SIZED()
| DC_ZERO_SIZED |
( |
nullalloc | | ) |
|
An allocator for the standard allocator, which only has global state,.
◆ debug()
| void debug |
( |
nullalloc const * | self, |
|
|
dc_debug_fmt | fmt, |
|
|
FILE * | stream ) |
|
static |
Definition at line 42 of file null.h.
42 {
43 (void)fmt;
44 fprintf(
stream,
"nullalloc@%p { }", self);
45}
static FILE * stream(SELF *self)
Opens a file for.
◆ free()
| void free |
( |
nullalloc * | self, |
|
|
void * | ptr ) |
|
static |
Definition at line 36 of file null.h.
36 {
37 (void)ptr;
39 DC_PANIC(
"Not possible to free memory from the null allocator, as it allocates nothing")
40}
◆ get()
Definition at line 14 of file null.h.
14{ return (nullalloc){}; }
◆ malloc()
| void * malloc |
( |
nullalloc * | self, |
|
|
size_t | size ) |
|
static |
◆ realloc()
| void * realloc |
( |
nullalloc * | self, |
|
|
void * | ptr, |
|
|
size_t | size ) |
|
static |