diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-08 00:59:46 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-08 00:59:46 -0800 |
commit | 029c8c06c2eca98a78183965f194350627ef8f32 (patch) | |
tree | 7749756c25b01f2aca46d4ae07e58305b83f6276 /env.cpp | |
parent | 063fc0c48bd3c9c3bb2233f71c389281a66414a3 (diff) |
Remove old env_get_names implementation
Diffstat (limited to 'env.cpp')
-rw-r--r-- | env.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
@@ -1479,112 +1479,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<wcstring>::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<wcstring> */ static void add_key_to_string_set( void *key, |