expcov report - Generated Sat Oct 15 21:39:18 2016

 Index  Statistics  Last 
Directory./server
Filenameutil_pcre.c
ModifiedThu Apr 5 03:19:19 2012

Pass Half Fail Excluded Total
Function
0
0.00%
4
100.00%
0
0.00%
4
100%
Expressions
0
0.00%
108
100.00%
0
0.00%
108
100%
Conditions
0
0.00%
0
0.00%
22
100.00%
0
0.00%
22
100%
MC/DC
0
0.00%
4
100.00%
0
0.00%
4
100%
Branches

if
0
0.00%
0
0.00%
14
100.00%
0
0.00%
14
100%
for
0
0.00%
0
0.00%
2
100.00%
0
0.00%
2
100%
while
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%
case
0
0.00%
0
0.00%
10
100.00%
0
0.00%
10
100%

1/*************************************************
2*      Perl-Compatible Regular Expressions       *
3*************************************************/
4
5/*
6This is a library of functions to support regular expressions whose syntax
7and semantics are as close as possible to those of the Perl 5 language. See
8the file Tech.Notes for some information on the internals.
9
10This module is a wrapper that provides a POSIX API to the underlying PCRE
11functions.
12
13Written by: Philip Hazel <ph10@cam.ac.uk>
14
15           Copyright (c) 1997-2004 University of Cambridge
16
17-----------------------------------------------------------------------------
18Redistribution and use in source and binary forms, with or without
19modification, are permitted provided that the following conditions are met:
20
21    * Redistributions of source code must retain the above copyright notice,
22      this list of conditions and the following disclaimer.
23
24    * Redistributions in binary form must reproduce the above copyright
25      notice, this list of conditions and the following disclaimer in the
26      documentation and/or other materials provided with the distribution.
27
28    * Neither the name of the University of Cambridge nor the names of its
29      contributors may be used to endorse or promote products derived from
30      this software without specific prior written permission.
31
32THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42POSSIBILITY OF SUCH DAMAGE.
43-----------------------------------------------------------------------------
44*/
45
46#include "httpd.h"
47#include "apr_strings.h"
48#include "pcre.h"
49
50#define APR_WANT_STRFUNC
51#include "apr_want.h"
52
53#ifndef POSIX_MALLOC_THRESHOLD
54#define POSIX_MALLOC_THRESHOLD (10)
55#endif
56
57/* Table of error strings corresponding to POSIX error codes; must be
58 * kept in synch with include/ap_regex.h's AP_REG_E* definitions. */
59
60static const char *const pstring[] = {
61  "",                                /* Dummy for value 0 */
62  "internal error",                  /* AP_REG_ASSERT */
63  "failed to get memory",            /* AP_REG_ESPACE */
64  "bad argument",                    /* AP_REG_INVARG */
65  "match failed"                     /* AP_REG_NOMATCH */
66};
67
68AP_DECLARE(apr_size_t) ap_regerror : call=0
a
p_regerror(int errcode, const ap_regex_t *preg,
69                                   char *errbuf, apr_size_t errbuf_size)
70{
71const char *message, *addmessage;
72apr_size_t length, addlength;
73
74message : server/util_pcre.c line=71 column=13
m
essage = : pass=0
=
 (errcode : server/util_pcre.c line=68 column=40
e
rrcode >= : true=0, false=0
>
= (int)(sizeof(pstring)/ : pass=0
/
sizeof(char *)))conditional operator : true=0, false=0
?
75  "unknown error code" : pstring : server/util_pcre.c line=60 column=26
p
string[] : enter=0, leave=0
[
errcode : server/util_pcre.c line=68 column=40
e
rrcode];
76length : server/util_pcre.c line=72 column=12
l
ength = : pass=0
=
 strlen : enter=0, leave=0

strlen : /usr/include/string.h line=399 column=15
s
trlen(message : server/util_pcre.c line=71 column=13
m
essage) + : pass=0
+
 1;
77
78addmessage : server/util_pcre.c line=71 column=23
a
ddmessage = : pass=0
=
 " at offset ";
79addlength : server/util_pcre.c line=72 column=20
a
ddlength = : pass=0
=
 (preg : server/util_pcre.c line=68 column=67
p
reg != : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
= NULL && : true=0, false=0
&
& (int)preg : server/util_pcre.c line=68 column=67
p
reg-> : enter=0, leave=0
-
>re_erroffset : include/ap_regex.h line=88 column=16 re_erroffset != : true=0, false=0
MC/DC independently affect : true=0, false=0
!TF
= -1)conditional operator : true=0, false=0
?
80  strlen : enter=0, leave=0

strlen : /usr/include/string.h line=399 column=15
s
trlen(addmessage : server/util_pcre.c line=71 column=23
a
ddmessage) + : pass=0
+
 6 : 0;
81
82if : true=0, false=0
i
f (errbuf_size : server/util_pcre.c line=69 column=61
e
rrbuf_size > : true=0, false=0
>
 0)
83  {
84  if : true=0, false=0
i
f (addlength : server/util_pcre.c line=72 column=20
a
ddlength > : true=0, false=0
MC/DC independently affect : true=0, false=0
>TF
 0 && : true=0, false=0
&
errbuf_size : server/util_pcre.c line=69 column=61
e
rrbuf_size >= : true=0, false=0
MC/DC independently affect : true=0, false=0
>TF
length : server/util_pcre.c line=72 column=12
l
ength + : pass=0
+
 addlength : server/util_pcre.c line=72 column=20
a
ddlength)
85      apr_snprintf : enter=0, leave=0

apr_snprintf : /usr/include/apr-1/apr_strings.h line=261 column=25
a
pr_snprintf(errbuf : server/util_pcre.c line=69 column=42
e
rrbuf, sizeof errbuf,
86                   "%s%s%-6d", message : server/util_pcre.c line=71 column=13
m
essage, addmessage : server/util_pcre.c line=71 column=23
a
ddmessage, (int)preg : server/util_pcre.c line=68 column=67
p
reg-> : enter=0, leave=0
-
>re_erroffset : include/ap_regex.h line=88 column=16 re_erroffset);
87  else
88    {
89    strncpy : enter=0, leave=0

strncpy : /usr/include/string.h line=131 column=14
s
trncpy(errbuf : server/util_pcre.c line=69 column=42
e
rrbuf, message : server/util_pcre.c line=71 column=13
m
essage, errbuf_size : server/util_pcre.c line=69 column=61
e
rrbuf_size - : pass=0
-
 1);
90    errbuf : server/util_pcre.c line=69 column=42
e
rrbuf[errbuf_size : server/util_pcre.c line=69 column=61
e
rrbuf_size- : pass=0
-
1] = : enter=0, leave=0
=
 0;
91    }
92  }
93
94return : pass=0
r
eturn length : server/util_pcre.c line=72 column=12
l
ength + : pass=0
+
 addlength : server/util_pcre.c line=72 column=20
a
ddlength;
95}
96
97
98
99
100/*************************************************
101*           Free store held by a regex           *
102*************************************************/
103
104AP_DECLARE(void) ap_regfree : call=0
a
p_regfree(ap_regex_t *preg)
105{
106pcre_free : enter=0, leave=0

pcre_free : srclib/pcre/pcre.h line=196 column=25
(
pcre_free : srclib/pcre/pcre.h line=196 column=25 pcre_free)(preg : server/util_pcre.c line=104 column=41
p
reg-> : enter=0, leave=0
-
>re_pcre : include/ap_regex.h line=86 column=11 re_pcre);
107}
108
109
110
111
112/*************************************************
113*            Compile a regular expression        *
114*************************************************/
115
116/*
117Arguments:
118  preg        points to a structure for recording the compiled expression
119  pattern     the pattern to compile
120  cflags      compilation flags
121
122Returns:      0 on success
123              various non-zero codes on failure
124*/
125
126AP_DECLARE(int) ap_regcomp : call=0
a
p_regcomp(ap_regex_t *preg, const char *pattern, int cflags)
127{
128const char *errorptr;
129int erroffset;
130int options = 0;
131int nsub;
132
133if : true=0, false=0
i
f ((cflags : server/util_pcre.c line=126 column=71
c
flags & : pass=0
&
 AP_REG_ICASE) != : true=0, false=0
!
= 0) options : server/util_pcre.c line=130 column=5
o
ptions |= : pass=0
|
= PCRE_CASELESS;
134if : true=0, false=0
i
f ((cflags : server/util_pcre.c line=126 column=71
c
flags & : pass=0
&
 AP_REG_NEWLINE) != : true=0, false=0
!
= 0) options : server/util_pcre.c line=130 column=5
o
ptions |= : pass=0
|
= PCRE_MULTILINE;
135
136preg : server/util_pcre.c line=126 column=40
p
reg-> : enter=0, leave=0
-
>re_pcre : include/ap_regex.h line=86 column=11 re_pcre = : enter=0, leave=0
=
 pcre_compile : enter=0, leave=0

pcre_compile : srclib/pcre/pcre.h line=210 column=14
p
cre_compile(pattern : server/util_pcre.c line=126 column=58
p
attern, options : server/util_pcre.c line=130 column=5
o
ptions, &errorptr : server/util_pcre.c line=128 column=13
e
rrorptr, &erroffset : server/util_pcre.c line=129 column=5
e
rroffset, NULL);
137preg : server/util_pcre.c line=126 column=40
p
reg-> : enter=0, leave=0
-
>re_erroffset : include/ap_regex.h line=88 column=16 re_erroffset = : enter=0, leave=0
=
 erroffset : server/util_pcre.c line=129 column=5
e
rroffset;
138
139if : true=0, false=0
i
f (preg : server/util_pcre.c line=126 column=40
p
reg-> : enter=0, leave=0
-
>re_pcre : include/ap_regex.h line=86 column=11 re_pcre == : true=0, false=0
=
= NULL) return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
140
141pcre_fullinfo : enter=0, leave=0

pcre_fullinfo : srclib/pcre/pcre.h line=221 column=13
p
cre_fullinfo((const pcre *)preg : server/util_pcre.c line=126 column=40
p
reg-> : enter=0, leave=0
-
>re_pcre : include/ap_regex.h line=86 column=11 re_pcre, NULL,
142              PCRE_INFO_CAPTURECOUNT, &nsub : server/util_pcre.c line=131 column=5
n
sub);
143preg : server/util_pcre.c line=126 column=40
p
reg-> : enter=0, leave=0
-
>re_nsub : include/ap_regex.h line=87 column=16 re_nsub = : enter=0, leave=0
=
 (apr_size_t)nsub : server/util_pcre.c line=131 column=5
n
sub;
144return : pass=0
r
eturn 0;
145}
146
147
148
149
150/*************************************************
151*              Match a regular expression        *
152*************************************************/
153
154/* Unfortunately, PCRE requires 3 ints of working space for each captured
155substring, so we have to get and release working store instead of just using
156the POSIX structures as was done in earlier releases when PCRE needed only 2
157ints. However, if the number of possible capturing brackets is small, use a
158block of store on the stack, to reduce the use of malloc/free. The threshold is
159in a macro that can be changed at configure time. */
160
161AP_DECLARE(int) ap_regexec : call=0
a
p_regexec(const ap_regex_t *preg, const char *string,
162                           apr_size_t nmatch, ap_regmatch_t pmatch[],
163                           int eflags)
164{
165int rc;
166int options = 0;
167int *ovector = NULL;
168int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
169int allocated_ovector = 0;
170
171if : true=0, false=0
i
f ((eflags : server/util_pcre.c line=163 column=32
e
flags & : pass=0
&
 AP_REG_NOTBOL) != : true=0, false=0
!
= 0) options : server/util_pcre.c line=166 column=5
o
ptions |= : pass=0
|
= PCRE_NOTBOL;
172if : true=0, false=0
i
f ((eflags : server/util_pcre.c line=163 column=32
e
flags & : pass=0
&
 AP_REG_NOTEOL) != : true=0, false=0
!
= 0) options : server/util_pcre.c line=166 column=5
o
ptions |= : pass=0
|
= PCRE_NOTEOL;
173
174((ap_regex_t *)preg : server/util_pcre.c line=161 column=46
p
reg)-> : enter=0, leave=0
-
>re_erroffset : include/ap_regex.h line=88 column=16 re_erroffset = : enter=0, leave=0
=
 (apr_size_t)(-1);  /* Only has meaning after compile */
175
176if : true=0, false=0
i
f (nmatch : server/util_pcre.c line=162 column=39
n
match > : true=0, false=0
>
 0)
177  {
178  if : true=0, false=0
i
f (nmatch : server/util_pcre.c line=162 column=39
n
match <= : true=0, false=0
<
= POSIX_MALLOC_THRESHOLD)
179    {
180    ovector : server/util_pcre.c line=167 column=6
o
vector = : pass=0
=
 &(small_ovector : server/util_pcre.c line=168 column=5
s
mall_ovector[] : enter=0, leave=0
[
0]);
181    }
182  else
183    {
184    ovector : server/util_pcre.c line=167 column=6
o
vector = : pass=0
=
 (int *)malloc : enter=0, leave=0

malloc : /usr/include/stdlib.h line=471 column=14
m
alloc(sizeof(int) * : pass=0
*
 nmatch : server/util_pcre.c line=162 column=39
n
match * : pass=0
*
 3);
185    if : true=0, false=0
i
f (ovector : server/util_pcre.c line=167 column=6
o
vector == : true=0, false=0
=
= NULL) return : pass=0
r
eturn AP_REG_ESPACE : include/ap_regex.h line=79 column=3 AP_REG_ESPACE;
186    allocated_ovector : server/util_pcre.c line=169 column=5
a
llocated_ovector = : pass=0
=
 1;
187    }
188  }
189
190rc : server/util_pcre.c line=165 column=5
r
= : pass=0
=
 pcre_exec : enter=0, leave=0

pcre_exec : srclib/pcre/pcre.h line=217 column=13
p
cre_exec((const pcre *)preg : server/util_pcre.c line=161 column=46
p
reg-> : enter=0, leave=0
-
>re_pcre : include/ap_regex.h line=86 column=11 re_pcre, NULL, string : server/util_pcre.c line=161 column=64
s
tring, (int)strlen : enter=0, leave=0

strlen : /usr/include/string.h line=399 column=15
s
trlen(string : server/util_pcre.c line=161 column=64
s
tring),
191  0, options : server/util_pcre.c line=166 column=5
o
ptions, ovector : server/util_pcre.c line=167 column=6
o
vector, nmatch : server/util_pcre.c line=162 column=39
n
match * : pass=0
*
 3);
192
193if : true=0, false=0
i
f (rc : server/util_pcre.c line=165 column=5
r
== : true=0, false=0
=
= 0) rc : server/util_pcre.c line=165 column=5
r
= : pass=0
=
 nmatch : server/util_pcre.c line=162 column=39
n
match;    /* All captured slots were filled in */
194
195if : true=0, false=0
i
f (rc : server/util_pcre.c line=165 column=5
r
>= : true=0, false=0
>
= 0)
196  {
197  apr_size_t i;
198  for : true=0, false=0
f
or (i : server/util_pcre.c line=197 column=14
i
 = : pass=0
=
 0; i : server/util_pcre.c line=197 column=14
i
 < : true=0, false=0
<
 (apr_size_t)rc : server/util_pcre.c line=165 column=5
r
c; i : server/util_pcre.c line=197 column=14
i
++ : pass=0
+
+)
199    {
200    pmatch : server/util_pcre.c line=162 column=61
p
match[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
].rm_so : include/ap_regex.h line=93 column=9 rm_so = : pass=0
=
 ovector : server/util_pcre.c line=167 column=6
o
vector[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
* : pass=0
*
2];
201    pmatch : server/util_pcre.c line=162 column=61
p
match[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
].rm_eo : include/ap_regex.h line=94 column=9 rm_eo = : pass=0
=
 ovector : server/util_pcre.c line=167 column=6
o
vector[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
* : pass=0
*
2+ : pass=0
+
1];
202    }
203  if : true=0, false=0
i
f (allocated_ovector : server/util_pcre.c line=169 column=5
a
llocated_ovector) free : enter=0, leave=0

free : /usr/include/stdlib.h line=488 column=13
f
ree(ovector : server/util_pcre.c line=167 column=6
o
vector);
204  for : true=0, false=0
f
or (; i : server/util_pcre.c line=197 column=14
i
 < : true=0, false=0
<
 nmatch : server/util_pcre.c line=162 column=39
n
match; i : server/util_pcre.c line=197 column=14
i
++ : pass=0
+
+) pmatch : server/util_pcre.c line=162 column=61
p
match[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
].rm_so : include/ap_regex.h line=93 column=9 rm_so = : pass=0
=
 pmatch : server/util_pcre.c line=162 column=61
p
match[] : enter=0, leave=0
[
i : server/util_pcre.c line=197 column=14
i
].rm_eo : include/ap_regex.h line=94 column=9 rm_eo = : pass=0
=
 -1;
205  return : pass=0
r
eturn 0;
206  }
207
208else
209  {
210  if : true=0, false=0
i
f (allocated_ovector : server/util_pcre.c line=169 column=5
a
llocated_ovector) free : enter=0, leave=0

free : /usr/include/stdlib.h line=488 column=13
f
ree(ovector : server/util_pcre.c line=167 column=6
o
vector);
211  switch : pass=0
s
witch(rc : server/util_pcre.c line=165 column=5
r
c)
212    {
213    case : true=0, false=0
c
ase PCRE_ERROR_NOMATCH: return : pass=0
r
eturn AP_REG_NOMATCH : include/ap_regex.h line=81 column=3 AP_REG_NOMATCH;
214    case : true=0, false=0
c
ase PCRE_ERROR_NULL: return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
215    case : true=0, false=0
c
ase PCRE_ERROR_BADOPTION: return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
216    case : true=0, false=0
c
ase PCRE_ERROR_BADMAGIC: return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
217    case : true=0, false=0
c
ase PCRE_ERROR_UNKNOWN_NODE: return : pass=0
r
eturn AP_REG_ASSERT : include/ap_regex.h line=78 column=3 AP_REG_ASSERT;
218    case : true=0, false=0
c
ase PCRE_ERROR_NOMEMORY: return : pass=0
r
eturn AP_REG_ESPACE : include/ap_regex.h line=79 column=3 AP_REG_ESPACE;
219#ifdef PCRE_ERROR_MATCHLIMIT
220    case : true=0, false=0
c
ase PCRE_ERROR_MATCHLIMIT: return : pass=0
r
eturn AP_REG_ESPACE : include/ap_regex.h line=79 column=3 AP_REG_ESPACE;
221#endif
222#ifdef PCRE_ERROR_BADUTF8
223    case : true=0, false=0
c
ase PCRE_ERROR_BADUTF8: return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
224#endif
225#ifdef PCRE_ERROR_BADUTF8_OFFSET
226    case : true=0, false=0
c
ase PCRE_ERROR_BADUTF8_OFFSET: return : pass=0
r
eturn AP_REG_INVARG : include/ap_regex.h line=80 column=3 AP_REG_INVARG;
227#endif
228    default : true=0, false=0
d
efault: return : pass=0
r
eturn AP_REG_ASSERT : include/ap_regex.h line=78 column=3 AP_REG_ASSERT;
229    }
230  }
231}
232
233/* End of pcreposix.c */
234[EOF]


Generated by expcov