use stable search where it is required

This commit is contained in:
Igor Sysoev 2007-05-21 14:09:12 +00:00
parent 35921283df
commit c02ed54c4f
3 changed files with 14 additions and 17 deletions

View File

@ -19,8 +19,7 @@ static ngx_int_t ngx_http_add_names(ngx_conf_t *cf,
static char *ngx_http_merge_locations(ngx_conf_t *cf, static char *ngx_http_merge_locations(ngx_conf_t *cf,
ngx_array_t *locations, void **loc_conf, ngx_http_module_t *module, ngx_array_t *locations, void **loc_conf, ngx_http_module_t *module,
ngx_uint_t ctx_index); ngx_uint_t ctx_index);
static int ngx_libc_cdecl ngx_http_cmp_conf_in_addrs(const void *one, static int ngx_http_cmp_conf_in_addrs(const void *one, const void *two);
const void *two);
static int ngx_libc_cdecl ngx_http_cmp_dns_wildcards(const void *one, static int ngx_libc_cdecl ngx_http_cmp_dns_wildcards(const void *one,
const void *two); const void *two);
@ -599,8 +598,8 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_port = in_ports.elts; in_port = in_ports.elts;
for (p = 0; p < in_ports.nelts; p++) { for (p = 0; p < in_ports.nelts; p++) {
ngx_qsort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts, ngx_sort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
sizeof(ngx_http_conf_in_addr_t), ngx_http_cmp_conf_in_addrs); sizeof(ngx_http_conf_in_addr_t), ngx_http_cmp_conf_in_addrs);
/* /*
* check whether all name-based servers have the same configuraiton * check whether all name-based servers have the same configuraiton
@ -1027,7 +1026,7 @@ ngx_http_merge_locations(ngx_conf_t *cf, ngx_array_t *locations,
} }
static int ngx_libc_cdecl static int
ngx_http_cmp_conf_in_addrs(const void *one, const void *two) ngx_http_cmp_conf_in_addrs(const void *one, const void *two)
{ {
ngx_http_conf_in_addr_t *first, *second; ngx_http_conf_in_addr_t *first, *second;

View File

@ -45,8 +45,7 @@ static char *ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd,
void *dummy); void *dummy);
static char *ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd,
void *dummy); void *dummy);
static int ngx_libc_cdecl ngx_http_core_cmp_locations(const void *first, static int ngx_http_core_cmp_locations(const void *first, const void *second);
const void *second);
static char *ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf); void *conf);
@ -1642,8 +1641,8 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
return rv; return rv;
} }
ngx_qsort(cscf->locations.elts, (size_t) cscf->locations.nelts, ngx_sort(cscf->locations.elts, (size_t) cscf->locations.nelts,
sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations); sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
return rv; return rv;
} }
@ -1814,14 +1813,14 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
return rv; return rv;
} }
ngx_qsort(clcf->locations.elts, (size_t) clcf->locations.nelts, ngx_sort(clcf->locations.elts, (size_t) clcf->locations.nelts,
sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations); sizeof(ngx_http_core_loc_conf_t *), ngx_http_core_cmp_locations);
return rv; return rv;
} }
static int ngx_libc_cdecl static int
ngx_http_core_cmp_locations(const void *one, const void *two) ngx_http_core_cmp_locations(const void *one, const void *two)
{ {
ngx_int_t rc; ngx_int_t rc;

View File

@ -11,8 +11,7 @@
static char *ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static int ngx_libc_cdecl ngx_mail_cmp_conf_in_addrs(const void *one, static int ngx_mail_cmp_conf_in_addrs(const void *one, const void *two);
const void *two);
ngx_uint_t ngx_mail_max_module; ngx_uint_t ngx_mail_max_module;
@ -269,8 +268,8 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_port = in_ports.elts; in_port = in_ports.elts;
for (p = 0; p < in_ports.nelts; p++) { for (p = 0; p < in_ports.nelts; p++) {
ngx_qsort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts, ngx_sort(in_port[p].addrs.elts, (size_t) in_port[p].addrs.nelts,
sizeof(ngx_mail_conf_in_addr_t), ngx_mail_cmp_conf_in_addrs); sizeof(ngx_mail_conf_in_addr_t), ngx_mail_cmp_conf_in_addrs);
in_addr = in_port[p].addrs.elts; in_addr = in_port[p].addrs.elts;
last = in_port[p].addrs.nelts; last = in_port[p].addrs.nelts;
@ -387,7 +386,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} }
static int ngx_libc_cdecl static int
ngx_mail_cmp_conf_in_addrs(const void *one, const void *two) ngx_mail_cmp_conf_in_addrs(const void *one, const void *two)
{ {
ngx_mail_conf_in_addr_t *first, *second; ngx_mail_conf_in_addr_t *first, *second;