Last change
on this file since 1615 was
1270,
checked in by dkearney, 16 years ago
|
rappture object updates, stuff i'm playing around with. the code is not functional but it compiles, and i dont want to loose this state as i continue to play. the configure scripts and makefiles should still be working properly.
|
File size:
1.2 KB
|
Line | |
---|
1 | #ifndef RP_POOL_H |
---|
2 | #define RP_POOL_H |
---|
3 | |
---|
4 | typedef 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 | |
---|
12 | typedef struct Rp_PoolStruct *Rp_Pool; |
---|
13 | |
---|
14 | typedef void *(Rp_PoolAllocProc) _ANSI_ARGS_((Rp_Pool pool, size_t size)); |
---|
15 | typedef void (Rp_PoolFreeProc) _ANSI_ARGS_((Rp_Pool pool, void *item)); |
---|
16 | |
---|
17 | struct 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 | |
---|
30 | extern Rp_Pool Rp_PoolCreate _ANSI_ARGS_((int type)); |
---|
31 | extern 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.