comparison src/os/win32/ngx_alloc.c @ 346:55e496a8ece3

nginx-0.0.3-2004-06-06-23:49:18 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 06 Jun 2004 19:49:18 +0000
parents
children da8c5707af39
comparison
equal deleted inserted replaced
345:fade4edd61f8 346:55e496a8ece3
1
2 #include <ngx_config.h>
3 #include <ngx_core.h>
4
5
6 int ngx_pagesize;
7
8
9 void *ngx_alloc(size_t size, ngx_log_t *log)
10 {
11 void *p;
12
13 if (!(p = malloc(size))) {
14 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
15 "malloc() " SIZE_T_FMT " bytes failed", size);
16 }
17
18 ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
19 "malloc: " PTR_FMT ":" SIZE_T_FMT, p, size);
20
21 return p;
22 }
23
24
25 void *ngx_calloc(size_t size, ngx_log_t *log)
26 {
27 void *p;
28
29 p = ngx_alloc(size, log);
30
31 if (p) {
32 ngx_memzero(p, size);
33 }
34
35 return p;
36 }