]> jfr.im git - irc/quakenet/newserv.git/blame_incremental - channel/channelalloc.c
CHANSERV: tell user when they can't attempts to auth any more, and drop max attempts...
[irc/quakenet/newserv.git] / channel / channelalloc.c
... / ...
CommitLineData
1/* channelalloc.c */
2
3#include "channel.h"
4#include "../core/nsmalloc.h"
5
6channel *newchan() {
7 return nsmalloc(POOL_CHANNEL, sizeof(channel));
8}
9
10void freechan(channel *cp) {
11 nsfree(POOL_CHANNEL, cp);
12}
13
14chanuserhash *newchanuserhash(int hashsize) {
15 int i;
16 chanuserhash *cuhp = nsmalloc(POOL_CHANNEL, sizeof(chanuserhash));
17
18 if (!cuhp)
19 return NULL;
20
21 /* Don't use nsmalloc() here since we will free this in freechanuserhash() */
22 cuhp->content=(unsigned long *)malloc(hashsize*sizeof(unsigned long));
23 for (i=0;i<hashsize;i++) {
24 cuhp->content[i]=nouser;
25 }
26
27 cuhp->hashsize=hashsize;
28 cuhp->totalusers=0;
29
30 return cuhp;
31}
32
33void freechanuserhash(chanuserhash *cuhp) {
34 free(cuhp->content);
35 nsfree(POOL_CHANNEL, cuhp);
36}