Permalink
Browse files

use REG_STARTEND flag if available

  • Loading branch information...
dstosberg committed Sep 8, 2009
1 parent 31102aa commit 53b487149ddba41a104d56063408b66b5106a1da
Showing with 7 additions and 0 deletions.
  1. +7 −0 regex.c
View
@@ -53,7 +53,14 @@ int regex_subst(STRBUF *buf,
bufp = strbuf_get(buf) + off;
#ifdef REG_STARTEND
matches[0].rm_so = 0;
matches[0].rm_eo = strbuf_len(buf) - off;
if (0 != regexec(&rx, bufp, nmatches, matches, REG_STARTEND))
#else
if (0 != regexec(&rx, bufp, nmatches, matches, 0))
#endif
break;
if (matches[i].rm_so != -1) {

0 comments on commit 53b4871

Please sign in to comment.