maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
Memory Management API

Files

file  mmem.h
 

Macros

#define maug_malloc(nmemb, sz)
 
#define maug_mrealloc(handle, nmemb, sz)
 
#define maug_mzero(ptr, sz)
 Zero the block of memory pointed to by ptr.
 
#define maug_mcpy(ptr_dest, ptr_src, sz)
 
#define maug_mfree(handle)
 
#define maug_mlock(handle, ptr)
 
#define maug_munlock(handle, ptr)
 
#define maug_strncpy(dest, src, len)
 
#define maug_strlen(str)
 
#define maug_mrealloc_test(new_handle, handle, nmemb, sz)
 

Typedefs

typedef void * MAUG_MHANDLE
 

Functions

char * maug_strchr (const char *str, char c)
 
char * maug_strrchr (const char *str, char c)
 

Detailed Description

Macro Definition Documentation

◆ maug_malloc

#define maug_malloc ( nmemb,
sz )
Value:
(void*)malloc( sz * nmemb )

◆ maug_mcpy

#define maug_mcpy ( ptr_dest,
ptr_src,
sz )
Value:
memcpy( ptr_dest, ptr_src, sz )

◆ maug_mfree

#define maug_mfree ( handle)
Value:
free( handle ); handle = NULL;

◆ maug_mlock

#define maug_mlock ( handle,
ptr )
Value:
ptr = handle; handle = NULL;

◆ maug_mrealloc

#define maug_mrealloc ( handle,
nmemb,
sz )
Value:
(void*)realloc( handle, (sz) * (nmemb) )

\warn This does not test that reallocation was successful! Use maug_mrealloc_test() for that.

◆ maug_mrealloc_test

#define maug_mrealloc_test ( new_handle,
handle,
nmemb,
sz )
Value:
maug_cleanup_if_lt_overflow( (sz) * (nmemb), sz ); \
new_handle = maug_mrealloc( handle, nmemb, sz ); \
maug_cleanup_if_null_alloc( MAUG_MHANDLE, new_handle ); \
handle = new_handle;
#define maug_mrealloc(handle, nmemb, sz)
Definition mmem.h:54

◆ maug_munlock

#define maug_munlock ( handle,
ptr )
Value:
handle = ptr; ptr = NULL;

◆ maug_mzero

#define maug_mzero ( ptr,
sz )
Value:
memset( ptr, '\0', sz )

Zero the block of memory pointed to by ptr.

\warn This should be used on pointers, not handles!

◆ maug_strlen

#define maug_strlen ( str)
Value:
strlen( str )

◆ maug_strncpy

#define maug_strncpy ( dest,
src,
len )
Value:
strncpy( dest, src, len )