diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-30 02:45:55 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-30 02:45:55 -0800 |
commit | 143091edad3ff66a1f7f301e7e44cc557a9d31eb (patch) | |
tree | df69c135a6860cc81de031d80f2dc5ae58c34589 /expand.cpp | |
parent | 79e0405f6a6e56c2430d5d74b6c150d0b5d0e2fe (diff) |
More work to excise halloc
Diffstat (limited to 'expand.cpp')
-rw-r--r-- | expand.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -2626,16 +2626,20 @@ wchar_t *expand_one( void *context, const wchar_t *string, int flags ) return one; } -bool expand_one( wcstring &in, int flag ) { - bool result = false; - wchar_t *res = expand_one(NULL, in.c_str(), flag); - if (res) { - in = res; - free(res); - result = true; +bool expand_one(wcstring &string, int flags) { + std::vector<completion_t> completions; + bool result = false; + + if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string.c_str() ) ) + { + return true; + } + + if (expand_string2(string, completions, flags)) { + if (completions.size() == 1) { + string = completions.at(0).completion; + result = true; + } } - return result; + return result; } - - - |