mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
MyMalloc -> rb_malloc
This commit is contained in:
parent
300a543344
commit
eddc2ab6d8
24 changed files with 54 additions and 54 deletions
|
@ -240,7 +240,7 @@ m_challenge(struct Client *client_p, struct Client *source_p, int parc, const ch
|
|||
sendto_one(source_p, form_str(RPL_ENDOFRSACHALLENGE2),
|
||||
me.name, source_p->name);
|
||||
rb_free(challenge);
|
||||
DupString(source_p->localClient->opername, oper_p->name);
|
||||
source_p->localClient->opername = rb_strdup(oper_p->name);
|
||||
}
|
||||
else
|
||||
sendto_one_notice(source_p, ":Failed to generate challenge.");
|
||||
|
@ -286,11 +286,11 @@ generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
|
|||
{
|
||||
SHA1_Init(&ctx);
|
||||
SHA1_Update(&ctx, (u_int8_t *)secret, CHALLENGE_SECRET_LENGTH);
|
||||
*r_response = MyMalloc(SHA_DIGEST_LENGTH);
|
||||
*r_response = rb_malloc(SHA_DIGEST_LENGTH);
|
||||
SHA1_Final((u_int8_t *)*r_response, &ctx);
|
||||
|
||||
length = RSA_size(rsa);
|
||||
tmp = MyMalloc(length);
|
||||
tmp = rb_malloc(length);
|
||||
ret = RSA_public_encrypt(CHALLENGE_SECRET_LENGTH, secret, tmp, rsa, RSA_PKCS1_OAEP_PADDING);
|
||||
|
||||
if (ret >= 0)
|
||||
|
|
|
@ -660,7 +660,7 @@ majority_gline(struct Client *source_p, const char *user,
|
|||
|
||||
/* no pending gline, create a new one */
|
||||
pending = (struct gline_pending *)
|
||||
MyMalloc(sizeof(struct gline_pending));
|
||||
rb_malloc(sizeof(struct gline_pending));
|
||||
|
||||
strlcpy(pending->oper_nick1, source_p->name,
|
||||
sizeof(pending->oper_nick1));
|
||||
|
|
|
@ -249,7 +249,7 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
|
|||
s_assert(MyClient(client_p));
|
||||
s_assert(params != NULL);
|
||||
|
||||
self = MyMalloc(sizeof(struct ListClient));
|
||||
self = rb_malloc(sizeof(struct ListClient));
|
||||
|
||||
self->hash_indice = 0;
|
||||
self->users_min = params->users_min;
|
||||
|
|
|
@ -116,7 +116,7 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
|
|||
/* XXX: no IPv6 implementation, not to concerned right now though. */
|
||||
static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *client_p)
|
||||
{
|
||||
struct BlacklistClient *blcptr = MyMalloc(sizeof(struct BlacklistClient));
|
||||
struct BlacklistClient *blcptr = rb_malloc(sizeof(struct BlacklistClient));
|
||||
char buf[IRCD_BUFSIZE];
|
||||
int ip[4];
|
||||
|
||||
|
@ -149,7 +149,7 @@ struct Blacklist *new_blacklist(char *name, char *reject_reason)
|
|||
blptr = find_blacklist(name);
|
||||
if (blptr == NULL)
|
||||
{
|
||||
blptr = MyMalloc(sizeof(struct Blacklist));
|
||||
blptr = rb_malloc(sizeof(struct Blacklist));
|
||||
rb_dlinkAddAlloc(blptr, &blacklist_list);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -49,7 +49,7 @@ make_class(void)
|
|||
{
|
||||
struct Class *tmp;
|
||||
|
||||
tmp = (struct Class *) MyMalloc(sizeof(struct Class));
|
||||
tmp = (struct Class *) rb_malloc(sizeof(struct Class));
|
||||
|
||||
ConFreq(tmp) = DEFAULT_CONNECTFREQUENCY;
|
||||
PingFreq(tmp) = DEFAULT_PINGFREQUENCY;
|
||||
|
|
|
@ -1301,7 +1301,7 @@ dead_link(struct Client *client_p)
|
|||
if(IsDead(client_p) || IsClosing(client_p) || IsMe(client_p))
|
||||
return;
|
||||
|
||||
abt = (struct abort_client *) MyMalloc(sizeof(struct abort_client));
|
||||
abt = (struct abort_client *) rb_malloc(sizeof(struct abort_client));
|
||||
|
||||
if(client_p->flags & FLAGS_SENDQEX)
|
||||
strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
|
||||
|
@ -1888,7 +1888,7 @@ make_server(struct Client *client_p)
|
|||
|
||||
if(!serv)
|
||||
{
|
||||
serv = (server_t *) MyMalloc(sizeof(server_t));
|
||||
serv = (server_t *) rb_malloc(sizeof(server_t));
|
||||
client_p->serv = serv;
|
||||
}
|
||||
return client_p->serv;
|
||||
|
|
10
src/hash.c
10
src/hash.c
|
@ -89,11 +89,11 @@ rb_dlink_list *hostTable;
|
|||
void
|
||||
init_hash(void)
|
||||
{
|
||||
clientTable = MyMalloc(sizeof(rb_dlink_list) * U_MAX);
|
||||
idTable = MyMalloc(sizeof(rb_dlink_list) * U_MAX);
|
||||
channelTable = MyMalloc(sizeof(rb_dlink_list) * CH_MAX);
|
||||
hostTable = MyMalloc(sizeof(rb_dlink_list) * HOST_MAX);
|
||||
resvTable = MyMalloc(sizeof(rb_dlink_list) * R_MAX);
|
||||
clientTable = rb_malloc(sizeof(rb_dlink_list) * U_MAX);
|
||||
idTable = rb_malloc(sizeof(rb_dlink_list) * U_MAX);
|
||||
channelTable = rb_malloc(sizeof(rb_dlink_list) * CH_MAX);
|
||||
hostTable = rb_malloc(sizeof(rb_dlink_list) * HOST_MAX);
|
||||
resvTable = rb_malloc(sizeof(rb_dlink_list) * R_MAX);
|
||||
}
|
||||
|
||||
#ifndef RICER_HASHING
|
||||
|
|
|
@ -66,7 +66,7 @@ int h_introduce_client;
|
|||
void
|
||||
init_hook(void)
|
||||
{
|
||||
hooks = MyMalloc(sizeof(hook) * HOOK_INCREMENT);
|
||||
hooks = rb_malloc(sizeof(hook) * HOOK_INCREMENT);
|
||||
|
||||
#ifdef USE_IODEBUG_HOOKS
|
||||
h_iosend_id = register_hook("iosend");
|
||||
|
@ -94,7 +94,7 @@ grow_hooktable(void)
|
|||
{
|
||||
hook *newhooks;
|
||||
|
||||
newhooks = MyMalloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT));
|
||||
newhooks = rb_malloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT));
|
||||
memcpy(newhooks, hooks, sizeof(hook) * num_hooks);
|
||||
|
||||
rb_free(hooks);
|
||||
|
|
|
@ -446,7 +446,7 @@ find_exact_conf_by_address(const char *address, int type, const char *username)
|
|||
|
||||
if(address == NULL)
|
||||
address = "/NOMATCH!/";
|
||||
arec = MyMalloc(sizeof(struct AddressRec));
|
||||
arec = rb_malloc(sizeof(struct AddressRec));
|
||||
masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits);
|
||||
#ifdef IPV6
|
||||
if(masktype == HM_IPV6)
|
||||
|
@ -503,7 +503,7 @@ add_conf_by_address(const char *address, int type, const char *username, struct
|
|||
|
||||
if(address == NULL)
|
||||
address = "/NOMATCH!/";
|
||||
arec = MyMalloc(sizeof(struct AddressRec));
|
||||
arec = rb_malloc(sizeof(struct AddressRec));
|
||||
masktype = parse_netmask(address, (struct sockaddr *)&arec->Mask.ipa.addr, &bits);
|
||||
arec->Mask.ipa.bits = bits;
|
||||
arec->masktype = masktype;
|
||||
|
|
|
@ -57,7 +57,7 @@ struct Dictionary
|
|||
*/
|
||||
struct Dictionary *irc_dictionary_create(DCF compare_cb)
|
||||
{
|
||||
struct Dictionary *dtree = (struct Dictionary *) MyMalloc(sizeof(struct Dictionary));
|
||||
struct Dictionary *dtree = (struct Dictionary *) rb_malloc(sizeof(struct Dictionary));
|
||||
|
||||
dtree->compare_cb = compare_cb;
|
||||
|
||||
|
@ -87,7 +87,7 @@ struct Dictionary *irc_dictionary_create(DCF compare_cb)
|
|||
struct Dictionary *irc_dictionary_create_named(const char *name,
|
||||
DCF compare_cb)
|
||||
{
|
||||
struct Dictionary *dtree = (struct Dictionary *) MyMalloc(sizeof(struct Dictionary));
|
||||
struct Dictionary *dtree = (struct Dictionary *) rb_malloc(sizeof(struct Dictionary));
|
||||
|
||||
dtree->compare_cb = compare_cb;
|
||||
DupString(dtree->id, name);
|
||||
|
|
|
@ -218,7 +218,7 @@ ircd_base64_encode(const unsigned char *str, int length)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
result = MyMalloc(((length + 2) / 3) * 5);
|
||||
result = rb_malloc(((length + 2) / 3) * 5);
|
||||
p = result;
|
||||
|
||||
while (length > 2)
|
||||
|
@ -255,7 +255,7 @@ ircd_base64_decode(const unsigned char *str, int length, int *ret)
|
|||
int ch, i = 0, j = 0, k;
|
||||
unsigned char *result;
|
||||
|
||||
result = MyMalloc(length + 1);
|
||||
result = rb_malloc(length + 1);
|
||||
|
||||
while ((ch = *current++) != '\0' && length-- > 0) {
|
||||
if (ch == base64_pad) break;
|
||||
|
|
|
@ -124,7 +124,7 @@ static void add_cur_list_cpt(conf_parm_t *new)
|
|||
{
|
||||
if (cur_list == NULL)
|
||||
{
|
||||
cur_list = MyMalloc(sizeof(conf_parm_t));
|
||||
cur_list = rb_malloc(sizeof(conf_parm_t));
|
||||
cur_list->type |= CF_FLIST;
|
||||
cur_list->v.list = new;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static void add_cur_list(int type, char *str, int number)
|
|||
{
|
||||
conf_parm_t *new;
|
||||
|
||||
new = MyMalloc(sizeof(conf_parm_t));
|
||||
new = rb_malloc(sizeof(conf_parm_t));
|
||||
new->next = NULL;
|
||||
new->type = type;
|
||||
|
||||
|
@ -253,19 +253,19 @@ single: oneitem
|
|||
|
||||
oneitem: qstring
|
||||
{
|
||||
$$ = MyMalloc(sizeof(conf_parm_t));
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_QSTRING;
|
||||
DupString($$->v.string, $1);
|
||||
}
|
||||
| timespec
|
||||
{
|
||||
$$ = MyMalloc(sizeof(conf_parm_t));
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_TIME;
|
||||
$$->v.number = $1;
|
||||
}
|
||||
| number
|
||||
{
|
||||
$$ = MyMalloc(sizeof(conf_parm_t));
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
$$->type = CF_INT;
|
||||
$$->v.number = $1;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ oneitem: qstring
|
|||
so pass it as that, if so */
|
||||
int val = conf_get_yesno_value($1);
|
||||
|
||||
$$ = MyMalloc(sizeof(conf_parm_t));
|
||||
$$ = rb_malloc(sizeof(conf_parm_t));
|
||||
|
||||
if (val != -1)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ conf_add_fields(struct ConfItem *aconf, const char *host_field,
|
|||
{
|
||||
if(!EmptyString(date_field))
|
||||
{
|
||||
aconf->passwd = MyMalloc(strlen(pass_field) + strlen(date_field) + 4);
|
||||
aconf->passwd = rb_malloc(strlen(pass_field) + strlen(date_field) + 4);
|
||||
rb_sprintf(aconf->passwd, "%s (%s)", pass_field, date_field);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -58,7 +58,7 @@ static listener_t *ListenerPollList = NULL;
|
|||
static listener_t *
|
||||
make_listener(struct irc_sockaddr_storage *addr)
|
||||
{
|
||||
listener_t *listener = (listener_t *) MyMalloc(sizeof(listener_t));
|
||||
listener_t *listener = (listener_t *) rb_malloc(sizeof(listener_t));
|
||||
s_assert(0 != listener);
|
||||
|
||||
listener->name = me.name;
|
||||
|
|
|
@ -164,7 +164,7 @@ mod_add_path(const char *path)
|
|||
if(mod_find_path(path))
|
||||
return;
|
||||
|
||||
pathst = MyMalloc(sizeof(struct module_path));
|
||||
pathst = rb_malloc(sizeof(struct module_path));
|
||||
|
||||
strcpy(pathst->path, path);
|
||||
rb_dlinkAddAlloc(pathst, &mod_paths);
|
||||
|
@ -200,7 +200,7 @@ mod_clear_paths(void)
|
|||
char *
|
||||
irc_basename(const char *path)
|
||||
{
|
||||
char *mod_basename = MyMalloc(strlen(path) + 1);
|
||||
char *mod_basename = rb_malloc(strlen(path) + 1);
|
||||
const char *s;
|
||||
|
||||
if(!(s = strrchr(path, '/')))
|
||||
|
@ -248,7 +248,7 @@ load_all_modules(int warn)
|
|||
|
||||
modules_init();
|
||||
|
||||
modlist = (struct module **) MyMalloc(sizeof(struct module) * (MODS_INCREMENT));
|
||||
modlist = (struct module **) rb_malloc(sizeof(struct module) * (MODS_INCREMENT));
|
||||
|
||||
max_mods = MODS_INCREMENT;
|
||||
|
||||
|
@ -888,7 +888,7 @@ load_a_module(const char *path, int warn, int core)
|
|||
|
||||
increase_modlist();
|
||||
|
||||
modlist[num_mods] = MyMalloc(sizeof(struct module));
|
||||
modlist[num_mods] = rb_malloc(sizeof(struct module));
|
||||
modlist[num_mods]->address = tmpptr;
|
||||
modlist[num_mods]->version = ver;
|
||||
modlist[num_mods]->core = core;
|
||||
|
@ -925,7 +925,7 @@ increase_modlist(void)
|
|||
if((num_mods + 1) < max_mods)
|
||||
return;
|
||||
|
||||
new_modlist = (struct module **) MyMalloc(sizeof(struct module) *
|
||||
new_modlist = (struct module **) rb_malloc(sizeof(struct module) *
|
||||
(max_mods + MODS_INCREMENT));
|
||||
memcpy((void *) new_modlist, (void *) modlist, sizeof(struct module) * num_mods);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ add_top_conf(const char *name, int (*sfunc) (struct TopConf *),
|
|||
{
|
||||
struct TopConf *tc;
|
||||
|
||||
tc = MyMalloc(sizeof(struct TopConf));
|
||||
tc = rb_malloc(sizeof(struct TopConf));
|
||||
|
||||
tc->tc_name = name;
|
||||
tc->tc_sfunc = sfunc;
|
||||
|
@ -1582,7 +1582,7 @@ conf_set_service_name(void *data)
|
|||
static int
|
||||
conf_begin_alias(struct TopConf *tc)
|
||||
{
|
||||
yy_alias = MyMalloc(sizeof(struct alias_entry));
|
||||
yy_alias = rb_malloc(sizeof(struct alias_entry));
|
||||
|
||||
if (conf_cur_block_name != NULL)
|
||||
DupString(yy_alias->name, conf_cur_block_name);
|
||||
|
@ -1846,7 +1846,7 @@ add_conf_item(const char *topconf, const char *name, int type, void (*func) (voi
|
|||
if((cf = find_conf_item(tc, name)) != NULL)
|
||||
return -1;
|
||||
|
||||
cf = MyMalloc(sizeof(struct ConfEntry));
|
||||
cf = rb_malloc(sizeof(struct ConfEntry));
|
||||
|
||||
cf->cf_name = name;
|
||||
cf->cf_type = type;
|
||||
|
|
|
@ -282,7 +282,7 @@ read_ctrl_packet(int fd, void *data)
|
|||
reply->datalen |= *len;
|
||||
reply->gotdatalen++;
|
||||
if(reply->datalen > 0)
|
||||
reply->data = MyMalloc(reply->datalen);
|
||||
reply->data = rb_malloc(reply->datalen);
|
||||
}
|
||||
|
||||
if(reply->gotdatalen < 2)
|
||||
|
|
|
@ -148,7 +148,7 @@ add_reject(struct Client *client_p, const char *mask1, const char *mask2)
|
|||
bitlen = 128;
|
||||
#endif
|
||||
pnode = make_and_lookup_ip(reject_tree, (struct sockaddr *)&client_p->localClient->ip, bitlen);
|
||||
pnode->data = rdata = MyMalloc(sizeof(struct reject_data));
|
||||
pnode->data = rdata = rb_malloc(sizeof(struct reject_data));
|
||||
rb_dlinkAddTail(pnode, &rdata->rnode, &reject_list);
|
||||
rdata->time = CurrentTime;
|
||||
rdata->count = 1;
|
||||
|
|
|
@ -296,7 +296,7 @@ static void rem_request(struct reslist *request)
|
|||
*/
|
||||
static struct reslist *make_request(struct DNSQuery *query)
|
||||
{
|
||||
struct reslist *request = MyMalloc(sizeof(struct reslist));
|
||||
struct reslist *request = rb_malloc(sizeof(struct reslist));
|
||||
|
||||
request->sentat = CurrentTime;
|
||||
request->retries = 3;
|
||||
|
@ -411,7 +411,7 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli
|
|||
if (request == NULL)
|
||||
{
|
||||
request = make_request(query);
|
||||
request->name = (char *)MyMalloc(strlen(host_name) + 1);
|
||||
request->name = (char *)rb_malloc(strlen(host_name) + 1);
|
||||
strcpy(request->name, host_name);
|
||||
request->state = REQ_A;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ static void do_query_number(struct DNSQuery *query, const struct irc_sockaddr_st
|
|||
{
|
||||
request = make_request(query);
|
||||
memcpy(&request->addr, addr, sizeof(struct irc_sockaddr_storage));
|
||||
request->name = (char *)MyMalloc(HOSTLEN + 1);
|
||||
request->name = (char *)rb_malloc(HOSTLEN + 1);
|
||||
}
|
||||
|
||||
if (addr->ss_family == AF_INET)
|
||||
|
@ -848,7 +848,7 @@ static struct DNSReply *make_dnsreply(struct reslist *request)
|
|||
struct DNSReply *cp;
|
||||
s_assert(request != 0);
|
||||
|
||||
cp = (struct DNSReply *)MyMalloc(sizeof(struct DNSReply));
|
||||
cp = (struct DNSReply *)rb_malloc(sizeof(struct DNSReply));
|
||||
|
||||
cp->h_name = request->name;
|
||||
memcpy(&cp->addr, &request->addr, sizeof(cp->addr));
|
||||
|
|
|
@ -153,7 +153,7 @@ clear_s_newconf_bans(void)
|
|||
struct remote_conf *
|
||||
make_remote_conf(void)
|
||||
{
|
||||
struct remote_conf *remote_p = MyMalloc(sizeof(struct remote_conf));
|
||||
struct remote_conf *remote_p = rb_malloc(sizeof(struct remote_conf));
|
||||
return remote_p;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ cluster_generic(struct Client *source_p, const char *command,
|
|||
struct oper_conf *
|
||||
make_oper_conf(void)
|
||||
{
|
||||
struct oper_conf *oper_p = MyMalloc(sizeof(struct oper_conf));
|
||||
struct oper_conf *oper_p = rb_malloc(sizeof(struct oper_conf));
|
||||
return oper_p;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ get_oper_privs(int flags)
|
|||
struct server_conf *
|
||||
make_server_conf(void)
|
||||
{
|
||||
struct server_conf *server_p = MyMalloc(sizeof(struct server_conf));
|
||||
struct server_conf *server_p = rb_malloc(sizeof(struct server_conf));
|
||||
server_p->aftype = AF_INET;
|
||||
return server_p;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ add_tgchange(const char *host)
|
|||
if(find_tgchange(host))
|
||||
return;
|
||||
|
||||
target = MyMalloc(sizeof(tgchange));
|
||||
target = rb_malloc(sizeof(tgchange));
|
||||
pnode = make_and_lookup(tgchange_tree, host);
|
||||
|
||||
pnode->data = target;
|
||||
|
|
|
@ -214,7 +214,7 @@ collect_zipstats(void *unused)
|
|||
/* only bother if we haven't already got something queued... */
|
||||
if(!target_p->localClient->slinkq)
|
||||
{
|
||||
target_p->localClient->slinkq = MyMalloc(1); /* sigh.. */
|
||||
target_p->localClient->slinkq = rb_malloc(1); /* sigh.. */
|
||||
target_p->localClient->slinkq[0] = SLINKCMD_ZIPSTATS;
|
||||
target_p->localClient->slinkq_ofs = 0;
|
||||
target_p->localClient->slinkq_len = 1;
|
||||
|
@ -1247,7 +1247,7 @@ start_io(struct Client *server)
|
|||
int linecount = 0;
|
||||
int linelen;
|
||||
|
||||
iobuf = MyMalloc(256); /* XXX: This seems arbitrary. Perhaps make it IRCD_BUFSIZE? --nenolod */
|
||||
iobuf = rb_malloc(256); /* XXX: This seems arbitrary. Perhaps make it IRCD_BUFSIZE? --nenolod */
|
||||
|
||||
if(IsCapable(server, CAP_ZIP))
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ find_or_add(const char *name)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
ptr = (struct scache_entry *) MyMalloc(sizeof(struct scache_entry));
|
||||
ptr = (struct scache_entry *) rb_malloc(sizeof(struct scache_entry));
|
||||
s_assert(0 != ptr);
|
||||
|
||||
strlcpy(ptr->name, name, sizeof(ptr->name));
|
||||
|
|
|
@ -57,7 +57,7 @@ struct substitution_variable
|
|||
*/
|
||||
void substitution_append_var(rb_dlink_list *varlist, const char *name, const char *value)
|
||||
{
|
||||
struct substitution_variable *tmp = MyMalloc(sizeof(struct substitution_variable));
|
||||
struct substitution_variable *tmp = rb_malloc(sizeof(struct substitution_variable));
|
||||
|
||||
DupString(tmp->name, name);
|
||||
DupString(tmp->value, value);
|
||||
|
|
|
@ -103,7 +103,7 @@ add_isupport(const char *name, const char *(*func)(const void *), const void *pa
|
|||
{
|
||||
struct isupportitem *item;
|
||||
|
||||
item = MyMalloc(sizeof(struct isupportitem));
|
||||
item = rb_malloc(sizeof(struct isupportitem));
|
||||
item->name = name;
|
||||
item->func = func;
|
||||
item->param = param;
|
||||
|
|
Loading…
Reference in a new issue