| 27 |
|
|
| 28 |
|
#include "stdinc.h" |
| 29 |
|
#include "list.h" |
| 30 |
– |
#include "balloc.h" |
| 30 |
|
#include "s_user.h" |
| 31 |
|
#include "s_misc.h" |
| 32 |
|
#include "client.h" |
| 41 |
|
#include "supported.h" |
| 42 |
|
#include "whowas.h" |
| 43 |
|
#include "memory.h" |
| 44 |
+ |
#include "mempool.h" |
| 45 |
|
#include "packet.h" |
| 46 |
|
#include "watch.h" |
| 47 |
|
|
| 48 |
– |
#define WATCH_HEAP_SIZE 32 |
| 48 |
|
|
| 49 |
|
static dlink_list watchTable[HASHSIZE]; |
| 50 |
|
|
| 51 |
< |
static BlockHeap *watch_heap = NULL; |
| 51 |
> |
static mp_pool_t *watch_pool = NULL; |
| 52 |
|
|
| 53 |
|
/*! \brief Initializes the watch table |
| 54 |
|
*/ |
| 55 |
|
void |
| 56 |
|
watch_init(void) |
| 57 |
|
{ |
| 58 |
< |
watch_heap = BlockHeapCreate("watch", sizeof(struct Watch), WATCH_HEAP_SIZE); |
| 58 |
> |
watch_pool = mp_pool_new(sizeof(struct Watch), MP_CHUNK_SIZE_WATCH); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/* |
| 145 |
|
/* If found NULL (no header for this nick), make one... */ |
| 146 |
|
if ((anptr = watch_find_hash(nick)) == NULL) |
| 147 |
|
{ |
| 148 |
< |
anptr = BlockHeapAlloc(watch_heap); |
| 148 |
> |
anptr = mp_pool_get(watch_pool); |
| 149 |
> |
memset(anptr, 0, sizeof(*anptr)); |
| 150 |
|
anptr->lasttime = CurrentTime; |
| 151 |
|
strlcpy(anptr->nick, nick, sizeof(anptr->nick)); |
| 152 |
|
|
| 193 |
|
{ |
| 194 |
|
assert(dlinkFind(&watchTable[strhash(nick)], anptr) != NULL); |
| 195 |
|
dlinkDelete(&anptr->node, &watchTable[strhash(nick)]); |
| 196 |
< |
BlockHeapFree(watch_heap, anptr); |
| 196 |
> |
mp_pool_release(anptr); |
| 197 |
|
} |
| 198 |
|
} |
| 199 |
|
|
| 223 |
|
assert(dlinkFind(&watchTable[strhash(anptr->nick)], anptr) != NULL); |
| 224 |
|
dlinkDelete(&anptr->node, &watchTable[strhash(anptr->nick)]); |
| 225 |
|
|
| 226 |
< |
BlockHeapFree(watch_heap, anptr); |
| 226 |
> |
mp_pool_release(anptr); |
| 227 |
|
} |
| 228 |
|
|
| 229 |
|
dlinkDelete(ptr, &client_p->localClient->watches); |