Update input validation. Always use the magic CHECK macro, which prints an error message including instructions on how to report this problem.

darcs-hash:20060621004836-ac50b-a47f296634eda0c469eb39034603015b1ad7ab5c.gz
This commit is contained in:
axel
2006-06-21 10:48:36 +10:00
parent 7268a4a4e0
commit b016438c08
12 changed files with 139 additions and 224 deletions

View File

@@ -67,6 +67,26 @@ extern char *profile;
*/
extern wchar_t *program_name;
/**
This macro is used to check that an input argument is not null. It
is a bit lika a non-fatal form of assert. Instead of exit-ing on
failiure, the current function is ended at once. The second
parameter is the exit status of the current function on failiure.
*/
#define CHECK( arg, retval ) \
if( !(arg) ) \
{ \
debug( 1, \
L"function %s called with null value for argument %s. " \
L"This is a bug. " \
L"If you can reproduce it, please send a bug report to %s.", \
__func__, \
#arg, \
PACKAGE_BUGREPORT ); \
return retval; \
} \
/**
Take an array_list_t containing wide strings and converts them to a
single null-terminated wchar_t **. The array is allocated using