Verilog Parser

Helps to manage memory allocated during AST construction. More...

Functions

void * ast_calloc (size_t num, size_t size)
 A simple wrapper around calloc. More...
 
void ast_free_all ()
 Frees all memory allocated using ast_calloc. More...
 
char * ast_strdup (char *in)
 Duplicates the supplied null terminated string.
 

Variables

unsigned int memory_allocations = 0
 The total number of memory allocations made.
 
ast_memory * memory_head = NULL
 Head of the linked list of allocated memory.
 
size_t total_allocated = 0
 The total number of bytes ever allocated using ast_alloc.
 
ast_memory * walker = NULL
 Walker for the linked list of allocated memory.
 

Detailed Description

Helps to manage memory allocated during AST construction.

Function Documentation

void* ast_calloc ( size_t  num,
size_t  size 
)

A simple wrapper around calloc.

Makes it very easy to clean up afterward using the ast_free_all function.

Parameters
[in]num- Number of elements to allocate space for.
[in]size- The size of each element being allocated.
Returns
A pointer to the start of the block of memory allocated.
void ast_free_all ( )

Frees all memory allocated using ast_calloc.

Iterates over all allocated memory and frees it.

Free's all data stored in the linked list pointed to by the head variable.

Postcondition
walker and head are NULL. All memory allocated by ast_calloc has been freed.