#ifndef INCLUDED_monitor_h
#define INCLUDED_monitor_h
-struct BlockHeap;
+struct rb_bh;
struct monitor
{
if(unlikely(bh == NULL))
{
- rb_lib_log("balloc.c:rb_bhFree() bh == NULL");
+ rb_lib_log("balloc.c:rb_bh_free() bh == NULL");
return (1);
}
if(unlikely(ptr == NULL))
{
- rb_lib_log("balloc.rb_bhFree() ptr == NULL");
+ rb_lib_log("balloc.rb_bh_free() ptr == NULL");
return (1);
}
extern rb_dlink_list global_channel_list;
extern struct config_channel_entry ConfigChannel;
-static rb_bh *channel_heap;\r
-static rb_bh *ban_heap;\r
-static rb_bh *topic_heap;\r
-static rb_bh *member_heap;
+extern rb_bh *channel_heap;
+extern rb_bh *ban_heap;
+extern rb_bh *topic_heap;
+extern rb_bh *member_heap;
static int channel_capabs[] = { CAP_EX, CAP_IE,
CAP_SERVICE,
void
init_channels(void)
{
- channel_heap = BlockHeapCreate(sizeof(struct Channel), CHANNEL_HEAP_SIZE);
- ban_heap = BlockHeapCreate(sizeof(struct Ban), BAN_HEAP_SIZE);
- topic_heap = BlockHeapCreate(TOPICLEN + 1 + USERHOST_REPLYLEN, TOPIC_HEAP_SIZE);
- member_heap = BlockHeapCreate(sizeof(struct membership), MEMBER_HEAP_SIZE);
+ channel_heap = rb_bh_create(sizeof(struct Channel), CHANNEL_HEAP_SIZE);
+ ban_heap = rb_bh_create(sizeof(struct Ban), BAN_HEAP_SIZE);
+ topic_heap = rb_bh_create(TOPICLEN + 1 + USERHOST_REPLYLEN, TOPIC_HEAP_SIZE);
+ member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE);
h_can_join = register_hook("can_join");
}
allocate_channel(const char *chname)
{
struct Channel *chptr;
- chptr = BlockHeapAlloc(channel_heap);
+ chptr = rb_bh_alloc(channel_heap);
chptr->chname = rb_strdup(chname);
return (chptr);
}
free_channel(struct Channel *chptr)
{
rb_free(chptr->chname);
- BlockHeapFree(channel_heap, chptr);
+ rb_bh_free(channel_heap, chptr);
}
struct Ban *
allocate_ban(const char *banstr, const char *who)
{
struct Ban *bptr;
- bptr = BlockHeapAlloc(ban_heap);
+ bptr = rb_bh_alloc(ban_heap);
bptr->banstr = rb_strdup(banstr);
bptr->who = rb_strdup(who);
{
rb_free(bptr->banstr);
rb_free(bptr->who);
- BlockHeapFree(ban_heap, bptr);
+ rb_bh_free(ban_heap, bptr);
}
if(client_p->user == NULL)
return;
- msptr = BlockHeapAlloc(member_heap);
+ msptr = rb_bh_alloc(member_heap);
msptr->chptr = chptr;
msptr->client_p = client_p;
if(!(chptr->mode.mode & MODE_PERMANENT) && rb_dlink_list_length(&chptr->members) <= 0)
destroy_channel(chptr);
- BlockHeapFree(member_heap, msptr);
+ rb_bh_free(member_heap, msptr);
return;
}
if(!(chptr->mode.mode & MODE_PERMANENT) && rb_dlink_list_length(&chptr->members) <= 0)
destroy_channel(chptr);
- BlockHeapFree(member_heap, msptr);
+ rb_bh_free(member_heap, msptr);
}
client_p->user->channel.head = client_p->user->channel.tail = NULL;
if(chptr == NULL)
return;
- ptr = BlockHeapAlloc(topic_heap);
+ ptr = rb_bh_alloc(topic_heap);
/* Basically we allocate one large block for the topic and
* the topic info. We then split it up into two and shove it
* MUST change this as well
*/
ptr = chptr->topic;
- BlockHeapFree(topic_heap, ptr);
+ rb_bh_free(topic_heap, ptr);
chptr->topic = NULL;
chptr->topic_info = NULL;
}
static EVH check_pings;
-extern BlockHeap *client_heap;
-extern BlockHeap *lclient_heap;
-extern BlockHeap *pclient_heap;
+extern rb_bh *client_heap;
+extern rb_bh *lclient_heap;
+extern rb_bh *pclient_heap;
extern char current_uid[IDLEN];
* start off the check ping event .. -- adrian
* Every 30 seconds is plenty -- db
*/
- client_heap = BlockHeapCreate(sizeof(struct Client), CLIENT_HEAP_SIZE);
- lclient_heap = BlockHeapCreate(sizeof(struct LocalUser), LCLIENT_HEAP_SIZE);
- pclient_heap = BlockHeapCreate(sizeof(struct PreClient), PCLIENT_HEAP_SIZE);
+ client_heap = rb_bh_create(sizeof(struct Client), CLIENT_HEAP_SIZE);
+ lclient_heap = rb_bh_create(sizeof(struct LocalUser), LCLIENT_HEAP_SIZE);
+ pclient_heap = rb_bh_create(sizeof(struct PreClient), PCLIENT_HEAP_SIZE);
rb_event_addish("check_pings", check_pings, NULL, 30);
rb_event_addish("free_exited_clients", &free_exited_clients, NULL, 4);
rb_event_addish("exit_aborted_clients", exit_aborted_clients, NULL, 1);
struct Client *client_p = NULL;
struct LocalUser *localClient;
- client_p = BlockHeapAlloc(client_heap);
+ client_p = rb_bh_alloc(client_heap);
if(from == NULL)
{
client_p->from = client_p; /* 'from' of local client is self! */
- localClient = (struct LocalUser *) BlockHeapAlloc(lclient_heap);
+ localClient = (struct LocalUser *) rb_bh_alloc(lclient_heap);
SetMyConnect(client_p);
client_p->localClient = localClient;
client_p->localClient->F = NULL;
client_p->localClient->ctrlfd = -1;
- client_p->preClient = (struct PreClient *) BlockHeapAlloc(pclient_heap);
+ client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap);
/* as good a place as any... */
rb_dlinkAdd(client_p, &client_p->localClient->tnode, &unknown_list);
if (blptr != NULL)
unref_blacklist(blptr);
abort_blacklist_queries(client_p);
- BlockHeapFree(pclient_heap, client_p->preClient);
+ rb_bh_free(pclient_heap, client_p->preClient);
client_p->preClient = NULL;
}
rb_free(client_p->localClient->opername);
rb_free(client_p->localClient->mangledhost);
- BlockHeapFree(lclient_heap, client_p->localClient);
+ rb_bh_free(lclient_heap, client_p->localClient);
client_p->localClient = NULL;
}
s_assert(&me != client_p);
free_local_client(client_p);
free_pre_client(client_p);
- BlockHeapFree(client_heap, client_p);
+ rb_bh_free(client_heap, client_p);
}
/*
count_local_client_memory(size_t * count, size_t * local_client_memory_used)
{
size_t lusage;
- BlockHeapUsage(lclient_heap, count, NULL, &lusage);
+ rb_bh_usage(lclient_heap, count, NULL, &lusage);
*local_client_memory_used = lusage + (*count * (sizeof(MemBlock) + sizeof(struct Client)));
}
count_remote_client_memory(size_t * count, size_t * remote_client_memory_used)
{
size_t lcount, rcount;
- BlockHeapUsage(lclient_heap, &lcount, NULL, NULL);
- BlockHeapUsage(client_heap, &rcount, NULL, NULL);
+ rb_bh_usage(lclient_heap, &lcount, NULL, NULL);
+ rb_bh_usage(client_heap, &rcount, NULL, NULL);
*count = rcount - lcount;
*remote_client_memory_used = *count * (sizeof(MemBlock) + sizeof(struct Client));
}
* side effects - Creates a block heap for struct Users
*
*/
-static BlockHeap *user_heap;
+static rb_bh *user_heap;
void
initUser(void)
{
- user_heap = BlockHeapCreate(sizeof(struct User), USER_HEAP_SIZE);
+ user_heap = rb_bh_create(sizeof(struct User), USER_HEAP_SIZE);
if(!user_heap)
outofmemory();
}
user = client_p->user;
if(!user)
{
- user = (struct User *) BlockHeapAlloc(user_heap);
+ user = (struct User *) rb_bh_alloc(user_heap);
user->refcnt = 1;
client_p->user = user;
}
s_assert(!user->channel.head);
}
- BlockHeapFree(user_heap, user);
+ rb_bh_free(user_heap, user);
}
}
#include "setup.h"
#include "irc_dictionary.h"
-static BlockHeap *elem_heap = NULL;
+static rb_bh *elem_heap = NULL;
struct Dictionary
{
dtree->compare_cb = compare_cb;
if (!elem_heap)
- elem_heap = BlockHeapCreate(sizeof(struct DictionaryElement), 1024);
+ elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024);
return dtree;
}
dtree->id = rb_strdup(name);
if (!elem_heap)
- elem_heap = BlockHeapCreate(sizeof(struct DictionaryElement), 1024);
+ elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024);
return dtree;
}
dict->root->data = delem->data;
dict->count--;
- BlockHeapFree(elem_heap, delem);
+ rb_bh_free(elem_heap, delem);
}
}
}
if (destroy_cb != NULL)
(*destroy_cb)(n, privdata);
- BlockHeapFree(elem_heap, n);
+ rb_bh_free(elem_heap, n);
}
rb_free(dtree);
s_assert(data != NULL);
s_assert(irc_dictionary_find(dict, key) == NULL);
- delem = BlockHeapAlloc(elem_heap);
+ delem = rb_bh_alloc(elem_heap);
delem->key = key;
delem->data = data;
/* TBD: is this needed? --nenolod */
if (delem->key == NULL)
{
- BlockHeapFree(elem_heap, delem);
+ rb_bh_free(elem_heap, delem);
return NULL;
}
data = delem->data;
irc_dictionary_unlink_root(dtree);
- BlockHeapFree(elem_heap, delem);
+ rb_bh_free(elem_heap, delem);
return data;
}
int testing_conf = 0;
struct config_channel_entry ConfigChannel;
-BlockHeap *channel_heap;
-BlockHeap *ban_heap;
-BlockHeap *topic_heap;
-BlockHeap *member_heap;
+rb_bh *channel_heap;
+rb_bh *ban_heap;
+rb_bh *topic_heap;
+rb_bh *member_heap;
-BlockHeap *client_heap = NULL;
-BlockHeap *lclient_heap = NULL;
-BlockHeap *pclient_heap = NULL;
+rb_bh *client_heap = NULL;
+rb_bh *lclient_heap = NULL;
+rb_bh *pclient_heap = NULL;
char current_uid[IDLEN];
/* patricia */
-BlockHeap *prefix_heap;
-BlockHeap *node_heap;
-BlockHeap *patricia_heap;
+rb_bh *prefix_heap;
+rb_bh *node_heap;
+rb_bh *patricia_heap;
-BlockHeap *linebuf_heap;
+rb_bh *linebuf_heap;
-BlockHeap *dnode_heap;
+rb_bh *dnode_heap;
#ifdef NOTYET
#define sendheader(c, r) sendto_one_notice(c, HeaderMessages[(r)])
static rb_dlink_list auth_poll_list;
-static BlockHeap *auth_heap;
+static rb_bh *auth_heap;
static EVH timeout_auth_queries_event;
static PF read_auth_reply;
/* This hook takes a struct Client for its argument */
memset(&auth_poll_list, 0, sizeof(auth_poll_list));
eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1);
- auth_heap = BlockHeapCreate(sizeof(struct AuthRequest), LCLIENT_HEAP_SIZE);
+ auth_heap = rb_bh_create(sizeof(struct AuthRequest), LCLIENT_HEAP_SIZE);
}
/*
static struct AuthRequest *
make_auth_request(struct Client *client)
{
- struct AuthRequest *request = BlockHeapAlloc(auth_heap);
+ struct AuthRequest *request = rb_bh_alloc(auth_heap);
client->localClient->auth_request = request;
request->fd = -1;
request->client = client;
static void
free_auth_request(struct AuthRequest *request)
{
- BlockHeapFree(auth_heap, request);
+ rb_bh_free(auth_heap, request);
}
/*
#define INADDR_NONE ((unsigned int) 0xffffffff)
#endif
-static BlockHeap *confitem_heap = NULL;
+static rb_bh *confitem_heap = NULL;
rb_dlink_list temp_klines[LAST_TEMP_TYPE];
rb_dlink_list temp_dlines[LAST_TEMP_TYPE];
void
init_s_conf(void)
{
- confitem_heap = BlockHeapCreate(sizeof(struct ConfItem), CONFITEM_HEAP_SIZE);
+ confitem_heap = rb_bh_create(sizeof(struct ConfItem), CONFITEM_HEAP_SIZE);
eventAddIsh("expire_temp_klines", expire_temp_kd, &temp_klines[TEMP_MIN], 60);
eventAddIsh("expire_temp_dlines", expire_temp_kd, &temp_dlines[TEMP_MIN], 60);
{
struct ConfItem *aconf;
- aconf = BlockHeapAlloc(confitem_heap);
+ aconf = rb_bh_alloc(confitem_heap);
aconf->status = CONF_ILLEGAL;
return (aconf);
}
rb_free(aconf->user);
rb_free(aconf->host);
- BlockHeapFree(confitem_heap, aconf);
+ rb_bh_free(confitem_heap, aconf);
}
/*
rb_patricia_tree_t *tgchange_tree;
-static BlockHeap *nd_heap = NULL;
+static rb_bh *nd_heap = NULL;
static void expire_temp_rxlines(void *unused);
static void expire_nd_entries(void *unused);
init_s_newconf(void)
{
tgchange_tree = New_Patricia(PATRICIA_BITS);
- nd_heap = BlockHeapCreate(sizeof(struct nd_entry), ND_HEAP_SIZE);
+ nd_heap = rb_bh_create(sizeof(struct nd_entry), ND_HEAP_SIZE);
eventAddIsh("expire_nd_entries", expire_nd_entries, NULL, 30);
eventAddIsh("expire_temp_rxlines", expire_temp_rxlines, NULL, 60);
}
if(irc_dictionary_find(nd_dict, name) != NULL)
return;
- nd = BlockHeapAlloc(nd_heap);
+ nd = rb_bh_alloc(nd_heap);
strlcpy(nd->name, name, sizeof(nd->name));
nd->expire = rb_current_time() + ConfigFileEntry.nick_delay;
irc_dictionary_delete(nd_dict, nd->name);
rb_dlinkDelete(&nd->lnode, &nd_list);
- BlockHeapFree(nd_heap, nd);
+ rb_bh_free(nd_heap, nd);
}
void