/[svn]/ircd-hybrid/trunk/src/watch.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/watch.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1653  
changed lines
  Added in v.1654

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28