aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-05 00:00:38 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-05 00:00:38 -0800
commit992dfcc4cec760f5fe704a7ac38478beb19f4f04 (patch)
treed6325542b5b15ecc9f3ae726493b6dfb869bd367
parent1e6492ef93b467e008a1854a83e42edddd948dd2 (diff)
expand_string to return an enum instead of int
-rw-r--r--src/expand.cpp4
-rw-r--r--src/expand.h8
2 files changed, 5 insertions, 7 deletions
diff --git a/src/expand.cpp b/src/expand.cpp
index 28f61617..bd2433da 100644
--- a/src/expand.cpp
+++ b/src/expand.cpp
@@ -1679,9 +1679,9 @@ static void remove_internal_separator(wcstring &str, bool conv)
}
}
-int expand_string(const wcstring &input, std::vector<completion_t> *out_completions, expand_flags_t flags, parse_error_list_t *errors)
+expand_error_t expand_string(const wcstring &input, std::vector<completion_t> *out_completions, expand_flags_t flags, parse_error_list_t *errors)
{
- int res = EXPAND_OK;
+ expand_error_t res = EXPAND_OK;
/* Early out. If we're not completing, and there's no magic in the input, we're done. */
if (!(flags & EXPAND_FOR_COMPLETIONS) && expand_is_clean(input))
diff --git a/src/expand.h b/src/expand.h
index e209fb26..e81f7143 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -110,10 +110,8 @@ enum
;
-/**
- These are the possible return values for expand_string
-*/
-enum
+/** These are the possible return values for expand_string. Note how zero value is the only error. */
+enum expand_error_t
{
/** Error */
EXPAND_ERROR,
@@ -152,7 +150,7 @@ enum
\param errors Resulting errors, or NULL to ignore
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH. EXPAND_WILDCARD_NO_MATCH and EXPAND_WILDCARD_MATCH are normal exit conditions used only on strings containing wildcards to tell if the wildcard produced any matches.
*/
-__warn_unused int expand_string(const wcstring &input, std::vector<completion_t> *output, expand_flags_t flags, parse_error_list_t *errors);
+__warn_unused expand_error_t expand_string(const wcstring &input, std::vector<completion_t> *output, expand_flags_t flags, parse_error_list_t *errors);
/**