Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
vmalloc.c File Reference
#include <vmalloc/vmalloc.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for vmalloc.c:

Go to the source code of this file.

Functions

static bool make_space (Vmalloc_t *vm)
 
void * vmalloc (Vmalloc_t *vm, size_t size)
 
void vmfree (Vmalloc_t *vm, void *data)
 

Function Documentation

◆ make_space()

static bool make_space ( Vmalloc_t vm)
static

make room to store a new pointer we are about to allocate

Parameters
vmVmalloc to operate on
Returns
true on success

Definition at line 21 of file vmalloc.c.

References _vmalloc_s::allocated, _vmalloc_s::capacity, NULL, and _vmalloc_s::size.

Referenced by vmalloc().

Here is the caller graph for this function:

◆ vmalloc()

void * vmalloc ( Vmalloc_t vm,
size_t  size 
)

allocate heap memory

Parameters
vmregion allocating from
sizedesired block size
Returns
Memory fulfilling the allocation request or NULL on failure

Definition at line 40 of file vmalloc.c.

References _vmalloc_s::allocated, make_space(), malloc(), NULL, and _vmalloc_s::size.

Referenced by eval(), exprintf(), exsplit(), exstralloc(), exsubstr(), extokens(), prformat(), scformat(), str_add(), str_and(), str_ior(), str_mod(), str_mpy(), str_xor(), and vmstrdup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vmfree()

void vmfree ( Vmalloc_t vm,
void *  data 
)

free heap memory

Parameters
vmRegion the pointer was originally allocated from
dataThe pointer originally received from vmalloc

Definition at line 57 of file vmalloc.c.

References _vmalloc_s::allocated, free(), and _vmalloc_s::size.

Referenced by eval(), prformat(), and scformat().

Here is the call graph for this function:
Here is the caller graph for this function: