comparison src/core/ngx_regex.c @ 290:87e73f067470

nginx-0.0.2-2004-03-16-10:10:12 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 16 Mar 2004 07:10:12 +0000
parents f1d0e5f09c1e
children 5cfd65b8b0a7
comparison
equal deleted inserted replaced
289:0750faf8d7e3 290:87e73f067470
25 const char *errstr; 25 const char *errstr;
26 ngx_regex_t *re; 26 ngx_regex_t *re;
27 27
28 ngx_pcre_pool = pool; 28 ngx_pcre_pool = pool;
29 29
30 re = pcre_compile(pattern->data, (int) options, &errstr, &erroff, NULL); 30 re = pcre_compile((const char *) pattern->data, (int) options,
31 &errstr, &erroff, NULL);
31 32
32 if (re == NULL) { 33 if (re == NULL) {
33 if ((size_t) erroff == pattern->len) { 34 if ((size_t) erroff == pattern->len) {
34 ngx_snprintf(err->data, err->len - 1, 35 ngx_snprintf((char *) err->data, err->len - 1,
35 "pcre_compile() failed: %s in \"%s\"", 36 "pcre_compile() failed: %s in \"%s\"",
36 errstr, pattern->data); 37 errstr, pattern->data);
37 } else { 38 } else {
38 ngx_snprintf(err->data, err->len - 1, 39 ngx_snprintf((char *) err->data, err->len - 1,
39 "pcre_compile() failed: %s in \"%s\" at \"%s\"", 40 "pcre_compile() failed: %s in \"%s\" at \"%s\"",
40 errstr, pattern->data, pattern->data + erroff); 41 errstr, pattern->data, pattern->data + erroff);
41 } 42 }
42 } 43 }
43 44
48 ngx_int_t ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s, 49 ngx_int_t ngx_regex_exec(ngx_regex_t *re, ngx_str_t *s,
49 int *matches, ngx_int_t size) 50 int *matches, ngx_int_t size)
50 { 51 {
51 int rc; 52 int rc;
52 53
53 rc = pcre_exec(re, NULL, s->data, s->len, 0, 0, matches, size); 54 rc = pcre_exec(re, NULL, (const char *) s->data, s->len, 0, 0,
55 matches, size);
54 56
55 if (rc == -1) { 57 if (rc == -1) {
56 return NGX_DECLINED; 58 return NGX_DECLINED;
57 } 59 }
58 60