ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/watch.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/watch.c (file contents):
Revision 1653 by michael, Sat Oct 27 21:02:32 2012 UTC vs.
Revision 1654 by michael, Fri Nov 16 19:39:37 2012 UTC

# Line 27 | Line 27
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"
# Line 42 | Line 41
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   /*
# Line 146 | Line 145 | watch_add_to_hash_table(const char *nick
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  
# Line 193 | Line 193 | watch_del_from_hash_table(const char *ni
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  
# Line 223 | Line 223 | watch_del_watch_list(struct Client *clie
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)