aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 02:45:55 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 02:45:55 -0800
commit143091edad3ff66a1f7f301e7e44cc557a9d31eb (patch)
treedf69c135a6860cc81de031d80f2dc5ae58c34589 /expand.cpp
parent79e0405f6a6e56c2430d5d74b6c150d0b5d0e2fe (diff)
More work to excise halloc
Diffstat (limited to 'expand.cpp')
-rw-r--r--expand.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/expand.cpp b/expand.cpp
index b0fbcf97..4e1c748d 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -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;
}
-
-
-