]>
jfr.im git - irc/quakenet/newserv.git/blob - proxyscan/proxyscanalloc.c
4 #include "../core/nsmalloc.h"
11 cachehost
*freecachehosts
;
12 pendingscan
*freependingscans
;
13 foundproxy
*freefoundproxies
;
19 if (freescans
==NULL
) {
20 /* Eep. Allocate more. */
21 freescans
=(scan
*)nsmalloc(POOL_PROXYSCAN
,ALLOCUNIT
*sizeof(scan
));
22 for (i
=0;i
<(ALLOCUNIT
-1);i
++) {
23 freescans
[i
].next
=&(freescans
[i
+1]);
25 freescans
[ALLOCUNIT
-1].next
=NULL
;
34 void freescan(scan
*sp
) {
39 cachehost
*getcachehost() {
43 if (freecachehosts
==NULL
) {
44 freecachehosts
=(cachehost
*)nsmalloc(POOL_PROXYSCAN
,ALLOCUNIT
*sizeof(cachehost
));
45 for (i
=0;i
<(ALLOCUNIT
-1);i
++) {
46 freecachehosts
[i
].next
=&(freecachehosts
[i
+1]);
48 freecachehosts
[ALLOCUNIT
-1].next
=NULL
;
52 freecachehosts
=chp
->next
;
57 void freecachehost(cachehost
*chp
) {
58 chp
->next
=freecachehosts
;
62 pendingscan
*getpendingscan() {
66 if (!freependingscans
) {
67 freependingscans
=(pendingscan
*)nsmalloc(POOL_PROXYSCAN
,ALLOCUNIT
* sizeof(pendingscan
));
68 for (i
=0;i
<(ALLOCUNIT
-1);i
++)
69 freependingscans
[i
].next
= freependingscans
+i
+1;
70 freependingscans
[ALLOCUNIT
-1].next
=NULL
;
74 freependingscans
=psp
->next
;
79 void freependingscan(pendingscan
*psp
) {
80 psp
->next
=freependingscans
;
84 foundproxy
*getfoundproxy() {
88 if (!freefoundproxies
) {
89 freefoundproxies
=(foundproxy
*)nsmalloc(POOL_PROXYSCAN
,ALLOCUNIT
* sizeof(foundproxy
));
90 for (i
=0;i
<(ALLOCUNIT
-1);i
++)
91 freefoundproxies
[i
].next
= freefoundproxies
+i
+1;
92 freefoundproxies
[ALLOCUNIT
-1].next
=NULL
;
96 freefoundproxies
=fpp
->next
;
101 void freefoundproxy(foundproxy
*fpp
) {
102 fpp
->next
=freefoundproxies
;
103 freefoundproxies
=fpp
;