Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
vmalloc.h File Reference
#include <stddef.h>
Include dependency graph for vmalloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _vmalloc_s
 

Typedefs

typedef struct _vmalloc_s Vmalloc_t
 

Functions

Vmalloc_tvmopen (void)
 
void vmclose (Vmalloc_t *)
 
void vmclear (Vmalloc_t *)
 
void * vmalloc (Vmalloc_t *vm, size_t size)
 
void vmfree (Vmalloc_t *vm, void *data)
 
char * vmstrdup (Vmalloc_t *, const char *)
 

Typedef Documentation

◆ Vmalloc_t

typedef struct _vmalloc_s Vmalloc_t

Definition at line 24 of file vmalloc.h.

Function Documentation

◆ 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:

◆ vmclear()

void vmclear ( Vmalloc_t vm)
extern

Clear out all allocated space.

Note that this leaves the allocation region itself usable, but just frees all previous allocations made within this region.

Parameters
vmVmalloc to operate on

Definition at line 21 of file vmclear.c.

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

Referenced by vmclose().

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

◆ vmclose()

void vmclose ( Vmalloc_t vm)
extern

Close down a region.

Parameters
vmVmalloc to operate on

Definition at line 18 of file vmclose.c.

References free(), and vmclear().

Here is the call 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:

◆ vmopen()

Vmalloc_t * vmopen ( void  )
extern

Open a new region of allocation.

Returns
A newly allocated Vmalloc or NULL on failure

Definition at line 18 of file vmopen.c.

References NULL.

Referenced by exopen().

Here is the caller graph for this function:

◆ vmstrdup()

char * vmstrdup ( Vmalloc_t v,
const char *  s 
)
extern

Definition at line 19 of file vmstrdup.c.

References len(), NULL, and vmalloc().

Referenced by eval(), exstring(), exsub(), extoken_fn(), and prformat().

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