comparison src/os/unix/ngx_alloc.c @ 3321:93e8daca5dbb

update allocation error messages
author Igor Sysoev <igor@sysoev.ru>
date Sun, 15 Nov 2009 09:03:08 +0000
parents d4ad1b0b6c8d
children f67635893ed8
comparison
equal deleted inserted replaced
3320:d4ad1b0b6c8d 3321:93e8daca5dbb
19 void *p; 19 void *p;
20 20
21 p = malloc(size); 21 p = malloc(size);
22 if (p == NULL) { 22 if (p == NULL) {
23 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 23 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
24 "malloc() %uz bytes failed", size); 24 "malloc(%uz) failed", size);
25 } 25 }
26 26
27 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size); 27 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size);
28 28
29 return p; 29 return p;
55 55
56 err = posix_memalign(&p, alignment, size); 56 err = posix_memalign(&p, alignment, size);
57 57
58 if (err) { 58 if (err) {
59 ngx_log_error(NGX_LOG_EMERG, log, err, 59 ngx_log_error(NGX_LOG_EMERG, log, err,
60 "posix_memalign() %uz bytes aligned to %uz failed", 60 "posix_memalign(%uz, %uz) failed", alignment, size);
61 size, alignment);
62 p = NULL; 61 p = NULL;
63 } 62 }
64 63
65 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, 64 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
66 "posix_memalign: %p:%uz", p, size); 65 "posix_memalign: %p:%uz", p, size);
76 void *p; 75 void *p;
77 76
78 p = memalign(alignment, size); 77 p = memalign(alignment, size);
79 if (p == NULL) { 78 if (p == NULL) {
80 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 79 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
81 "memalign() %uz bytes aligned to %uz failed", 80 "memalign(%uz, %uz) failed", alignment, size);
82 size, alignment);
83 } 81 }
84 82
85 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, 83 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
86 "memalign: %p:%uz", p, size); 84 "memalign: %p:%uz", p, size);
87 85