Migrated off of old variant of expand_one that used halloc

This commit is contained in:
ridiculousfish
2012-01-31 21:30:09 -08:00
parent 409f70c7f3
commit 0b4b6c498d
4 changed files with 63 additions and 114 deletions

View File

@@ -1809,47 +1809,6 @@ int expand_string2( const wcstring &input, std::vector<completion_t> &output, in
return res;
}
wchar_t *expand_one( void *context, const wchar_t *string, int flags )
{
std::vector<completion_t> l;
int res;
wchar_t *one;
CHECK( string, 0 );
if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string ) )
{
halloc_register( context, (void *)string );
return (wchar_t *)string;
}
// al_init( &l );
res = expand_string2( string, l, flags );
if( !res )
{
one = 0;
}
else
{
if( l.size() != 1 )
{
one=0;
}
else
{
one = wcsdup( l.at(0).completion.c_str() );
// al_set( &l, 0, 0 );
}
}
// al_foreach( &l, &free );
// al_destroy( &l );
if (context)
halloc_register( context, one );
return one;
}
bool expand_one(wcstring &string, int flags) {
std::vector<completion_t> completions;
bool result = false;