00001
00002
00003
00004
00005
00006 #include "copyright.h"
00007
00008 #ifndef M_ALLOC_H
00009 #define M_ALLOC_H
00010
00011 #define POOL_SBUF 0
00012 #define POOL_MBUF 1
00013 #define POOL_LBUF 2
00014 #define POOL_BOOL 3
00015 #define POOL_DESC 4
00016 #define POOL_QENTRY 5
00017 #define POOL_PCACHE 6
00018 #define NUM_POOLS 7
00019
00020
00021 #define LBUF_SIZE 16384
00022 #define MBUF_SIZE 2048
00023 #define SBUF_SIZE 256
00024
00025 #define alloc_lbuf(s) (char *)malloc(LBUF_SIZE)
00026 #define free_lbuf(b) if (b) free(b)
00027 #define alloc_mbuf(s) (char *)malloc(MBUF_SIZE)
00028 #define free_mbuf(b) if (b) free(b)
00029 #define alloc_sbuf(s) (char *)malloc(SBUF_SIZE)
00030 #define free_sbuf(b) if (b) free(b)
00031 #define alloc_bool(s) (struct boolexp *)malloc(sizeof(struct boolexp))
00032 #define free_bool(b) if (b) free(b)
00033 #define alloc_qentry(s) (BQUE *)malloc(sizeof(BQUE))
00034 #define free_qentry(b) if (b) free(b)
00035 #define alloc_pcache(s) (PCACHE *)malloc(sizeof(PCACHE)
00036 #define free_pcache(b) if (b) free(b)
00037
00038 #define safe_str(s,b,p) safe_copy_str(s,b,p,(LBUF_SIZE-1))
00039 #define safe_chr(c,b,p) safe_copy_chr(c,b,p,(LBUF_SIZE-1))
00040 #define safe_sb_str(s,b,p) safe_copy_str(s,b,p,(SBUF_SIZE-1))
00041 #define safe_sb_chr(c,b,p) safe_copy_chr(c,b,p,(SBUF_SIZE-1))
00042 #define safe_mb_str(s,b,p) safe_copy_str(s,b,p,(MBUF_SIZE-1))
00043 #define safe_mb_chr(c,b,p) safe_copy_chr(c,b,p,(MBUF_SIZE-1))
00044
00045 #endif