diff options
author | 2006-06-21 07:20:16 +1000 | |
---|---|---|
committer | 2006-06-21 07:20:16 +1000 | |
commit | 7268a4a4e0ddb8ed10df20005cd78c90e900802f (patch) | |
tree | 40f66a1a592742702fd48643afb2b29433e63fec /wildcard.c | |
parent | 51c6c5ea4944f60aeaf755db4b98462df5e51a45 (diff) |
Various code polish, including minor rearangement of builtin code to export fewer functions, a few additional input checks, and removal of the unneeded, exported error_max variable
darcs-hash:20060620212016-ac50b-f76c10eea23fab14a648ea83ed0c83a171b8fef9.gz
Diffstat (limited to 'wildcard.c')
-rw-r--r-- | wildcard.c | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -70,6 +70,12 @@ static void al_push_check( array_list_t *l, const wchar_t *new ) int wildcard_has( const wchar_t *str, int internal ) { wchar_t prev=0; + if( !str ) + { + debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); + return 0; + } + if( internal ) { for( ; *str; str++ ) @@ -162,19 +168,7 @@ static int wildcard_complete_internal( const wchar_t *orig, const wchar_t *(*desc_func)(const wchar_t *), array_list_t *out ) { - if( !wc ) - { - debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); - return 0; - } - - if( !str ) - { - debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); - return 0; - } - - if( !orig ) + if( !wc || !str || !orig) { debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); return 0; @@ -318,6 +312,11 @@ static void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd ) } ; + if( !fn || !sb ) + { + debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); + return; + } sb_clear( sb ); @@ -437,6 +436,12 @@ int wildcard_expand( const wchar_t *wc, // debug( 3, L"WILDCARD_EXPAND %ls in %ls", wc, base_dir ); + if( !wc || !base_dir || !out) + { + debug( 2, L"Got null string on line %d of file %s", __LINE__, __FILE__ ); + return 0; + } + if( flags & ACCEPT_INCOMPLETE ) { /* |