source: branches/1.7/src/objects/RpPool.h @ 6694

Last change on this file since 6694 was 5679, checked in by ldelgass, 9 years ago

Full merge 1.3 branch to uq branch to sync. Fixed partial subdirectory merge
by removing mergeinfo from lang/python/Rappture directory.

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1#ifndef RP_POOL_H
2#define RP_POOL_H
3
4typedef struct Rp_PoolChainStruct {
5   struct Rp_PoolChainStruct *nextPtr;
6} Rp_PoolChain;
7
8#define RP_STRING_ITEMS         0
9#define RP_FIXED_SIZE_ITEMS     1
10#define RP_VARIABLE_SIZE_ITEMS  2
11
12typedef struct Rp_PoolStruct *Rp_Pool;
13
14typedef void *(Rp_PoolAllocProc) _ANSI_ARGS_((Rp_Pool pool, size_t size));
15typedef void (Rp_PoolFreeProc) _ANSI_ARGS_((Rp_Pool pool, void *item));
16
17struct Rp_PoolStruct {
18    Rp_PoolChain *headPtr;  /* Chain of malloc'ed chunks. */
19    Rp_PoolChain *freePtr;  /* List of deleted items. This is only used
20                             * for fixed size items. */
21    size_t poolSize;        /* Log2 of # of items in the current block. */
22    size_t itemSize;        /* Size of an item. */
23    size_t bytesLeft;       /* # of bytes left in the current chunk. */
24    size_t waste;
25
26    Rp_PoolAllocProc *allocProc;
27    Rp_PoolFreeProc *freeProc;
28};
29
30extern Rp_Pool Rp_PoolCreate _ANSI_ARGS_((int type));
31extern void Rp_PoolDestroy _ANSI_ARGS_((Rp_Pool pool));
32
33#define Rp_PoolAllocItem(poolPtr, n) (*((poolPtr)->allocProc))(poolPtr, n)
34#define Rp_PoolFreeItem(poolPtr, item) (*((poolPtr)->freeProc))(poolPtr, item)
35
36#endif /* RP_POOL_H */
Note: See TracBrowser for help on using the repository browser.