fred-mod-eppd
Functions
Functions for memory allocation.

A memory allocated by these functions is automatically freed when processing of request is finished. More...

Functions

void * epp_malloc (void *pool, unsigned size)
 
void * epp_calloc (void *pool, unsigned size)
 
char * epp_strdup (void *pool, const char *str)
 
char * epp_strcat (void *pool, const char *str1, const char *str2)
 
char * epp_sprintf (void *pool, const char *fmt,...)
 

Detailed Description

A memory allocated by these functions is automatically freed when processing of request is finished.

Function Documentation

◆ epp_calloc()

void* epp_calloc ( void *  pool,
unsigned  size 
)

Allocate memory from memory pool and prezero it.

Parameters
poolMemory pool.
sizeNumber of bytes to allocate.
Returns
Pointer to allocated memory.

Wrapper around apache's apr_pcalloc() which allocates memory from a pool.

This function is exported in header file to be used by other modules which are not aware of apache pools.

Parameters
poolApache pool pointer.
sizeSize of chunk to allocate.
Returns
Allocated chunk.

◆ epp_malloc()

void* epp_malloc ( void *  pool,
unsigned  size 
)

Allocate memory from memory pool.

Parameters
poolMemory pool.
sizeNumber of bytes to allocate.
Returns
Pointer to allocated memory.

◆ epp_sprintf()

char* epp_sprintf ( void *  pool,
const char *  fmt,
  ... 
)

Print formatted string.

Parameters
poolMemory pool.
fmtFormat of string.
Returns
Formatted string allocated from pool.

Wrapper around apache's apr_pvsprintf() which prints formated string.

This function is exported in header file to be used by other modules which are not aware of apache pools.

Parameters
poolApache pool pointer.
fmtFormat of string.
Returns
Formatted string allocated from pool.

◆ epp_strcat()

char* epp_strcat ( void *  pool,
const char *  str1,
const char *  str2 
)

Concatenate two strings in arguments, the memory will be allocated from memory pool.

In case of memory allocation failure or if one of arguments is NULL the function returns NULL.

Parameters
poolMemory pool.
str1String which will be the first one.
str2String which will be appended.
Returns
Pointer to new string.

Wrapper around apache's apr_pstrcat() which concatenates strings.

This function is exported in header file to be used by other modules which are not aware of apache pools.

Parameters
poolApache pool pointer.
str1First concatenated string.
str2Second concatenated string.
Returns
Duplicated string.

◆ epp_strdup()

char* epp_strdup ( void *  pool,
const char *  str 
)

Duplicate string from argument, the memory will be allocated from memory pool.

Parameters
poolMemory pool.
strString which is going to be duplicated.
Returns
Pointer duplicated string.

Wrapper around apache's apr_strdup() which allocates memory from a pool.

This function is exported in header file to be used by other modules which are not aware of apache pools.

Parameters
poolApache pool pointer.
strString which is going to be duplicated.
Returns
Duplicated string.