aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-26 01:21:10 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-26 01:21:10 -0700
commit0bc644abf06d1cf903ed7bf59302894f80d18971 (patch)
treeda229cd4505d34800af22e10c8f61d380d6a88b3 /env.cpp
parent31b7d076b7bff8d7bb81e6a1fff58755b7baa10b (diff)
Fix lots of bugs related to the static analyzer
Improved how screen.cpp interacts with output_set_writer()
Diffstat (limited to 'env.cpp')
-rw-r--r--env.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/env.cpp b/env.cpp
index 1450b68d..034a72f0 100644
--- a/env.cpp
+++ b/env.cpp
@@ -708,15 +708,12 @@ void env_destroy()
*/
static env_node_t *env_get_node( const wcstring &key )
{
- var_entry_t* res = NULL;
env_node_t *env = top;
-
-
- while( env != 0 )
+ while( env != NULL )
{
if ( env->env.find( key ) != env->env.end() )
{
- return env;
+ break;
}
if( env->new_scope )
@@ -728,8 +725,7 @@ static env_node_t *env_get_node( const wcstring &key )
env = env->next;
}
}
-
- return 0;
+ return env;
}
int env_set(const wchar_t *key, const wchar_t *val, int var_mode)
@@ -817,15 +813,10 @@ int env_set(const wchar_t *key, const wchar_t *val, int var_mode)
node = env_get_node( key );
if( node )
{
-
var_table_t::iterator result = node->env.find(key);
- if ( result != node->env.end() ) {
- e = result->second;
- }
- else {
- e = NULL;
- }
-
+ assert(result != node->env.end());
+ e = result->second;
+
if( e->exportv )
{
has_changed_new = true;