`REGCOMP()` wraps `regcomp()` which returns int.
}
err = REGCOMP(&rx, s, REG_NOSUB);
- if (err)
+ if (err != 0)
{
regerror(err, &rx, buf, sizeof(buf));
regfree(&rx);
answer[1] = '\0';
- reyes_ok = (expr = nl_langinfo(YESEXPR)) && expr[0] == '^' &&
- !REGCOMP(&reyes, expr, REG_NOSUB);
- reno_ok = (expr = nl_langinfo(NOEXPR)) && expr[0] == '^' &&
- !REGCOMP(&reno, expr, REG_NOSUB);
+ reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] == '^') &&
+ (REGCOMP(&reyes, expr, REG_NOSUB) == 0);
+ reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] == '^') &&
+ (REGCOMP(&reno, expr, REG_NOSUB) == 0);
/*
* In order to prevent the default answer to the question to wrapped
FREE(&tmpminor);
- if (ret)
+ if (ret != 0)
{
regerror(ret, &a->minor_regex, err->data, err->dsize);
FREE(&a->major);
#define REG_WORDS 0
#endif
+/**
+ * REGCOMP - Compile a regular expression
+ * @param X regex_t struct to fill
+ * @param Y Regular expression string
+ * @param Z Flags
+ * @retval 0 Success
+ * @retval num Failure, e.g. REG_BADPAT
+ */
#define REGCOMP(X, Y, Z) regcomp(X, Y, REG_WORDS | REG_EXTENDED | (Z))
+/**
+ * REGEXEC - Perform a regular expression comparison
+ * @param X regex_t containing compiled regular expression
+ * @param Y String to compare
+ * @retval 0 Success
+ * @retval REG_NOMATCH Failure
+ */
#define REGEXEC(X, Y) regexec(&X, Y, (size_t) 0, (regmatch_t *) 0, (int) 0)
/**
pat->p.regex = safe_malloc(sizeof(regex_t));
r = REGCOMP(pat->p.regex, buf.data,
REG_NEWLINE | REG_NOSUB | mutt_which_case(buf.data));
- if (r)
+ if (r != 0)
{
regerror(r, pat->p.regex, errmsg, sizeof(errmsg));
mutt_buffer_printf(err, "'%s': %s", buf.data, errmsg);