annotate src/core/ngx_regex.c @ 4412:d620f497c50f

Copyright updated.
author Maxim Konovalov <maxim@nginx.com>
date Wed, 18 Jan 2012 15:07:43 +0000
parents 005fc2d5e84f
children 23ea4e72c85a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 381
diff changeset
1
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 381
diff changeset
2 /*
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 441
diff changeset
3 * Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 4388
diff changeset
4 * Copyright (C) Nginx, Inc.
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 381
diff changeset
5 */
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 381
diff changeset
6
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 #include <ngx_config.h>
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_core.h>
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
12 typedef struct {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
13 ngx_flag_t pcre_jit;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
14 } ngx_regex_conf_t;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
15
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
16
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
17 static void * ngx_libc_cdecl ngx_regex_malloc(size_t size);
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
18 static void ngx_libc_cdecl ngx_regex_free(void *p);
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
20 static ngx_int_t ngx_regex_module_init(ngx_cycle_t *cycle);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
21
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
22 static void *ngx_regex_create_conf(ngx_cycle_t *cycle);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
23 static char *ngx_regex_init_conf(ngx_cycle_t *cycle, void *conf);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
24
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
25 static char *ngx_regex_pcre_jit(ngx_conf_t *cf, void *post, void *data);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
26 static ngx_conf_post_t ngx_regex_pcre_jit_post = { ngx_regex_pcre_jit };
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
27
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
28
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
29 static ngx_command_t ngx_regex_commands[] = {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
30
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
31 { ngx_string("pcre_jit"),
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
32 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
33 ngx_conf_set_flag_slot,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
34 0,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
35 offsetof(ngx_regex_conf_t, pcre_jit),
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
36 &ngx_regex_pcre_jit_post },
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
37
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
38 ngx_null_command
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
39 };
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
40
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
41
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
42 static ngx_core_module_t ngx_regex_module_ctx = {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
43 ngx_string("regex"),
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
44 ngx_regex_create_conf,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
45 ngx_regex_init_conf
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
46 };
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
47
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
48
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
49 ngx_module_t ngx_regex_module = {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
50 NGX_MODULE_V1,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
51 &ngx_regex_module_ctx, /* module context */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
52 ngx_regex_commands, /* module directives */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
53 NGX_CORE_MODULE, /* module type */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
54 NULL, /* init master */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
55 ngx_regex_module_init, /* init module */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
56 NULL, /* init process */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
57 NULL, /* init thread */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
58 NULL, /* exit thread */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
59 NULL, /* exit process */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
60 NULL, /* exit master */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
61 NGX_MODULE_V1_PADDING
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
62 };
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
63
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
64
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
65 static ngx_pool_t *ngx_pcre_pool;
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
66 static ngx_list_t *ngx_pcre_studies;
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
68
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
69 void
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
70 ngx_regex_init(void)
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
71 {
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
72 pcre_malloc = ngx_regex_malloc;
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
73 pcre_free = ngx_regex_free;
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
74 }
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
75
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
76
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
77 static ngx_inline void
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
78 ngx_regex_malloc_init(ngx_pool_t *pool)
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79 {
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
80 #if (NGX_THREADS)
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
81 ngx_core_tls_t *tls;
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
82
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
83 if (ngx_threaded) {
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
84 tls = ngx_thread_get_tls(ngx_core_tls_key);
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
85 tls->pool = pool;
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
86 return;
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
87 }
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
88
3349
169d84ff4064 fix pcre allocation on Win32, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents: 3325
diff changeset
89 #endif
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
90
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
91 ngx_pcre_pool = pool;
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
92 }
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
93
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
94
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
95 static ngx_inline void
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
96 ngx_regex_malloc_done(void)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
97 {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
98 #if (NGX_THREADS)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
99 ngx_core_tls_t *tls;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
100
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
101 if (ngx_threaded) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
102 tls = ngx_thread_get_tls(ngx_core_tls_key);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
103 tls->pool = NULL;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
104 return;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
105 }
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
106
3349
169d84ff4064 fix pcre allocation on Win32, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents: 3325
diff changeset
107 #endif
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
108
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
109 ngx_pcre_pool = NULL;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
110 }
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
111
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
112
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
113 ngx_int_t
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
114 ngx_regex_compile(ngx_regex_compile_t *rc)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
115 {
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
116 int n, erroff;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
117 char *p;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
118 pcre *re;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
119 const char *errstr;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
120 ngx_regex_elt_t *elt;
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
121
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
122 ngx_regex_malloc_init(rc->pool);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
123
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
124 re = pcre_compile((const char *) rc->pattern.data, (int) rc->options,
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 216
diff changeset
125 &errstr, &erroff, NULL);
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
126
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
127 /* ensure that there is no current pool */
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
128 ngx_regex_malloc_done();
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
129
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
130 if (re == NULL) {
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
131 if ((size_t) erroff == rc->pattern.len) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
132 rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
133 "pcre_compile() failed: %s in \"%V\"",
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
134 errstr, &rc->pattern)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
135 - rc->err.data;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
136
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
137 } else {
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
138 rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
139 "pcre_compile() failed: %s in \"%V\" at \"%s\"",
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
140 errstr, &rc->pattern, rc->pattern.data + erroff)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
141 - rc->err.data;
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142 }
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
143
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
144 return NGX_ERROR;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
145 }
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
146
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
147 rc->regex = ngx_pcalloc(rc->pool, sizeof(ngx_regex_t));
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
148 if (rc->regex == NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
149 return NGX_ERROR;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
150 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
151
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
152 rc->regex->pcre = re;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
153
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
154 /* do not study at runtime */
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
155
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
156 if (ngx_pcre_studies != NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
157 elt = ngx_list_push(ngx_pcre_studies);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
158 if (elt == NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
159 return NGX_ERROR;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
160 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
161
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
162 elt->regex = rc->regex;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
163 elt->name = rc->pattern.data;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
164 }
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
165
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
166 n = pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &rc->captures);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
167 if (n < 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
168 p = "pcre_fullinfo(\"%V\", PCRE_INFO_CAPTURECOUNT) failed: %d";
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
169 goto failed;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
170 }
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
171
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
172 if (rc->captures == 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
173 return NGX_OK;
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
174 }
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
175
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
176 n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMECOUNT, &rc->named_captures);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
177 if (n < 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
178 p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMECOUNT) failed: %d";
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
179 goto failed;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
180 }
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
181
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
182 if (rc->named_captures == 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
183 return NGX_OK;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
184 }
294
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
185
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
186 n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &rc->name_size);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
187 if (n < 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
188 p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMEENTRYSIZE) failed: %d";
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
189 goto failed;
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
190 }
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
191
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
192 n = pcre_fullinfo(re, NULL, PCRE_INFO_NAMETABLE, &rc->names);
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
193 if (n < 0) {
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
194 p = "pcre_fullinfo(\"%V\", PCRE_INFO_NAMETABLE) failed: %d";
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
195 goto failed;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
196 }
294
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
197
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
198 return NGX_OK;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
199
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
200 failed:
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
201
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
202 rc->err.len = ngx_snprintf(rc->err.data, rc->err.len, p, &rc->pattern, n)
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
203 - rc->err.data;
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
204 return NGX_OK;
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
205 }
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
206
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
207
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
208 ngx_int_t
1784
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
209 ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log)
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
210 {
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
211 ngx_int_t n;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
212 ngx_uint_t i;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
213 ngx_regex_elt_t *re;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
214
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
215 re = a->elts;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
216
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
217 for (i = 0; i < a->nelts; i++) {
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
218
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
219 n = ngx_regex_exec(re[i].regex, s, NULL, 0);
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
220
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
221 if (n == NGX_REGEX_NO_MATCHED) {
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
222 continue;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
223 }
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
224
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
225 if (n < 0) {
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
226 ngx_log_error(NGX_LOG_ALERT, log, 0,
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
227 ngx_regex_exec_n " failed: %i on \"%V\" using \"%s\"",
1784
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
228 n, s, re[i].name);
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
229 return NGX_ERROR;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
230 }
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
231
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
232 /* match */
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
233
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
234 return NGX_OK;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
235 }
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
236
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
237 return NGX_DECLINED;
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
238 }
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
239
7d313324d874 ngx_regex_exec_array()
Igor Sysoev <igor@sysoev.ru>
parents: 503
diff changeset
240
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
241 static void * ngx_libc_cdecl
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
242 ngx_regex_malloc(size_t size)
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
243 {
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
244 ngx_pool_t *pool;
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
245 #if (NGX_THREADS)
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
246 ngx_core_tls_t *tls;
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
247
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
248 if (ngx_threaded) {
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
249 tls = ngx_thread_get_tls(ngx_core_tls_key);
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
250 pool = tls->pool;
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
251
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
252 } else {
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
253 pool = ngx_pcre_pool;
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
254 }
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
255
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
256 #else
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
257
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
258 pool = ngx_pcre_pool;
3325
42c16d8bddbe regex named captures
Igor Sysoev <igor@sysoev.ru>
parents: 3319
diff changeset
259
381
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
260 #endif
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
261
02a511569afb nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 294
diff changeset
262 if (pool) {
2049
2a92804f4109 *) back out r2040
Igor Sysoev <igor@sysoev.ru>
parents: 2039
diff changeset
263 return ngx_palloc(pool, size);
294
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
264 }
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
265
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
266 return NULL;
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
267 }
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
268
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
269
503
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
270 static void ngx_libc_cdecl
b1648294f693 nginx-0.1.26-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
271 ngx_regex_free(void *p)
195
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
272 {
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
273 return;
8dee38ea9117 nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
274 }
4388
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
275
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
276
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
277 static ngx_int_t
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
278 ngx_regex_module_init(ngx_cycle_t *cycle)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
279 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
280 int opt;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
281 const char *errstr;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
282 ngx_uint_t i;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
283 ngx_list_part_t *part;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
284 ngx_regex_elt_t *elts;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
285
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
286 opt = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
287
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
288 #if (NGX_HAVE_PCRE_JIT)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
289 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
290 ngx_regex_conf_t *rcf;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
291
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
292 rcf = (ngx_regex_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_regex_module);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
293
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
294 if (rcf->pcre_jit) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
295 opt = PCRE_STUDY_JIT_COMPILE;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
296 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
297 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
298 #endif
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
299
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
300 ngx_regex_malloc_init(cycle->pool);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
301
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
302 part = &ngx_pcre_studies->part;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
303 elts = part->elts;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
304
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
305 for (i = 0 ; /* void */ ; i++) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
306
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
307 if (i >= part->nelts) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
308 if (part->next == NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
309 break;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
310 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
311
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
312 part = part->next;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
313 elts = part->elts;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
314 i = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
315 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
316
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
317 elts[i].regex->extra = pcre_study(elts[i].regex->pcre, opt, &errstr);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
318
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
319 if (errstr != NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
320 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
321 "pcre_study() failed: %s in \"%s\"",
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
322 errstr, elts[i].name);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
323 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
324
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
325 #if (NGX_HAVE_PCRE_JIT)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
326 if (opt & PCRE_STUDY_JIT_COMPILE) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
327 int jit, n;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
328
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
329 jit = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
330 n = pcre_fullinfo(elts[i].regex->pcre, elts[i].regex->extra,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
331 PCRE_INFO_JIT, &jit);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
332
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
333 if (n != 0 || jit != 1) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
334 ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
335 "JIT compiler does not support pattern: \"%s\"",
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
336 elts[i].name);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
337 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
338 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
339 #endif
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
340 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
341
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
342 ngx_regex_malloc_done();
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
343
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
344 ngx_pcre_studies = NULL;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
345
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
346 return NGX_OK;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
347 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
348
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
349
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
350 static void *
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
351 ngx_regex_create_conf(ngx_cycle_t *cycle)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
352 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
353 ngx_regex_conf_t *rcf;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
354
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
355 rcf = ngx_pcalloc(cycle->pool, sizeof(ngx_regex_conf_t));
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
356 if (rcf == NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
357 return NULL;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
358 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
359
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
360 rcf->pcre_jit = NGX_CONF_UNSET;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
361
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
362 ngx_pcre_studies = ngx_list_create(cycle->pool, 8, sizeof(ngx_regex_elt_t));
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
363 if (ngx_pcre_studies == NULL) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
364 return NULL;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
365 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
366
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
367 return rcf;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
368 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
369
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
370
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
371 static char *
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
372 ngx_regex_init_conf(ngx_cycle_t *cycle, void *conf)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
373 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
374 ngx_regex_conf_t *rcf = conf;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
375
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
376 ngx_conf_init_value(rcf->pcre_jit, 0);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
377
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
378 return NGX_CONF_OK;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
379 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
380
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
381
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
382 static char *
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
383 ngx_regex_pcre_jit(ngx_conf_t *cf, void *post, void *data)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
384 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
385 ngx_flag_t *fp = data;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
386
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
387 if (*fp == 0) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
388 return NGX_CONF_OK;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
389 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
390
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
391 #if (NGX_HAVE_PCRE_JIT)
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
392 {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
393 int jit, r;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
394
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
395 jit = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
396 r = pcre_config(PCRE_CONFIG_JIT, &jit);
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
397
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
398 if (r != 0 || jit != 1) {
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
399 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
400 "PCRE library does not support JIT");
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
401 *fp = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
402 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
403 }
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
404 #else
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
405 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
406 "nginx was build without PCRE JIT support");
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
407 *fp = 0;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
408 #endif
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
409
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
410 return NGX_CONF_OK;
005fc2d5e84f Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents: 4326
diff changeset
411 }