expand_string to return an enum instead of int

This commit is contained in:
ridiculousfish 2016-02-05 00:00:38 -08:00
parent 1e6492ef93
commit 992dfcc4ce
2 changed files with 5 additions and 7 deletions

View file

@ -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))

View file

@ -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);
/**