From 029c8c06c2eca98a78183965f194350627ef8f32 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 8 Feb 2012 00:59:46 -0800 Subject: [PATCH] Remove old env_get_names implementation --- env.cpp | 106 -------------------------------------------------------- env.h | 1 - 2 files changed, 107 deletions(-) diff --git a/env.cpp b/env.cpp index 80aabc70d..a3e8d4f4a 100644 --- a/env.cpp +++ b/env.cpp @@ -1477,112 +1477,6 @@ void env_pop() } -/** - Function used with hash_foreach to insert keys of one table into - another -*/ -static void add_key_to_hash( void *key, - void *data, - void *aux ) -{ - var_entry_t *e = (var_entry_t *)data; - if( ( e->exportv && get_names_show_exported) || - ( !e->exportv && get_names_show_unexported) ) - { - hash_put( (hash_table_t *)aux, key, 0 ); - } -} - -/** - Add key to hashtable -*/ -static void add_to_hash( void *k, void *aux ) -{ - hash_put( (hash_table_t *)aux, - k, - 0 ); -} - -void env_get_names( array_list_t *l, int flags ) -{ - int show_local = flags & ENV_LOCAL; - int show_global = flags & ENV_GLOBAL; - int show_universal = flags & ENV_UNIVERSAL; - - hash_table_t names; - env_node_t *n=top; - - CHECK( l, ); - - get_names_show_exported = - flags & ENV_EXPORT|| (!(flags & ENV_UNEXPORT)); - get_names_show_unexported = - flags & ENV_UNEXPORT|| (!(flags & ENV_EXPORT)); - - if( !show_local && !show_global && !show_universal ) - { - show_local =show_universal = show_global=1; - } - - hash_init( &names, &hash_wcs_func, &hash_wcs_cmp ); - - if( show_local ) - { - while( n ) - { - if( n == global_env ) - break; - - hash_foreach2( &n->env, - add_key_to_hash, - &names ); - - if( n->new_scope ) - break; - else - n = n->next; - - } - } - - if( show_global ) - { - hash_foreach2( &global_env->env, - add_key_to_hash, - &names ); - - if( get_names_show_unexported ) { - for (std::set::iterator iter = env_electric.begin(); iter != env_electric.end(); iter++) { - al_push( l, iter->c_str() ); - } - } - - if( get_names_show_exported ) - { - al_push( l, L"COLUMNS" ); - al_push( l, L"LINES" ); - } - - } - - if( show_universal ) - { - array_list_t uni_list; - al_init( &uni_list ); - - env_universal_get_names( &uni_list, - get_names_show_exported, - get_names_show_unexported ); - - al_foreach2( &uni_list, &add_to_hash, &names ); - al_destroy( &uni_list ); - } - - hash_get_keys( &names, l ); - hash_destroy( &names ); -} - - /** Function used with hash_foreach to insert keys of one table into a set::set diff --git a/env.h b/env.h index 988354a73..a5ac97b48 100644 --- a/env.h +++ b/env.h @@ -155,7 +155,6 @@ char **env_export_arr( int recalc ); /** Insert all variable names into l. These are not copies of the strings and should not be freed after use. */ -void env_get_names( array_list_t *l, int flags ); wcstring_list_t env_get_names( int flags ); /**