Clean up how argv is stored in process_t

This commit is contained in:
ridiculousfish
2012-01-31 18:06:20 -08:00
parent 207ab2aa5b
commit beece6a828
7 changed files with 48 additions and 61 deletions

View File

@@ -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;
}