From 992dfcc4cec760f5fe704a7ac38478beb19f4f04 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 5 Feb 2016 00:00:38 -0800 Subject: [PATCH] expand_string to return an enum instead of int --- src/expand.cpp | 4 ++-- src/expand.h | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/expand.cpp b/src/expand.cpp index 28f61617d..bd2433daf 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 *out_completions, expand_flags_t flags, parse_error_list_t *errors) +expand_error_t expand_string(const wcstring &input, std::vector *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 e209fb269..e81f7143e 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 *output, expand_flags_t flags, parse_error_list_t *errors); +__warn_unused expand_error_t expand_string(const wcstring &input, std::vector *output, expand_flags_t flags, parse_error_list_t *errors); /**