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

32
env.c
View File

@@ -627,12 +627,8 @@ int env_set( const wchar_t *key,
event_t ev;
int is_universal = 0;
if( !key )
{
debug( 0, L"%s called with null input", __func__ );
return ENV_INVALID;
}
CHECK( key, ENV_INVALID );
if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
@@ -877,12 +873,8 @@ int env_remove( const wchar_t *key, int var_mode )
env_node_t *first_node;
int erased = 0;
if( !key )
{
debug( 0, L"%s called with null input", __func__ );
return 1;
}
CHECK( key, 1 );
if( (var_mode & ENV_USER ) &&
hash_get( &env_read_only, key ) )
{
@@ -941,12 +933,8 @@ wchar_t *env_get( const wchar_t *key )
env_node_t *env = top;
wchar_t *item;
if( !key )
{
debug( 0, L"%s called with null input", __func__ );
return 0;
}
CHECK( key, 0 );
if( wcscmp( key, L"history" ) == 0 )
{
wchar_t *current;
@@ -1045,12 +1033,8 @@ int env_exist( const wchar_t *key, int mode )
env_node_t *env;
wchar_t *item=0;
if( !key )
{
debug( 0, L"%s called with null input", __func__ );
return 0;
}
CHECK( key, 0 );
/*
Read only variables all exist, and they are all global. A local
version can not exist.