]> jfr.im git - irc/quakenet/newserv.git/blob - nick/nickalloc.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / nick / nickalloc.c
1 /* nick/host/realname/authname allocator */
2
3 #include "nick.h"
4 #include "../core/nsmalloc.h"
5
6 #include <assert.h>
7 #include <stdlib.h>
8
9 /* Hosts and realname structures are the same size */
10 /* This assumption is checked in initnickalloc(); */
11
12 realname *newrealname() {
13 return (realname *)newhost();
14 }
15
16 void freerealname(realname *rn) {
17 freehost((host *)rn);
18 }
19
20 nick *newnick() {
21 return nsmalloc(POOL_NICK, sizeof(nick));
22 }
23
24 void freenick(nick *np) {
25 nsfree(POOL_NICK, np);
26 }
27
28 host *newhost() {
29 return nsmalloc(POOL_NICK, sizeof(host));
30 }
31
32 void freehost(host *hp) {
33 nsfree(POOL_NICK, hp);
34 }
35