aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin_set.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-03 18:39:41 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-03 18:39:41 -0800
commitfb63c3908c80a0804b4f8b60bcbf607171934f4b (patch)
tree52cc77f8f6be76b0b53c9979098eec0c17003e4d /builtin_set.cpp
parent623eb42a6aaab967cf856f7e7f2f6fc7f38b4b3f (diff)
Minor cleanup of background_highlight_context_t
Diffstat (limited to 'builtin_set.cpp')
-rw-r--r--builtin_set.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/builtin_set.cpp b/builtin_set.cpp
index 681d0d9f..18ee5993 100644
--- a/builtin_set.cpp
+++ b/builtin_set.cpp
@@ -414,19 +414,12 @@ static void erase_values(wcstring_list_t &list, std::vector<long> &indexes)
{
size_t i;
wcstring_list_t result;
-
-// al_init(&result);
-
for (i = 0; i < list.size(); i++)
{
if (std::find(indexes.begin(), indexes.end(), i + 1) != indexes.end())
{
result.push_back( list[ i ] );
}
- else
- {
-// free( (void *)al_get(list, i));
- }
}
// al_truncate(list,0);
@@ -443,24 +436,19 @@ static void erase_values(wcstring_list_t &list, std::vector<long> &indexes)
*/
static void print_variables(int include_values, int esc, int scope)
{
- array_list_t names;
- int i;
-
- al_init( &names );
- env_get_names( &names, scope );
-
- sort_list( &names );
+ wcstring_list_t names = env_get_names(scope);
+ sort(names.begin(), names.end());
- for( i = 0; i < al_get_count(&names); i++ )
+ for( size_t i = 0; i < names.size(); i++ )
{
- wchar_t *key = (wchar_t *)al_get( &names, i );
- wchar_t *e_key = esc ? escape(key, 0) : wcsdup(key);
+ const wcstring key = names.at(i);
+ const wcstring e_key = escape_string(key, 0);
- sb_append(sb_out, e_key);
+ sb_append(sb_out, e_key.c_str());
if( include_values )
{
- env_var_t value = env_get_string(key);
+ env_var_t value = env_get_string(key.c_str());
if( !value.missing() )
{
int shorten = 0;
@@ -484,9 +472,7 @@ static void print_variables(int include_values, int esc, int scope)
}
sb_append(sb_out, L"\n");
- free(e_key);
}
- al_destroy(&names);
}