/[pcre]/code/trunk/pcreposix.c
ViewVC logotype

Diff of /code/trunk/pcreposix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 331 by ph10, Sun Jan 20 20:07:32 2008 UTC revision 332 by ph10, Sat Apr 5 16:11:05 2008 UTC
# Line 263  PCREPOSIX_EXP_DEFN int Line 263  PCREPOSIX_EXP_DEFN int
263  regexec(const regex_t *preg, const char *string, size_t nmatch,  regexec(const regex_t *preg, const char *string, size_t nmatch,
264    regmatch_t pmatch[], int eflags)    regmatch_t pmatch[], int eflags)
265  {  {
266  int rc;  int rc, so, eo;
267  int options = 0;  int options = 0;
268  int *ovector = NULL;  int *ovector = NULL;
269  int small_ovector[POSIX_MALLOC_THRESHOLD * 3];  int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
# Line 296  else if (nmatch > 0) Line 296  else if (nmatch > 0)
296      }      }
297    }    }
298    
299  rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string),  /* REG_STARTEND is a BSD extension, to allow for non-NUL-terminated strings.
300    The man page from OS X says "REG_STARTEND affects only the location of the
301    string, not how it is matched". That is why the "so" value is used to bump the
302    start location rather than being passed as a PCRE "starting offset". */
303    
304    if ((eflags & REG_STARTEND) != 0)
305      {
306      so = pmatch[0].rm_so;
307      eo = pmatch[0].rm_eo;
308      }
309    else
310      {
311      so = 0;
312      eo = strlen(string);
313      }
314    
315    rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string + so, (eo - so),
316    0, options, ovector, nmatch * 3);    0, options, ovector, nmatch * 3);
317    
318  if (rc == 0) rc = nmatch;    /* All captured slots were filled in */  if (rc == 0) rc = nmatch;    /* All captured slots were filled in */

Legend:
Removed from v.331  
changed lines
  Added in v.332

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12