diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 18:06:20 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 18:06:20 -0800 |
commit | beece6a8288614e7dda22e7994e679878ec971de (patch) | |
tree | 505e3e6323440f0617915cbb51df0916aeac6025 /common.cpp | |
parent | 207ab2aa5bff997a32971f4e5c4d79ebfd644764 (diff) |
Clean up how argv is stored in process_t
Diffstat (limited to 'common.cpp')
-rw-r--r-- | common.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -156,20 +156,14 @@ wchar_t **list_to_char_arr( array_list_t *l ) return res; } -wchar_t **completions_to_char_arr( std::vector<completion_t> &l ) +wcstring_list_t completions_to_wcstring_list( const std::vector<completion_t> &list ) { - wchar_t ** res = (wchar_t **)malloc( sizeof(wchar_t *)*( l.size() + 1) ); - size_t i; - if( res == 0 ) - { - DIE_MEM(); - } - for( i=0; i< l.size(); i++ ) - { - res[i] = wcsdup(l.at(i).completion.c_str()); - } - res[i]='\0'; - return res; + wcstring_list_t strings; + strings.reserve(list.size()); + for (std::vector<completion_t>::const_iterator iter = list.begin(); iter != list.end(); iter++) { + strings.push_back(iter->completion); + } + return strings; } |