comparison src/core/ngx_alloc.h @ 0:4eff17414a43

nginx-0.0.1-2002-08-06-20:39:45 import The first code that uses "ngx_" prefix, the previous one used "gx_" prefix. At that point the code is not yet usable. The first draft ideas are dated back to 23.10.2001.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 06 Aug 2002 16:39:45 +0000
parents
children 0e81ac0bb3e2
comparison
equal deleted inserted replaced
-1:000000000000 0:4eff17414a43
1 #ifndef _NGX_ALLOC_H_INCLUDED_
2 #define _NGX_ALLOC_H_INCLUDED_
3
4
5 #include <ngx_config.h>
6
7 #include <ngx_log.h>
8
9
10 #define NGX_MAX_ALLOC_FROM_POOL (8192 - sizeof(ngx_pool_t))
11 #define NGX_DEFAULT_POOL_SIZE (16 * 1024)
12
13 #define ngx_test_null(p, alloc, rc) if ((p = alloc) == NULL) return rc
14
15
16 typedef struct ngx_pool_large_s ngx_pool_large_t;
17 struct ngx_pool_large_s {
18 ngx_pool_large_t *next;
19 void *alloc;
20 };
21
22 typedef struct ngx_pool_s ngx_pool_t;
23 struct ngx_pool_s {
24 char *last;
25 char *end;
26 ngx_pool_t *next;
27 ngx_pool_large_t *large;
28 ngx_log_t *log;
29 };
30
31
32 void *ngx_alloc(size_t size, ngx_log_t *log);
33 void *ngx_calloc(size_t size, ngx_log_t *log);
34
35 ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log);
36 void ngx_destroy_pool(ngx_pool_t *pool);
37
38 void *ngx_palloc(ngx_pool_t *pool, size_t size);
39 void *ngx_pcalloc(ngx_pool_t *pool, size_t size);
40
41
42 #endif /* _NGX_ALLOC_H_INCLUDED_ */