comparison src/core/ngx_regex.c @ 52:0d75d65c642f NGINX_0_1_26

nginx 0.1.26 *) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the server name is also logged in error log. *) Feature: the ngx_http_auth_basic_module module and the auth_basic and auth_basic_user_file directives.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Mar 2005 00:00:00 +0300
parents 72eb30262aac
children 9121a0a91f47
comparison
equal deleted inserted replaced
51:43f383e47efc 52:0d75d65c642f
6 6
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 9
10 10
11 static void *ngx_regex_malloc(size_t size); 11 static void * ngx_libc_cdecl ngx_regex_malloc(size_t size);
12 static void ngx_regex_free(void *p); 12 static void ngx_libc_cdecl ngx_regex_free(void *p);
13 13
14 14
15 static ngx_pool_t *ngx_pcre_pool; 15 static ngx_pool_t *ngx_pcre_pool;
16 16
17 17
18 void ngx_regex_init(void) 18 void
19 ngx_regex_init(void)
19 { 20 {
20 pcre_malloc = ngx_regex_malloc; 21 pcre_malloc = ngx_regex_malloc;
21 pcre_free = ngx_regex_free; 22 pcre_free = ngx_regex_free;
22 } 23 }
23 24
24 25
25 ngx_regex_t *ngx_regex_compile(ngx_str_t *pattern, ngx_int_t options, 26 ngx_regex_t *
26 ngx_pool_t *pool, ngx_str_t *err) 27 ngx_regex_compile(ngx_str_t *pattern, ngx_int_t options, ngx_pool_t *pool,
28 ngx_str_t *err)
27 { 29 {
28 int erroff; 30 int erroff;
29 const char *errstr; 31 const char *errstr;
30 ngx_regex_t *re; 32 ngx_regex_t *re;
31 #if (NGX_THREADS) 33 #if (NGX_THREADS)
77 79
78 return re; 80 return re;
79 } 81 }
80 82
81 83
82 ngx_int_t ngx_regex_capture_count(ngx_regex_t *re) 84 ngx_int_t
85 ngx_regex_capture_count(ngx_regex_t *re)
83 { 86 {
84 int rc, n; 87 int rc, n;
85 88
86 n = 0; 89 n = 0;
87 90
93 96
94 return (ngx_int_t) n; 97 return (ngx_int_t) n;
95 } 98 }
96 99
97 100
98 ngx_int_t ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s, 101 ngx_int_t
99 int *captures, ngx_int_t size) 102 ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s, int *captures, ngx_int_t size)
100 { 103 {
101 int rc; 104 int rc;
102 105
103 rc = pcre_exec(re, NULL, (const char *) s->data, s->len, 0, 0, 106 rc = pcre_exec(re, NULL, (const char *) s->data, s->len, 0, 0,
104 captures, size); 107 captures, size);
109 112
110 return rc; 113 return rc;
111 } 114 }
112 115
113 116
114 static void *ngx_regex_malloc(size_t size) 117 static void * ngx_libc_cdecl
118 ngx_regex_malloc(size_t size)
115 { 119 {
116 ngx_pool_t *pool; 120 ngx_pool_t *pool;
117 #if (NGX_THREADS) 121 #if (NGX_THREADS)
118 ngx_core_tls_t *tls; 122 ngx_core_tls_t *tls;
119 123
133 137
134 return NULL; 138 return NULL;
135 } 139 }
136 140
137 141
138 static void ngx_regex_free(void *p) 142 static void ngx_libc_cdecl
143 ngx_regex_free(void *p)
139 { 144 {
140 return; 145 return;
141 } 146 }