/[pcre]/code/tags/pcre-8.01/pcrecpp.cc
ViewVC logotype

Diff of /code/tags/pcre-8.01/pcrecpp.cc

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

revision 86 by nigel, Sat Feb 24 21:40:59 2007 UTC revision 87 by nigel, Sat Feb 24 21:41:21 2007 UTC
# Line 397  int RE::TryMatch(const StringPiece& text Line 397  int RE::TryMatch(const StringPiece& text
397    
398    pcre_extra extra = { 0 };    pcre_extra extra = { 0 };
399    if (options_.match_limit() > 0) {    if (options_.match_limit() > 0) {
400      extra.flags = PCRE_EXTRA_MATCH_LIMIT;      extra.flags |= PCRE_EXTRA_MATCH_LIMIT;
401      extra.match_limit = options_.match_limit();      extra.match_limit = options_.match_limit();
402    }    }
403      if (options_.match_limit_recursion() > 0) {
404        extra.flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
405        extra.match_limit_recursion = options_.match_limit_recursion();
406      }
407    int rc = pcre_exec(re,              // The regular expression object    int rc = pcre_exec(re,              // The regular expression object
408                       &extra,                       &extra,
409                       text.data(),                       (text.data() == NULL) ? "" : text.data(),
410                       text.size(),                       text.size(),
411                       startpos,                       startpos,
412                       (anchor == UNANCHORED) ? 0 : PCRE_ANCHORED,                       (anchor == UNANCHORED) ? 0 : PCRE_ANCHORED,
# Line 449  bool RE::DoMatchImpl(const StringPiece& Line 453  bool RE::DoMatchImpl(const StringPiece&
453    
454    *consumed = vec[1];    *consumed = vec[1];
455    
456    if (args == NULL) {    if (n == 0 || args == NULL) {
457      // We are not interested in results      // We are not interested in results
458      return true;      return true;
459    }    }
460    
461      if (NumberOfCapturingGroups() < n) {
462        // RE has fewer capturing groups than number of arg pointers passed in
463        return false;
464      }
465    
466    // If we got here, we must have matched the whole pattern.    // If we got here, we must have matched the whole pattern.
467    // We do not need (can not do) any more checks on the value of 'matches' here    // We do not need (can not do) any more checks on the value of 'matches' here
468    // -- see the comment for TryMatch.    // -- see the comment for TryMatch.
# Line 517  bool RE::Rewrite(string *out, const Stri Line 526  bool RE::Rewrite(string *out, const Stri
526    
527  // Return the number of capturing subpatterns, or -1 if the  // Return the number of capturing subpatterns, or -1 if the
528  // regexp wasn't valid on construction.  // regexp wasn't valid on construction.
529  int RE::NumberOfCapturingGroups() {  int RE::NumberOfCapturingGroups() const {
530    if (re_partial_ == NULL) return -1;    if (re_partial_ == NULL) return -1;
531    
532    int result;    int result;
# Line 613  bool Arg::parse_ulong_radix(const char* Line 622  bool Arg::parse_ulong_radix(const char*
622    if (n == 0) return false;    if (n == 0) return false;
623    char buf[kMaxNumberLength+1];    char buf[kMaxNumberLength+1];
624    str = TerminateNumber(buf, str, n);    str = TerminateNumber(buf, str, n);
625      if (str[0] == '-') return false;    // strtoul() on a negative number?!
626    char* end;    char* end;
627    errno = 0;    errno = 0;
628    unsigned long r = strtoul(str, &end, radix);    unsigned long r = strtoul(str, &end, radix);
# Line 702  bool Arg::parse_ulonglong_radix(const ch Line 712  bool Arg::parse_ulonglong_radix(const ch
712    if (n == 0) return false;    if (n == 0) return false;
713    char buf[kMaxNumberLength+1];    char buf[kMaxNumberLength+1];
714    str = TerminateNumber(buf, str, n);    str = TerminateNumber(buf, str, n);
715      if (str[0] == '-') return false;    // strtoull() on a negative number?!
716    char* end;    char* end;
717    errno = 0;    errno = 0;
718  #if defined HAVE_STRTOQ  #if defined HAVE_STRTOQ

Legend:
Removed from v.86  
changed lines
  Added in v.87

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12