~ubuntu-branches/ubuntu/wily/trafficserver/wily

« back to all changes in this revision

Viewing changes to lib/ts/Regex.cc

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-17 22:28:16 UTC
  • mfrom: (5.1.8 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121217222816-7xwjsx5k76zkb63d
Tags: 3.2.0-1ubuntu1
* Revert FreeBSD strerror_r() fixes that give errors with glibc 2.16.
* Apply patch from Konstantinos Margaritis to define barriers on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    if (p->_re)
36
36
      pcre_free(p->_re);
37
37
    if(p->_p)
38
 
      ink_free(p->_p);
 
38
      ats_free(p->_p);
39
39
    t = p->_next;
40
 
    ink_free(p);
 
40
    ats_free(p);
41
41
    p = t;
42
42
  } 
43
43
}
49
49
  int erroffset;
50
50
  dfa_pattern* ret;
51
51
  
52
 
  ret = (dfa_pattern*) ink_malloc(sizeof(dfa_pattern));
 
52
  ret = (dfa_pattern*)ats_malloc(sizeof(dfa_pattern));
53
53
  ret->_p = NULL;
54
54
  
55
55
  if (flags & RE_CASE_INSENSITIVE)
58
58
    ret->_re = pcre_compile(pattern, PCRE_ANCHORED, &error, &erroffset, NULL);
59
59
  
60
60
  if (error) {
61
 
    ink_free(ret);
 
61
    ats_free(ret);
62
62
    return NULL;
63
63
  }
64
64
  
65
65
  ret->_pe = pcre_study(ret->_re, 0, &error);
66
66
  
67
67
  if (error) {
68
 
    ink_free(ret);
 
68
    ats_free(ret);
69
69
    return NULL;
70
70
  }
71
71
  
72
72
  ret->_idx = 0;
73
 
  ret->_p = ink_strndup(pattern,strlen(pattern));
 
73
  ret->_p = ats_strndup(pattern, strlen(pattern));
74
74
  ret->_next = NULL;
75
75
  return ret;
76
76
}
77
77
 
78
78
int DFA::compile(const char *pattern, REFlags flags) {
 
79
  ink_assert(_my_patterns == NULL);
79
80
  _my_patterns = build(pattern,flags);
80
81
  if (_my_patterns) 
81
82
    return 0;
120
121
}
121
122
 
122
123
int
123
 
DFA::match(const char *str)
 
124
DFA::match(const char *str) const
124
125
{
125
126
  return match(str,strlen(str));
126
127
}
127
128
 
128
129
int
129
 
DFA::match(const char *str, int length)
 
130
DFA::match(const char *str, int length) const
130
131
{
131
132
  int rc;
132
133
  int ovector[30];