ngx_pool_t *
ngx_create_pool(size_t size, ngx_log_t *log)
{
    ngx_pool_t  *p;
    p = ngx_alloc(size, log);
    if (p == NULL) {
        return NULL;
    }
    p->d.last = (u_char *) p + sizeof(ngx_pool_t);
    p->d.end = (u_char *) p + size;
    p->d.next = NULL;
    size = size - sizeof(ngx_pool_t);
    p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;
    p->current = p;
    p->chain = NULL;
    p->large = NULL;
    p->cleanup = NULL;
    p->log = log;
    return p;
}
['static ngx_int_t\nngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,\n    ngx_http_conf_addr_t *addr)\n{\n    ngx_int_t                rc;\n    ngx_uint_t               s;\n    ngx_hash_init_t          hash;\n    ngx_hash_keys_arrays_t   ha;\n    ngx_http_server_name_t  *name;\n#if (NGX_PCRE)\n    ngx_uint_t               regex, i;\n    regex = 0;\n#endif\n    ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));\n    ha.temp_pool = ngx_create_pool(16384, cf->log);\n    if (ha.temp_pool == NULL) {\n        return NGX_ERROR;\n    }\n    ha.pool = cf->pool;\n    if (ngx_hash_keys_array_init(&ha, NGX_HASH_LARGE) != NGX_OK) {\n        goto failed;\n    }\n    name = addr->names.elts;\n    for (s = 0; s < addr->names.nelts; s++) {\n#if (NGX_PCRE)\n        if (name[s].regex) {\n            regex++;\n            continue;\n        }\n#endif\n        rc = ngx_hash_add_key(&ha, &name[s].name, name[s].core_srv_conf,\n                              NGX_HASH_WILDCARD_KEY);\n        if (rc == NGX_ERROR) {\n            return NGX_ERROR;\n        }\n        if (rc == NGX_DECLINED) {\n            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,\n                          "invalid server name or wildcard \\"%V\\" on %s",\n                          &name[s].name, addr->listen_conf->addr);\n            return NGX_ERROR;\n        }\n        if (rc == NGX_BUSY) {\n            ngx_log_error(NGX_LOG_WARN, cf->log, 0,\n                          "conflicting server name \\"%V\\" on %s, ignored",\n                          &name[s].name, addr->listen_conf->addr);\n        }\n    }\n    hash.key = ngx_hash_key_lc;\n    hash.max_size = cmcf->server_names_hash_max_size;\n    hash.bucket_size = cmcf->server_names_hash_bucket_size;\n    hash.name = "server_names_hash";\n    hash.pool = cf->pool;\n    if (ha.keys.nelts) {\n        hash.hash = &addr->hash;\n        hash.temp_pool = NULL;\n        if (ngx_hash_init(&hash, ha.keys.elts, ha.keys.nelts) != NGX_OK) {\n            goto failed;\n        }\n    }\n    if (ha.dns_wc_head.nelts) {\n        ngx_qsort(ha.dns_wc_head.elts, (size_t) ha.dns_wc_head.nelts,\n                  sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);\n        hash.hash = NULL;\n        hash.temp_pool = ha.temp_pool;\n        if (ngx_hash_wildcard_init(&hash, ha.dns_wc_head.elts,\n                                   ha.dns_wc_head.nelts)\n            != NGX_OK)\n        {\n            goto failed;\n        }\n        addr->wc_head = (ngx_hash_wildcard_t *) hash.hash;\n    }\n    if (ha.dns_wc_tail.nelts) {\n        ngx_qsort(ha.dns_wc_tail.elts, (size_t) ha.dns_wc_tail.nelts,\n                  sizeof(ngx_hash_key_t), ngx_http_cmp_dns_wildcards);\n        hash.hash = NULL;\n        hash.temp_pool = ha.temp_pool;\n        if (ngx_hash_wildcard_init(&hash, ha.dns_wc_tail.elts,\n                                   ha.dns_wc_tail.nelts)\n            != NGX_OK)\n        {\n            goto failed;\n        }\n        addr->wc_tail = (ngx_hash_wildcard_t *) hash.hash;\n    }\n    ngx_destroy_pool(ha.temp_pool);\n#if (NGX_PCRE)\n    if (regex == 0) {\n        return NGX_OK;\n    }\n    addr->nregex = regex;\n    addr->regex = ngx_palloc(cf->pool, regex * sizeof(ngx_http_server_name_t));\n    if (addr->regex == NULL) {\n        return NGX_ERROR;\n    }\n    for (i = 0, s = 0; s < addr->names.nelts; s++) {\n        if (name[s].regex) {\n            addr->regex[i++] = name[s];\n        }\n    }\n#endif\n    return NGX_OK;\nfailed:\n    ngx_destroy_pool(ha.temp_pool);\n    return NGX_ERROR;\n}', 'ngx_pool_t *\nngx_create_pool(size_t size, ngx_log_t *log)\n{\n    ngx_pool_t  *p;\n    p = ngx_alloc(size, log);\n    if (p == NULL) {\n        return NULL;\n    }\n    p->d.last = (u_char *) p + sizeof(ngx_pool_t);\n    p->d.end = (u_char *) p + size;\n    p->d.next = NULL;\n    size = size - sizeof(ngx_pool_t);\n    p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;\n    p->current = p;\n    p->chain = NULL;\n    p->large = NULL;\n    p->cleanup = NULL;\n    p->log = log;\n    return p;\n}']