Derive-C
Loading...
Searching...
No Matches
std.h File Reference
#include <derive-c/core/helpers.h>
#include <derive-c/core/panic.h>
#include <stdlib.h>
Include dependency graph for std.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stdalloc
 An allocator for the standard allocator, which only has global state,. More...

Functions

static stdallocget ()
static void * malloc (stdalloc *DEBUG_UNUSED(self), size_t size)
static void * realloc (stdalloc *DEBUG_UNUSED(self), void *ptr, size_t size)
static void * calloc (stdalloc *DEBUG_UNUSED(self), size_t count, size_t size)
static void free (stdalloc *DEBUG_UNUSED(self), void *ptr)

Function Documentation

◆ calloc()

void * calloc ( stdalloc * DEBUG_UNUSEDself,
size_t count,
size_t size )
static

Definition at line 37 of file std.h.

37 {
38 DEBUG_ASSERT(self);
39 return calloc(count, size);
40}
static void * calloc(stdalloc *DEBUG_UNUSED(self), size_t count, size_t size)
Definition std.h:37
#define DEBUG_ASSERT(expr)
Definition panic.h:34
static INDEX_TYPE size(SELF const *self)
Definition template.h:220
Here is the call graph for this function:
Here is the caller graph for this function:

◆ free()

void free ( stdalloc * DEBUG_UNUSEDself,
void * ptr )
static

Definition at line 42 of file std.h.

42 {
43 DEBUG_ASSERT(self);
44 DEBUG_ASSERT(ptr);
45 free(ptr);
46}
static void free(stdalloc *DEBUG_UNUSED(self), void *ptr)
Definition std.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

stdalloc * get ( )
static

Definition at line 19 of file std.h.

19 {
20 static stdalloc instance = {};
21 return &instance;
22}
An allocator for the standard allocator, which only has global state,.
Definition std.h:15
Here is the call graph for this function:

◆ malloc()

void * malloc ( stdalloc * DEBUG_UNUSEDself,
size_t size )
static

Definition at line 24 of file std.h.

24 {
25 DEBUG_ASSERT(self);
26 return malloc(size);
27}
static void * malloc(stdalloc *DEBUG_UNUSED(self), size_t size)
Definition std.h:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ realloc()

void * realloc ( stdalloc * DEBUG_UNUSEDself,
void * ptr,
size_t size )
static

Definition at line 29 of file std.h.

29 {
30 DEBUG_ASSERT(self);
31 if (ptr) {
32 return realloc(ptr, size);
33 }
34 return NS(stdalloc, malloc)(self, size);
35}
static void * malloc(SELF *self, size_t size)
Definition template.h:23
static void * realloc(stdalloc *DEBUG_UNUSED(self), void *ptr, size_t size)
Definition std.h:29
#define NS(pre, post)
Definition helpers.h:6
Here is the call graph for this function:
Here is the caller graph for this function: