Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix wrong way grep_text finding whether match or not #96

Closed
wants to merge 2 commits into from

2 participants

@menghan

Normally, regexec() returns 0 for success and the non-zero code REG_NOMATCH for failure.
so it should be '!result' instead of 'result != REG_NOMATCH'

menghan added some commits
@menghan menghan fix wrong way grep_text finding whether match or not
Normally, regexec() returns 0 for success and the non-zero code REG_NOMATCH for failure.
so it should be '!result' instead of 'result != REG_NOMATCH'
f0b93d9
@menghan menghan fix another regexec's bug f71745f
@jonas
Owner

Thanks for the improvement.

I ended up squashing the two commits together and rephrasing the commit message a bit.
7fb8d07

@jonas jonas closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 22, 2012
  1. @menghan

    fix wrong way grep_text finding whether match or not

    menghan authored
    Normally, regexec() returns 0 for success and the non-zero code REG_NOMATCH for failure.
    so it should be '!result' instead of 'result != REG_NOMATCH'
  2. @menghan

    fix another regexec's bug

    menghan authored
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 tig.c
View
4 tig.c
@@ -2763,7 +2763,7 @@ grep_text(struct view *view, const char *text[])
for (i = 0; text[i]; i++)
if (*text[i] &&
- regexec(view->regex, text[i], 1, &pmatch, 0) != REG_NOMATCH)
+ (!regexec(view->regex, text[i], 1, &pmatch, 0)))
return TRUE;
return FALSE;
}
@@ -7425,7 +7425,7 @@ grep_refs(struct ref_list *list, regex_t *regex)
return FALSE;
for (i = 0; i < list->size; i++) {
- if (regexec(regex, list->refs[i]->name, 1, &pmatch, 0) != REG_NOMATCH)
+ if (!regexec(regex, list->refs[i]->name, 1, &pmatch, 0))
return TRUE;
}
Something went wrong with that request. Please try again.