Skip to content

Commit

Permalink
REG_NOSUB is a compile time option only. Likely Closes #868
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jan 3, 2015
1 parent 73a3150 commit 486224c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/regex.c
Expand Up @@ -316,7 +316,6 @@ ssize_t regex_compile(TALLOC_CTX *ctx, regex_t **out, char const *pattern, size_
int regex_exec(regex_t *preg, char const *subject, size_t len, regmatch_t pmatch[], size_t *nmatch)
{
int ret;
int eflags = 0;
size_t matches;

/*
Expand All @@ -326,8 +325,8 @@ int regex_exec(regex_t *preg, char const *subject, size_t len, regmatch_t pmatch
pmatch = NULL;
if (nmatch) *nmatch = 0;
matches = 0;
eflags |= REG_NOSUB;
} else {
/* regexec does not seem to initialise unused elements */
matches = *nmatch;
memset(pmatch, 0, sizeof(pmatch[0]) * matches);
}
Expand All @@ -344,11 +343,10 @@ int regex_exec(regex_t *preg, char const *subject, size_t len, regmatch_t pmatch
(p - subject));
return -1;
}
/* regexec does not seem to initialise unused elements */
ret = regexec(preg, subject, matches, pmatch, eflags);
ret = regexec(preg, subject, matches, pmatch, 0);
}
#else
ret = regnexec(preg, subject, len, matches, pmatch, eflags);
ret = regnexec(preg, subject, len, matches, pmatch, 0);
#endif
if (ret != 0) {
if (ret != REG_NOMATCH) {
Expand Down

0 comments on commit 486224c

Please sign in to comment.