Mercurial > hg > nginx-vendor-0-7
annotate src/core/ngx_array.c @ 22:8b6db3bda591 NGINX_0_1_11
nginx 0.1.11
*) Feature: the worker_priority directive.
*) Change: both tcp_nopush and tcp_nodelay directives affect the
transferred response.
*) Bugfix: nginx did not call initgroups().
Thanks to Andrew Sitnikov and Andrei Nigmatulin.
*) Change: now the ngx_http_autoindex_module shows the file size in the
bytes.
*) Bugfix: the ngx_http_autoindex_module returned the 500 error if the
broken symlink was in a directory.
*) Bugfix: the files bigger than 4G could not be transferred using
sendfile.
*) Bugfix: if the backend was resolved to several backends and there
was an error while the response waiting then process may got caught
in an endless loop.
*) Bugfix: the worker process may exit with the "unknown cycle" message
when the /dev/poll method was used.
*) Bugfix: "close() channel failed" errors.
*) Bugfix: the autodetection of the "nobody" and "nogroup" groups.
*) Bugfix: the send_lowat directive did not work on Linux.
*) Bugfix: the segmentation fault occurred if there was no events
section in configuration.
*) Bugfix: nginx could not be built on OpenBSD.
*) Bugfix: the double slashes in "://" in the URI were converted to
":/".
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 02 Dec 2004 00:00:00 +0300 |
parents | f0b350454894 |
children | aab2ea7c0458 |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 ngx_array_t *ngx_create_array(ngx_pool_t *p, ngx_uint_t n, size_t size) | |
12 { | |
13 ngx_array_t *a; | |
14 | |
15 ngx_test_null(a, ngx_palloc(p, sizeof(ngx_array_t)), NULL); | |
16 | |
17 ngx_test_null(a->elts, ngx_palloc(p, n * size), NULL); | |
18 | |
19 a->pool = p; | |
20 a->nelts = 0; | |
21 a->nalloc = n; | |
22 a->size = size; | |
23 | |
24 return a; | |
25 } | |
26 | |
27 | |
28 void ngx_destroy_array(ngx_array_t *a) | |
29 { | |
30 ngx_pool_t *p; | |
31 | |
32 p = a->pool; | |
33 | |
34 if ((char *) a->elts + a->size * a->nalloc == p->last) { | |
35 p->last -= a->size * a->nalloc; | |
36 } | |
37 | |
38 if ((char *) a + sizeof(ngx_array_t) == p->last) { | |
39 p->last = (char *) a; | |
40 } | |
41 } | |
42 | |
43 | |
44 void *ngx_push_array(ngx_array_t *a) | |
45 { | |
46 void *elt, *new; | |
47 ngx_pool_t *p; | |
48 | |
49 /* array is full */ | |
50 if (a->nelts == a->nalloc) { | |
51 p = a->pool; | |
52 | |
53 /* array allocation is the last in the pool */ | |
54 if ((char *) a->elts + a->size * a->nelts == p->last | |
55 && (unsigned) (p->end - p->last) >= a->size) | |
56 { | |
57 p->last += a->size; | |
58 a->nalloc++; | |
59 | |
60 /* allocate new array */ | |
61 } else { | |
62 ngx_test_null(new, ngx_palloc(p, 2 * a->nalloc * a->size), NULL); | |
63 | |
64 ngx_memcpy(new, a->elts, a->nalloc * a->size); | |
65 a->elts = new; | |
66 a->nalloc *= 2; | |
67 } | |
68 } | |
69 | |
70 elt = (char *) a->elts + a->size * a->nelts; | |
71 a->nelts++; | |
72 | |
73 return elt; | |
74 } |