comparison src/core/ngx_string.c @ 302:9b7db0df50f0 NGINX_0_5_21

nginx 0.5.21 *) Bugfix: if server has more than about ten locations, then regex locations might be choosen not in that order as they were specified. *) Bugfix: a worker process may got caught in an endless loop on 64-bit platform, if the 33-rd or next in succession backend has failed. Thanks to Anton Povarov. *) Bugfix: a bus error might occur on Solaris/sparc64 if the PCRE library was used. Thanks to Andrei Nigmatulin. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 28 May 2007 00:00:00 +0400
parents 5bef04fc3fd5
children 24def6198d7f
comparison
equal deleted inserted replaced
301:a025840de07d 302:9b7db0df50f0
1200 *dst = d; 1200 *dst = d;
1201 *src = s; 1201 *src = s;
1202 } 1202 }
1203 1203
1204 1204
1205 /* ngx_sort() is implemented as insertion sort because we need stable sort */
1206
1207 void
1208 ngx_sort(void *base, size_t n, size_t size,
1209 int (*cmp)(const void *, const void *))
1210 {
1211 u_char *p1, *p2;
1212 u_char buf[256];
1213
1214 for (p1 = (u_char *) base + size;
1215 p1 < (u_char *) base + n * size;
1216 p1 += size)
1217 {
1218 ngx_memcpy(buf, p1, size);
1219
1220 for (p2 = p1;
1221 p2 > (u_char *) base && cmp(p2 - size, buf) > 0;
1222 p2 -= size)
1223 {
1224 ngx_memcpy(p2, p2 - size, size);
1225 }
1226
1227 ngx_memcpy(p2, buf, size);
1228 }
1229 }
1230
1231
1205 #if (NGX_MEMCPY_LIMIT) 1232 #if (NGX_MEMCPY_LIMIT)
1206 1233
1207 void * 1234 void *
1208 ngx_memcpy(void *dst, void *src, size_t n) 1235 ngx_memcpy(void *dst, void *src, size_t n)
1209 { 1236 {