maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
Error Handling API
Collaboration diagram for Error Handling API:

Topics

 Return Values
 

Files

file  merror.h
 

Macros

#define maug_cleanup_if_null_msg(type, ptr, err, msg)
 
#define maug_cleanup_if_not_null(type, ptr, err)
 
#define maug_cleanup_if_null(type, ptr, err)
 
#define maug_cleanup_if_null_alloc(type, ptr)
 
#define maug_cleanup_if_null_lock(type, ptr)
 
#define maug_cleanup_if_null_file(ptr)
 
#define maug_cleanup_if_not_ok()
 
#define maug_cleanup_if_lt(a, b, fmt, err)
 
#define maug_cleanup_if_lt_overflow(a, b)
 
#define maug_cleanup_if_ge(a, b, fmt, err)
 
#define maug_cleanup_if_ge_overflow(a, b)
 

Detailed Description

Macro Definition Documentation

◆ maug_cleanup_if_ge

#define maug_cleanup_if_ge ( a,
b,
fmt,
err )
Value:
if( (a) >= (b) ) { \
error_printf( fmt " is greater or equal to " fmt "!", a, b ); \
retval = err; \
goto cleanup; \
}

◆ maug_cleanup_if_ge_overflow

#define maug_cleanup_if_ge_overflow ( a,
b )
Value:
maug_cleanup_if_ge( a, (size_t)(b), SIZE_T_FMT, MERROR_OVERFLOW )

◆ maug_cleanup_if_lt

#define maug_cleanup_if_lt ( a,
b,
fmt,
err )
Value:
if( (a) < (b) ) { \
error_printf( fmt " is less than " fmt "!", a, b ); \
retval = err; \
goto cleanup; \
}

◆ maug_cleanup_if_lt_overflow

#define maug_cleanup_if_lt_overflow ( a,
b )
Value:
maug_cleanup_if_lt( a, b, SIZE_T_FMT, MERROR_OVERFLOW )

◆ maug_cleanup_if_not_null

#define maug_cleanup_if_not_null ( type,
ptr,
err )
Value:
if( (type)NULL == ptr ) { \
error_printf( #ptr " is not NULL!" ); \
retval = err; \
goto cleanup; \
}

◆ maug_cleanup_if_not_ok

#define maug_cleanup_if_not_ok ( )
Value:
if( MERROR_OK != retval ) { \
goto cleanup; \
}

◆ maug_cleanup_if_null

#define maug_cleanup_if_null ( type,
ptr,
err )
Value:
maug_cleanup_if_null_msg( type, ptr, err, "failed to allocate " #ptr "!" )

◆ maug_cleanup_if_null_alloc

#define maug_cleanup_if_null_alloc ( type,
ptr )
Value:
maug_cleanup_if_null_msg( type, ptr, MERROR_ALLOC, "failed to allocate " #ptr "!" )

◆ maug_cleanup_if_null_file

#define maug_cleanup_if_null_file ( ptr)
Value:
maug_cleanup_if_null_msg( FILE*, ptr, MERROR_FILE, "failed to open FILE!" )

◆ maug_cleanup_if_null_lock

#define maug_cleanup_if_null_lock ( type,
ptr )
Value:
maug_cleanup_if_null_msg( type, ptr, MERROR_ALLOC, "failed to lock " #ptr "!" )

◆ maug_cleanup_if_null_msg

#define maug_cleanup_if_null_msg ( type,
ptr,
err,
msg )
Value:
if( (type)NULL == ptr ) { \
error_printf( msg ); \
retval = err; \
goto cleanup; \
}