diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-27 18:41:38 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-27 18:41:38 -0800 |
commit | 46fa2dd2f0d104471bbb00b8e119decd91cda71d (patch) | |
tree | 77b0fe4f1a4010a576ffea441f12cc0aa40f2c4d /env_universal_common.cpp | |
parent | 451399b3445f2a8f929bfe8893df9b3e931ac2b1 (diff) |
Migration of screen away from ad-hoc lists
Diffstat (limited to 'env_universal_common.cpp')
-rw-r--r-- | env_universal_common.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/env_universal_common.cpp b/env_universal_common.cpp index 50d72857..5fa6ebe5 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -907,6 +907,17 @@ static void add_key_to_hash( void *key, al_push( (array_list_t *)aux, key ); } +static void add_key_to_hash2( void *key, + void *data, + void *aux ) +{ + wcstring_list_t &lst = *(wcstring_list_t *)aux; + var_uni_entry_t *e = (var_uni_entry_t *)data; + if( ( e->exportv && get_names_show_exported) || + ( !e->exportv && get_names_show_unexported) ) + lst.push_back((wchar_t *)key); +} + void env_universal_common_get_names( array_list_t *l, int show_exported, int show_unexported ) @@ -919,6 +930,19 @@ void env_universal_common_get_names( array_list_t *l, l ); } +void env_universal_common_get_names2( wcstring_list_t &lst, + int show_exported, + int show_unexported ) +{ + get_names_show_exported = show_exported; + get_names_show_unexported = show_unexported; + + hash_foreach2( &env_universal_var, + add_key_to_hash2, + &lst ); +} + + wchar_t *env_universal_common_get( const wchar_t *name ) { var_uni_entry_t *e = (var_uni_entry_t *)hash_get( &env_universal_var, name ); |