diff options
author | 2006-06-21 10:48:36 +1000 | |
---|---|---|
committer | 2006-06-21 10:48:36 +1000 | |
commit | b016438c08877cb3b24808d260397a8aa8fe49ce (patch) | |
tree | 7d8879449234a75e28b4295725a3df411dcbb3aa /common.c | |
parent | 7268a4a4e0ddb8ed10df20005cd78c90e900802f (diff) |
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
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 33 |
1 files changed, 9 insertions, 24 deletions
@@ -495,12 +495,8 @@ int contains_str( const wchar_t *a, ... ) va_list va; int res = 0; - if( !a ) - { - debug( 0, L"%s called with null input", __func__ ); - return 0; - } - + CHECK( a, 0 ); + va_start( va, a ); while( (arg=va_arg(va, wchar_t *) )!= 0 ) { @@ -546,12 +542,8 @@ void debug( int level, const wchar_t *msg, ... ) string_buffer_t sb; string_buffer_t sb2; - if( !msg ) - { - debug( 0, L"%s called with null input", __func__ ); - return; - } - + CHECK( msg, ); + if( level > debug_level ) return; @@ -578,12 +570,9 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff ) int tok_width = 0; int screen_width = common_get_width(); - if( !msg || !buff ) - { - debug( 0, L"%s called with null input", __func__ ); - return; - } - + CHECK( msg, ); + CHECK( buff, ); + if( screen_width ) { start = pos = msg; @@ -799,12 +788,8 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special ) wchar_t prev=0; wchar_t *in; - if( !orig ) - { - debug( 0, L"%s called with null input", __func__ ); - return 0; - } - + CHECK( orig, 0 ); + len = wcslen( orig ); in = wcsdup( orig ); |