mirror of
https://github.com/nginx/nginx.git
synced 2024-12-12 18:29:00 +08:00
Core: ngx_regex.c style cleanup.
Notably, ngx_pcre_pool and ngx_pcre_studies are renamed to ngx_regex_pool and ngx_regex_studies, respectively.
This commit is contained in:
parent
09268f58b4
commit
28f8caac37
@ -15,6 +15,9 @@ typedef struct {
|
|||||||
} ngx_regex_conf_t;
|
} ngx_regex_conf_t;
|
||||||
|
|
||||||
|
|
||||||
|
static ngx_inline void ngx_regex_malloc_init(ngx_pool_t *pool);
|
||||||
|
static ngx_inline void ngx_regex_malloc_done(void);
|
||||||
|
|
||||||
static void * ngx_libc_cdecl ngx_regex_malloc(size_t size);
|
static void * ngx_libc_cdecl ngx_regex_malloc(size_t size);
|
||||||
static void ngx_libc_cdecl ngx_regex_free(void *p);
|
static void ngx_libc_cdecl ngx_regex_free(void *p);
|
||||||
static void ngx_regex_cleanup(void *data);
|
static void ngx_regex_cleanup(void *data);
|
||||||
@ -64,8 +67,8 @@ ngx_module_t ngx_regex_module = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static ngx_pool_t *ngx_pcre_pool;
|
static ngx_pool_t *ngx_regex_pool;
|
||||||
static ngx_list_t *ngx_pcre_studies;
|
static ngx_list_t *ngx_regex_studies;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -79,14 +82,14 @@ ngx_regex_init(void)
|
|||||||
static ngx_inline void
|
static ngx_inline void
|
||||||
ngx_regex_malloc_init(ngx_pool_t *pool)
|
ngx_regex_malloc_init(ngx_pool_t *pool)
|
||||||
{
|
{
|
||||||
ngx_pcre_pool = pool;
|
ngx_regex_pool = pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ngx_inline void
|
static ngx_inline void
|
||||||
ngx_regex_malloc_done(void)
|
ngx_regex_malloc_done(void)
|
||||||
{
|
{
|
||||||
ngx_pcre_pool = NULL;
|
ngx_regex_pool = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,8 +136,8 @@ ngx_regex_compile(ngx_regex_compile_t *rc)
|
|||||||
|
|
||||||
/* do not study at runtime */
|
/* do not study at runtime */
|
||||||
|
|
||||||
if (ngx_pcre_studies != NULL) {
|
if (ngx_regex_studies != NULL) {
|
||||||
elt = ngx_list_push(ngx_pcre_studies);
|
elt = ngx_list_push(ngx_regex_studies);
|
||||||
if (elt == NULL) {
|
if (elt == NULL) {
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
}
|
||||||
@ -229,11 +232,8 @@ ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log)
|
|||||||
static void * ngx_libc_cdecl
|
static void * ngx_libc_cdecl
|
||||||
ngx_regex_malloc(size_t size)
|
ngx_regex_malloc(size_t size)
|
||||||
{
|
{
|
||||||
ngx_pool_t *pool;
|
if (ngx_regex_pool) {
|
||||||
pool = ngx_pcre_pool;
|
return ngx_palloc(ngx_regex_pool, size);
|
||||||
|
|
||||||
if (pool) {
|
|
||||||
return ngx_palloc(pool, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -286,10 +286,10 @@ ngx_regex_cleanup(void *data)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* On configuration parsing errors ngx_regex_module_init() will not
|
* On configuration parsing errors ngx_regex_module_init() will not
|
||||||
* be called. Make sure ngx_pcre_studies is properly cleared anyway.
|
* be called. Make sure ngx_regex_studies is properly cleared anyway.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ngx_pcre_studies = NULL;
|
ngx_regex_studies = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ ngx_regex_module_init(ngx_cycle_t *cycle)
|
|||||||
|
|
||||||
ngx_regex_malloc_done();
|
ngx_regex_malloc_done();
|
||||||
|
|
||||||
ngx_pcre_studies = NULL;
|
ngx_regex_studies = NULL;
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ ngx_regex_create_conf(ngx_cycle_t *cycle)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_pcre_studies = rcf->studies;
|
ngx_regex_studies = rcf->studies;
|
||||||
|
|
||||||
return rcf;
|
return rcf;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user