From eddc2ab6d88c98e43d105bb9cc1b24872ac9f1ef Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Wed, 2 Apr 2008 03:07:29 +0400 Subject: [PATCH] MyMalloc -> rb_malloc --- modules/m_challenge.c | 6 +++--- modules/m_gline.c | 2 +- modules/m_list.c | 2 +- src/blacklist.c | 4 ++-- src/class.c | 2 +- src/client.c | 4 ++-- src/hash.c | 10 +++++----- src/hook.c | 4 ++-- src/hostmask.c | 4 ++-- src/irc_dictionary.c | 4 ++-- src/irc_string.c | 4 ++-- src/ircd_parser.y | 12 ++++++------ src/kdparse.c | 2 +- src/listener.c | 2 +- src/modules.c | 10 +++++----- src/newconf.c | 6 +++--- src/packet.c | 2 +- src/reject.c | 2 +- src/res.c | 8 ++++---- src/s_newconf.c | 8 ++++---- src/s_serv.c | 4 ++-- src/scache.c | 2 +- src/substitution.c | 2 +- src/supported.c | 2 +- 24 files changed, 54 insertions(+), 54 deletions(-) diff --git a/modules/m_challenge.c b/modules/m_challenge.c index c5ed7c1f..bb4ff39a 100644 --- a/modules/m_challenge.c +++ b/modules/m_challenge.c @@ -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) diff --git a/modules/m_gline.c b/modules/m_gline.c index 4f39befc..ad737a07 100644 --- a/modules/m_gline.c +++ b/modules/m_gline.c @@ -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)); diff --git a/modules/m_list.c b/modules/m_list.c index 1b93f43d..9b15f811 100644 --- a/modules/m_list.c +++ b/modules/m_list.c @@ -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; diff --git a/src/blacklist.c b/src/blacklist.c index 7645545e..c4dfe31f 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -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 diff --git a/src/class.c b/src/class.c index 106d1468..c32bd3ab 100644 --- a/src/class.c +++ b/src/class.c @@ -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; diff --git a/src/client.c b/src/client.c index e035c0cf..c2ae4821 100644 --- a/src/client.c +++ b/src/client.c @@ -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; diff --git a/src/hash.c b/src/hash.c index bf17b066..48ed950a 100644 --- a/src/hash.c +++ b/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 diff --git a/src/hook.c b/src/hook.c index 8e92bdae..ea2ecdaa 100644 --- a/src/hook.c +++ b/src/hook.c @@ -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); diff --git a/src/hostmask.c b/src/hostmask.c index cbbb0e98..d00aeb7c 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -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; diff --git a/src/irc_dictionary.c b/src/irc_dictionary.c index 06b115a3..74297821 100644 --- a/src/irc_dictionary.c +++ b/src/irc_dictionary.c @@ -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); diff --git a/src/irc_string.c b/src/irc_string.c index 90c21d10..a32c1ccb 100644 --- a/src/irc_string.c +++ b/src/irc_string.c @@ -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; diff --git a/src/ircd_parser.y b/src/ircd_parser.y index 95731cc3..0f80617f 100644 --- a/src/ircd_parser.y +++ b/src/ircd_parser.y @@ -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) { diff --git a/src/kdparse.c b/src/kdparse.c index b94bb507..ea12d594 100644 --- a/src/kdparse.c +++ b/src/kdparse.c @@ -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 diff --git a/src/listener.c b/src/listener.c index 7410f21b..304b51cf 100644 --- a/src/listener.c +++ b/src/listener.c @@ -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; diff --git a/src/modules.c b/src/modules.c index b8f42c4b..62aff19e 100644 --- a/src/modules.c +++ b/src/modules.c @@ -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); diff --git a/src/newconf.c b/src/newconf.c index 665b49b7..eddeeff6 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -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; diff --git a/src/packet.c b/src/packet.c index bc1a0f56..038ddca3 100644 --- a/src/packet.c +++ b/src/packet.c @@ -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) diff --git a/src/reject.c b/src/reject.c index aaf8fab0..86897b4d 100644 --- a/src/reject.c +++ b/src/reject.c @@ -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; diff --git a/src/res.c b/src/res.c index 63318714..356e838e 100644 --- a/src/res.c +++ b/src/res.c @@ -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)); diff --git a/src/s_newconf.c b/src/s_newconf.c index e67911bf..1c9e289c 100644 --- a/src/s_newconf.c +++ b/src/s_newconf.c @@ -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; diff --git a/src/s_serv.c b/src/s_serv.c index 72e7925e..0571237f 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -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)) { diff --git a/src/scache.c b/src/scache.c index 8617743e..49c9f3b3 100644 --- a/src/scache.c +++ b/src/scache.c @@ -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)); diff --git a/src/substitution.c b/src/substitution.c index 5cef86b0..58deefab 100644 --- a/src/substitution.c +++ b/src/substitution.c @@ -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); diff --git a/src/supported.c b/src/supported.c index d0a24d52..001a1920 100644 --- a/src/supported.c +++ b/src/supported.c @@ -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;