comparison src/os/unix/ngx_alloc.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 6f8b0dc0f8dd
children 8e6d4d96ec4c
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
9 9
10 10
11 int ngx_pagesize; 11 int ngx_pagesize;
12 12
13 13
14 void *ngx_alloc(size_t size, ngx_log_t *log) 14 void *
15 ngx_alloc(size_t size, ngx_log_t *log)
15 { 16 {
16 void *p; 17 void *p;
17 18
18 if (!(p = malloc(size))) { 19 p = malloc(size);
20 if (p == NULL) {
19 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 21 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
20 "malloc() %uz bytes failed", size); 22 "malloc() %uz bytes failed", size);
21 } 23 }
22 24
23 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size); 25 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
24 26
25 return p; 27 return p;
26 } 28 }
27 29
28 30
29 void *ngx_calloc(size_t size, ngx_log_t *log) 31 void *
32 ngx_calloc(size_t size, ngx_log_t *log)
30 { 33 {
31 void *p; 34 void *p;
32 35
33 p = ngx_alloc(size, log); 36 p = ngx_alloc(size, log);
34 37
40 } 43 }
41 44
42 45
43 #if (NGX_HAVE_POSIX_MEMALIGN) 46 #if (NGX_HAVE_POSIX_MEMALIGN)
44 47
45 void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log) 48 void *
49 ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
46 { 50 {
47 void *p; 51 void *p;
48 52
49 if (posix_memalign(&p, alignment, size) == -1) { 53 if (posix_memalign(&p, alignment, size) == -1) {
50 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 54 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
58 return p; 62 return p;
59 } 63 }
60 64
61 #elif (NGX_HAVE_MEMALIGN) 65 #elif (NGX_HAVE_MEMALIGN)
62 66
63 void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log) 67 void *
68 ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
64 { 69 {
65 void *p; 70 void *p;
66 71
67 if (!(p = memalign(alignment, size))) { 72 p = memalign(alignment, size);
73 if (p == NULL) {
68 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 74 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
69 "memalign() %uz bytes aligned to %uz failed", 75 "memalign() %uz bytes aligned to %uz failed",
70 size, alignment); 76 size, alignment);
71 } 77 }
72 78