Răsfoiți Sursa

Remove unneeded my_calloc/my_realloc

Bryan Drewery 10 ani în urmă
părinte
comite
ac23d1a4cd

+ 7 - 7
src/adns.cc

@@ -311,7 +311,7 @@ static int get_dns_id() {
 
 static dns_query_t *alloc_query(void *client_data, dns_callback_t callback, const char *query)
 {
-	dns_query_t *q = (dns_query_t *) my_calloc(1, sizeof(*q));
+	dns_query_t *q = (dns_query_t *) calloc(1, sizeof(*q));
 
 	q->id = get_dns_id();
 	q->query = strdup(query);
@@ -335,14 +335,14 @@ static void query_transform_ip(dns_query_t* q, const char* ip) {
 
 		socket_ipv6_to_dots(ip, temp);
 		size_t iplen = strlen(temp) + 9 + 1;
-		q->ip = (char *) my_calloc(1, iplen);
+		q->ip = (char *) calloc(1, iplen);
 //		reverse_ip(temp, q->ip);
 		strlcat(q->ip, temp, iplen);
 		strlcat(q->ip, "ip6.arpa", iplen);
 	}
 	else {
 		size_t iplen = strlen(ip) + 13 + 1;
-		q->ip = (char *) my_calloc(1, iplen);
+		q->ip = (char *) calloc(1, iplen);
 		reverse_ip(ip, q->ip);
 		strlcat(q->ip, ".in-addr.arpa", iplen);
 	}
@@ -842,7 +842,7 @@ static const char *dns_next_server()
 
 static void add_dns_server(char *ip)
 {
-	servers = (dns_server_t *) my_realloc(servers, (nservers+1) *
+	servers = (dns_server_t *) realloc(servers, (nservers+1) *
 	    sizeof(*servers));
 	servers[nservers].ip = strdup(ip);
 	nservers++;
@@ -851,7 +851,7 @@ static void add_dns_server(char *ip)
 
 static void add_host(char *host, char *ip)
 {
-	hosts = (dns_host_t *) my_realloc(hosts, (nhosts+1) * sizeof(*hosts));
+	hosts = (dns_host_t *) realloc(hosts, (nhosts+1) * sizeof(*hosts));
 	hosts[nhosts].host = strdup(host);
 	hosts[nhosts].ip = strdup(ip);
 	nhosts++;
@@ -877,13 +877,13 @@ static void cache_del(int id)
 	else
 		bzero(&cache[id], sizeof(dns_cache_t));
 
-	cache = (dns_cache_t *) my_realloc(cache, (ncache+1) *
+	cache = (dns_cache_t *) realloc(cache, (ncache+1) *
 	    sizeof(*cache));
 }
 
 static void cache_add(const char *query, bd::Array<bd::String> answer, int ttl)
 {
-	cache = (dns_cache_t *) my_realloc(cache, (ncache+1) * sizeof(*cache));
+	cache = (dns_cache_t *) realloc(cache, (ncache+1) * sizeof(*cache));
 	bzero(&cache[ncache], sizeof(cache[ncache]));
 	cache[ncache].query = strdup(query);
 	cache[ncache].answer = new bd::Array<bd::String>;

+ 4 - 4
src/base64.cc

@@ -116,7 +116,7 @@ char *int_to_base64(unsigned int val)
 char *
 b64enc(const unsigned char *data, size_t len)
 {
-  char *dest = (char *) my_calloc(1, (len << 2) / 3 + 4 + 1);
+  char *dest = (char *) calloc(1, (len << 2) / 3 + 4 + 1);
 
   b64enc_buf(data, len, dest);
   return (dest);
@@ -171,7 +171,7 @@ b64enc_buf(const unsigned char *data, size_t len, char *dest)
 char *
 b64dec(const unsigned char *data, size_t *len)
 {
-  char *dest = (char *) my_calloc(1, ((*len * 3) >> 2) + 6 + 1);
+  char *dest = (char *) calloc(1, ((*len * 3) >> 2) + 6 + 1);
 
   b64dec_buf(data, len, dest);
   return (dest);
@@ -201,7 +201,7 @@ static char *
 b64enc_bd(const unsigned char *data, size_t *len)
 {
   size_t dlen = (((*len + (NUM_ASCII_BYTES - 1)) / NUM_ASCII_BYTES) * NUM_ENCODED_BYTES);
-  char *dest = (char *) my_calloc(1, dlen + 1);
+  char *dest = (char *) calloc(1, dlen + 1);
   b64enc_buf(data, *len, dest);
   *len = dlen;
   return (dest);
@@ -238,7 +238,7 @@ b64dec_bd_buf(const unsigned char *data, size_t *len, char *dest)
 static char *
 b64dec_bd(const unsigned char *data, size_t *len)
 {
-  char *dest = (char *) my_calloc(1, ((*len * 3) >> 2) + 6 + 1);
+  char *dest = (char *) calloc(1, ((*len * 3) >> 2) + 6 + 1);
   b64dec_bd_buf(data, len, dest);
   return dest;
 }

+ 3 - 3
src/binary.cc

@@ -373,7 +373,7 @@ readcfg(const char *cfgfile, bool read_stdin)
 #define ADD_ERROR(str) \
   if (line != -1) { \
     fprintf(stderr, "\n[Line %2d]: %s\n", line, str); \
-    error_line = (line_list_t *) my_calloc(1, sizeof(line_list_t)); \
+    error_line = (line_list_t *) calloc(1, sizeof(line_list_t)); \
     error_line->line = line; \
     error_line->next = NULL; \
     list_append((struct list_type **) &(error_list), (struct list_type *) error_line); \
@@ -693,7 +693,7 @@ int check_bin_initialized(const char *fname)
 bool check_bin_compat(const char *fname)
 {
   size_t len = strlen(shell_escape(fname)) + 3 + 1;
-  char *path = (char *) my_calloc(1, len);
+  char *path = (char *) calloc(1, len);
 
   char *out = NULL;
 
@@ -822,7 +822,7 @@ void reload_bin_data() {
       oldbots = conf_bots_dup(conf.bots);
 
     /* Save the old conf.bot */
-    oldbot = (conf_bot *) my_calloc(1, sizeof(conf_bot));
+    oldbot = (conf_bot *) calloc(1, sizeof(conf_bot));
     conf_bot_dup(oldbot, conf.bot);
 
     /* free up our current conf struct */

+ 3 - 3
src/binds.cc

@@ -104,7 +104,7 @@ bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, in
 
 	/* If it doesn't exist, create it. */
 	if (!table) {
-		table = (bind_table_t *) my_calloc(1, sizeof(*table));
+		table = (bind_table_t *) calloc(1, sizeof(*table));
 		table->name = strdup(name);
 		table->next = bind_table_list_head;
 		bind_table_list_head = table;
@@ -233,7 +233,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, int cflags, const cha
 
 	if (old_entry) {
 		if (table->flags & BIND_STACKABLE) {
-			entry = (bind_entry_t *) my_calloc(1, sizeof(*entry));
+			entry = (bind_entry_t *) calloc(1, sizeof(*entry));
 			entry->prev = old_entry;
 			entry->next = old_entry->next;
 			old_entry->next = entry;
@@ -249,7 +249,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, int cflags, const cha
 		for (old_entry = table->entries; old_entry && old_entry->next; old_entry = old_entry->next) {
 			; /* empty loop */
 		}
-		entry = (bind_entry_t *) my_calloc(1, sizeof(*entry));
+		entry = (bind_entry_t *) calloc(1, sizeof(*entry));
 		if (old_entry) old_entry->next = entry;
 		else table->entries = entry;
 		entry->prev = old_entry;

+ 1 - 1
src/botmsg.cc

@@ -86,7 +86,7 @@ void botnet_send_cmdpass(int idx, char *cmd, char *pass)
     char *buf = NULL;
     size_t siz = strlen(cmd) + strlen(pass) + 5 + 1;
 
-    buf = (char *) my_calloc(1, siz);
+    buf = (char *) calloc(1, siz);
 
     size_t len = simple_snprintf(buf, siz, "cp %s %s\n", cmd, pass);
     send_tand_but(idx, buf, len);

+ 5 - 5
src/botnet.cc

@@ -68,7 +68,7 @@ static int		share_unlinks = 1;		/* Allow remote unlinks of my
 
 void init_party()
 {
-  party = (party_t *) my_calloc(1, maxparty * sizeof(party_t));
+  party = (party_t *) calloc(1, maxparty * sizeof(party_t));
 }
 
 tand_t *findbot(const char *who)
@@ -92,7 +92,7 @@ void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t
       putlog(LOG_BOTS, "*", "!!! Duplicate botnet bot entry!!");
     ptr = &((*ptr)->next);
   }
-  ptr2 = (tand_t *) my_calloc(1, sizeof(tand_t));
+  ptr2 = (tand_t *) calloc(1, sizeof(tand_t));
   strlcpy(ptr2->bot, who, HANDLEN + 1);
   ptr2->bot[HANDLEN] = 0;
   ptr2->share = flag;
@@ -179,7 +179,7 @@ int addparty(char *bot, char *nick, int chan, char flag, int sock, char *from, i
   /* New member */
   if (parties == maxparty) {
     maxparty += 50;
-    party = (party_t *) my_realloc((void *) party, maxparty * sizeof(party_t));
+    party = (party_t *) realloc((void *) party, maxparty * sizeof(party_t));
   }
   strlcpy(party[parties].nick, nick, sizeof(party[parties].nick));
   strlcpy(party[parties].bot, bot, sizeof(party[parties].bot));
@@ -1234,7 +1234,7 @@ void tandem_relay(int idx, char *nick, int i)
 
   struct chat_info *ci = dcc[idx].u.chat;
 
-  dcc[idx].u.relay = (struct relay_info *) my_calloc(1, sizeof(struct relay_info));
+  dcc[idx].u.relay = (struct relay_info *) calloc(1, sizeof(struct relay_info));
   dcc[idx].u.relay->chat = ci;
   dcc[idx].u.relay->old_status = dcc[idx].status;
   dcc[idx].u.relay->idx = i;
@@ -1317,7 +1317,7 @@ static void tandem_relay_dns_callback(int id, void *client_data, const char *hos
 
   dcc[i].addr = inet_addr(ip_from_dns.c_str());
 
-  dcc[i].u.relay->chat = (struct chat_info *) my_calloc(1, sizeof(struct chat_info));
+  dcc[i].u.relay->chat = (struct chat_info *) calloc(1, sizeof(struct chat_info));
   dcc[i].u.relay->sock = dcc[idx].sock;
   dcc[i].u.relay->port = dcc[i].port;
 #ifdef USE_IPV6

+ 7 - 7
src/chanprog.cc

@@ -410,7 +410,7 @@ void load_internal_users()
     simple_snprintf(tmp, sizeof(tmp), "%li [internal]", (long)now);
     set_user(&USERENTRY_ADDED, u, tmp);
 
-    struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+    struct bot_addr *bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
     bi->address = strdup(address.c_str());
     bi->telnet_port = bi->relay_port = port;
@@ -418,7 +418,7 @@ void load_internal_users()
     if (conf.bot->hub && (!bi->hublevel) && (!strcasecmp(handle.c_str(), conf.bot->nick))) {
       bi->hublevel = 99;
     }
-    bi->uplink = (char *) my_calloc(1, 1);
+    bi->uplink = (char *) calloc(1, 1);
     set_user(&USERENTRY_BOTADDR, u, bi);
     /* set_user(&USERENTRY_PASS, get_user_by_handle(userlist, handle.c_str()), SALT2); */
   }
@@ -498,9 +498,9 @@ static struct userrec* add_bot_userlist(char* bot) {
     userlist = adduser(userlist, bot, "none", "-", USER_OP, 1);
     u = get_user_by_handle(userlist, bot);
 
-    struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
-    bi->uplink = (char *) my_calloc(1, 1);
-    bi->address = (char *) my_calloc(1, 1);
+    struct bot_addr *bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
+    bi->uplink = (char *) calloc(1, 1);
+    bi->address = (char *) calloc(1, 1);
     bi->telnet_port = 3333;
     bi->relay_port = 3333;
     bi->hublevel = 999;
@@ -790,7 +790,7 @@ int do_chanset(char *result, struct chanset_t *chan, const char *options, int fl
     else
       bufsiz = strlen(options) + 1 + 5 + 1 + 1;
     
-    char *buf = (char*) my_calloc(1, bufsiz);
+    char *buf = (char*) calloc(1, bufsiz);
 
     strlcat(buf, "cset ", bufsiz);
     if (chan)
@@ -943,7 +943,7 @@ void set_fish_key(char *target, bd::String key)
     if (key == "rand") {
       // Set a RANDOM key
       const size_t randomKeyLength = 32;
-      char *rand_key = (char*)my_calloc(1, randomKeyLength+1);
+      char *rand_key = (char*)calloc(1, randomKeyLength+1);
       make_rand_str(rand_key, randomKeyLength);
       fishData->sharedKey = rand_key;
       free(rand_key);

+ 24 - 24
src/cmds.cc

@@ -374,7 +374,7 @@ static void cmd_motd(int idx, char *par)
     size_t size;
   
     size = strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1;
-    s = (char *) my_calloc(1, size); /* +2: ' 'x2 */
+    s = (char *) calloc(1, size); /* +2: ' 'x2 */
 
     simple_snprintf(s, size, "%s %li %s", dcc[idx].nick, (long)now, par);
     var_set_by_name(NULL, "motd", s);
@@ -465,18 +465,18 @@ static void cmd_addline(int idx, char *par)
   }
 
   struct list_type *q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
-  char *hostbuf = (char *) my_calloc(1, 1);
+  char *hostbuf = (char *) calloc(1, 1);
   size_t siz = 1;
   
   for (; q; q = q->next) {
     siz = strlen(hostbuf) + strlen(q->extra) + 2;
-    hostbuf = (char *) my_realloc(hostbuf, siz);
+    hostbuf = (char *) realloc(hostbuf, siz);
     strlcat(hostbuf, q->extra, siz);
     strlcat(hostbuf, " ", siz);
   }
   siz = strlen(hostbuf) + strlen(u->handle) + 19 + 1;
 
-  char *outbuf = (char *) my_calloc(1, siz);
+  char *outbuf = (char *) calloc(1, siz);
   simple_snprintf(outbuf, siz, "Addline: +user %s %s", u->handle, hostbuf);
   dumplots(idx, "", outbuf);
   free(hostbuf);
@@ -515,7 +515,7 @@ static void cmd_newpass(int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# newpass...", dcc[idx].nick);
 
   if (!strcmp(newpass, "rand")) {
-    pass = (char*)my_calloc(1, MAXPASSLEN + 1);
+    pass = (char*)calloc(1, MAXPASSLEN + 1);
     make_rand_str(pass, MAXPASSLEN);
   } else {
     if (!goodpass(newpass, idx, NULL)) {
@@ -589,7 +589,7 @@ static int my_cmp(const mycmds *c1, const mycmds *c2)
 
 static void cmd_nohelp(int idx, char *par)
 {
-  char *buf = (char *) my_calloc(1, 1);
+  char *buf = (char *) calloc(1, 1);
   size_t siz = 1;
   bind_entry_t *entry = NULL;
   bind_table_t *table = bind_table_lookup("dcc");
@@ -599,7 +599,7 @@ static void cmd_nohelp(int idx, char *par)
   for (entry = table->entries; entry; entry = entry->next) {
     if (findhelp(entry->mask) == NULL) {
       siz = strlen(buf) + 2 + strlen(entry->mask) + 1;
-      buf = (char *) my_realloc(buf, siz);
+      buf = (char *) realloc(buf, siz);
       strlcat(buf, entry->mask, siz);
       strlcat(buf, ", ", siz);
     }
@@ -1316,7 +1316,7 @@ static void cmd_chpass(int idx, char *par)
     char *newpass = newsplit(&par), *pass = NULL;
 
     if (!strcmp(newpass, "rand")) {
-      pass = (char*)my_calloc(1, MAXPASSLEN + 1);
+      pass = (char*)calloc(1, MAXPASSLEN + 1);
       make_rand_str(pass, MAXPASSLEN);
       randpass = 1;
     } else {
@@ -1538,7 +1538,7 @@ static void cmd_hublevel(int idx, char *par)
 
   dprintf(idx, "Changed bot's hublevel.\n");
   obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
-  bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(obi->uplink);
   bi->address = strdup(obi->address);
@@ -1577,7 +1577,7 @@ static void cmd_uplink(int idx, char *par)
   struct bot_addr *bi = NULL, *obi = NULL;
 
   obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
-  bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(uplink);
   bi->address = strdup(obi->address);
@@ -1630,7 +1630,7 @@ static void cmd_chaddr(int idx, char *par)
     relay_port = bi->relay_port;
   }
 
-  bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(obi->uplink);
   bi->hublevel = obi->hublevel;
@@ -1650,13 +1650,13 @@ static void cmd_chaddr(int idx, char *par)
       addr++;					/* lose the '[' */
       r = strchr(addr, ']');			/* pointer to the ending ']' */
 
-      bi->address = (char *) my_calloc(1, r - addr + 1);	/* alloc and copy the addr */
+      bi->address = (char *) calloc(1, r - addr + 1);	/* alloc and copy the addr */
       strlcpy(bi->address, addr, r - addr + 1);
 
       q = r + 1;				/* set q to ':' at addr */
     } else {
 #endif /* !USE_IPV6 */
-      bi->address = (char *) my_calloc(1, q - addr + 1);
+      bi->address = (char *) calloc(1, q - addr + 1);
       strlcpy(bi->address, addr, q - addr + 1);
 #ifdef USE_IPV6
     }
@@ -1720,7 +1720,7 @@ static void cmd_randstring(int idx, char *par)
   if (len < 301) {
     char *randstring = NULL;
 
-    randstring = (char *) my_calloc(1, len + 1);
+    randstring = (char *) calloc(1, len + 1);
     make_rand_str(randstring, len);
     dprintf(idx, "string: %s\n", randstring);
     free(randstring);
@@ -2555,7 +2555,7 @@ static void cmd_chattr(int idx, char *par)
       }
     } else if (arg && !strpbrk(chg, "&|")) {
       size_t tmpsiz = strlen(chg) + 2;
-      tmpchg = (char *) my_calloc(1, tmpsiz);
+      tmpchg = (char *) calloc(1, tmpsiz);
       strlcpy(tmpchg, "|", 2);
       strlcat(tmpchg, chg, tmpsiz);
       chg = tmpchg;
@@ -2888,7 +2888,7 @@ static void cmd_ps(int idx, char *par) {
   }
 
   size_t size = strlen(par) + 9 + 1;
-  char *buf = (char *) my_calloc(1, size);
+  char *buf = (char *) calloc(1, size);
 
   simple_snprintf(buf, size, "ps %s", par);
   if (!exec_str(idx, buf))
@@ -3327,9 +3327,9 @@ static void cmd_newleaf(int idx, char *par)
 
     userlist = adduser(userlist, handle, "none", "-", USER_OP, 1);
     u1 = get_user_by_handle(userlist, handle);
-    bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
-    bi->uplink = (char *) my_calloc(1, 1);
-    bi->address = (char *) my_calloc(1, 1);
+    bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
+    bi->uplink = (char *) calloc(1, 1);
+    bi->address = (char *) calloc(1, 1);
     bi->telnet_port = 3333;
     bi->relay_port = 3333;
     bi->hublevel = 999;
@@ -3411,8 +3411,8 @@ static void cmd_newhub(int idx, char *par)
 
   userlist = adduser(userlist, handle.c_str(), "none", "-", USER_OP, 1);
   u1 = get_user_by_handle(userlist, const_cast<char*>(handle.c_str()));
-  bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
-  bi->uplink = (char *) my_calloc(1, 1);
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
+  bi->uplink = (char *) calloc(1, 1);
   bi->address = strdup(address.c_str());
   bi->telnet_port = port;
   bi->relay_port = port;
@@ -3430,7 +3430,7 @@ static void cmd_nopass(int idx, char *par)
 {
   int cnt = 0;
   struct userrec *cu = NULL;
-  char *users = (char *) my_calloc(1, 1), pass[MAXPASSLEN + 1] = "";
+  char *users = (char *) calloc(1, 1), pass[MAXPASSLEN + 1] = "";
   size_t userssiz = 1;
   bool dopass = 0;
 
@@ -3449,7 +3449,7 @@ static void cmd_nopass(int idx, char *par)
           set_user(&USERENTRY_PASS, cu, pass);
         } else {
           userssiz = strlen(users) + strlen(cu->handle) + 1 + 1;
-          users = (char *) my_realloc(users, userssiz);
+          users = (char *) realloc(users, userssiz);
           strlcat(users, cu->handle, userssiz);
           strlcat(users, " ", userssiz);
         }
@@ -4537,7 +4537,7 @@ void gotremotereply (char *frombot, char *tohand, char *toidx, char *ln) {
     char *buf = NULL;
     size_t siz = strlen(frombot) + 2 + 1;
 
-    buf = (char *) my_calloc(1, siz);
+    buf = (char *) calloc(1, siz);
 
     simple_snprintf(buf, siz, "(%s)", frombot);
     char format[10] = "";

+ 2 - 23
src/compat/memutil.c

@@ -14,7 +14,7 @@ str_redup(char **str, const char *newstr)
                 return;
         }
         len = strlen(newstr) + 1;
-        *str = (char *) my_realloc(*str, len);
+        *str = (char *) realloc(*str, len);
         memcpy(*str, newstr, len);
 }
 
@@ -23,31 +23,10 @@ strldup(const char *entry, size_t maxlen)
 {
   size_t slen = strlen(entry);
   size_t len = slen < maxlen ? slen : maxlen;
-  char *target = (char *) my_calloc(1, len + 1);
+  char *target = (char *) calloc(1, len + 1);
   if (target == NULL) return NULL;
   target[len] = 0;
   return (char *) memcpy(target, entry, len);
 }
 
-
-void *my_calloc(size_t nmemb, size_t size)
-{
-  void *ptr = calloc(nmemb, size);
-
-  if (ptr == NULL)
-    exit(5);
-  
-  return ptr;
-}
-
-void *my_realloc(void *ptr, size_t size)
-{
-  void *x = realloc(ptr, size);
-
-  if (x == NULL && size > 0)
-    exit(5);
-
-  return x;
-}
-
 /* vim: set sts=2 sw=2 ts=8 et: */

+ 0 - 6
src/compat/memutil.h

@@ -8,12 +8,8 @@
 #include <sys/types.h>
 
 //#undef str_redup
-#undef calloc
-#undef realloc
 
 #define str_redup my_str_redup
-//#define calloc my_calloc
-//#define realloc my_realloc
 
 #ifdef __cplusplus
 extern "C" {
@@ -21,8 +17,6 @@ extern "C" {
 
 void str_redup(char **, const char *);
 char *strldup(const char *, size_t);
-void *my_calloc(size_t, size_t);
-void *my_realloc(void *, size_t);
 
 #ifdef __cplusplus
 }

+ 7 - 7
src/conf.cc

@@ -317,7 +317,7 @@ fatal:
 void
 init_conf()
 {
-//  conf.bots = (conf_bot *) my_calloc(1, sizeof(conf_bot));
+//  conf.bots = (conf_bot *) calloc(1, sizeof(conf_bot));
 //  conf.bots->nick = NULL;
 //  conf.bots->next = NULL;
   conf.bots = NULL;
@@ -418,7 +418,7 @@ checkpid(const char *nick, conf_bot *bot)
 void
 conf_addbot(const char *nick, const char *ip, const char *host, const char *ip6)
 {
-  conf_bot *bot = (conf_bot *) my_calloc(1, sizeof(conf_bot));
+  conf_bot *bot = (conf_bot *) calloc(1, sizeof(conf_bot));
 
   bot->next = NULL;
   bot->pid_file = NULL;
@@ -879,7 +879,7 @@ conf_bot *conf_bots_dup(conf_bot *src)
     conf_bot *bot = NULL, *newbot = NULL;
 
     for (bot = src; bot && bot->nick; bot = bot->next) {
-      newbot = (conf_bot *) my_calloc(1, sizeof(conf_bot));
+      newbot = (conf_bot *) calloc(1, sizeof(conf_bot));
       conf_bot_dup(newbot, bot);
       list_append((struct list_type **) &(ret), (struct list_type *) newbot);
     }
@@ -954,7 +954,7 @@ fill_conf_bot(bool fatal)
       sdprintf(STR("I am localhub!"));
 
     /* for future, we may just want to make this a pointer to ->bots if we do an emech style currentbot-> */
-    conf.bot = (conf_bot *) my_calloc(1, sizeof(conf_bot));
+    conf.bot = (conf_bot *) calloc(1, sizeof(conf_bot));
     conf_bot_dup(conf.bot, me);
   }
 }
@@ -1086,10 +1086,10 @@ void conf_add_userlist_bots()
         simple_snprintf(tmp, sizeof(tmp), "%li %s", (long)now, conf.bot->nick);
         set_user(&USERENTRY_ADDED, u, tmp);
 
-        bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+        bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
-        bi->address = (char *) my_calloc(1, 1);
-        bi->uplink = (char *) my_calloc(1, 1);
+        bi->address = (char *) calloc(1, 1);
+        bi->uplink = (char *) calloc(1, 1);
         bi->telnet_port = bi->relay_port = 3333;
         bi->hublevel = 999;
         set_user(&USERENTRY_BOTADDR, u, bi);

+ 2 - 2
src/crypt.cc

@@ -47,7 +47,7 @@ char *decrypt_string(const char *keydata, char *in)
     free(buf);
     return res;
   } else {
-    res = (char *) my_calloc(1, len + 1);
+    res = (char *) calloc(1, len + 1);
     strlcpy(res, in, len + 1);
     return res;
   }
@@ -79,7 +79,7 @@ char *salted_sha1(const char *in, const char* saltin)
   tmp = SHA1(buf);
 
   ret_size = SHA1_SALTED_LEN + 1;
-  ret = (char *) my_calloc(1, ret_size);
+  ret = (char *) calloc(1, ret_size);
   simple_snprintf(ret, ret_size, STR("+%s$%s"), salt, tmp);
 
   /* Wipe cleartext pass from sha1 buffers/tmp */

+ 4 - 4
src/crypto/aes_util.cc

@@ -103,7 +103,7 @@ aes_encrypt_ecb_binary(const char *keydata, unsigned char *in, size_t *inlen)
   if (len % CRYPT_BLOCKSIZE)             /* more than 1 block? */
     len += (CRYPT_BLOCKSIZE - (len % CRYPT_BLOCKSIZE));
 
-  out = (unsigned char *) my_calloc(1, len + 1);
+  out = (unsigned char *) calloc(1, len + 1);
   memcpy(out, in, *inlen);
   *inlen = len;
 
@@ -133,7 +133,7 @@ aes_decrypt_ecb_binary(const char *keydata, unsigned char *in, size_t *len)
   unsigned char *out = NULL;
 
   *len -= *len % CRYPT_BLOCKSIZE;
-  out = (unsigned char *) my_calloc(1, *len + 1);
+  out = (unsigned char *) calloc(1, *len + 1);
   memcpy(out, in, *len);
 
   if (!keydata || !*keydata) {
@@ -170,7 +170,7 @@ aes_encrypt_cbc_binary(const char *keydata, unsigned char *in, size_t *inlen, un
     padding = (CRYPT_BLOCKSIZE - (len % CRYPT_BLOCKSIZE));
   len += padding;
 
-  out = (unsigned char *) my_calloc(1, len);
+  out = (unsigned char *) calloc(1, len);
   memset(out + *inlen, padding, padding);
   memcpy(out, in, *inlen);
   *inlen = len;
@@ -196,7 +196,7 @@ aes_decrypt_cbc_binary(const char *keydata, unsigned char *in, size_t *len, unsi
   unsigned char *out = NULL;
 
   *len -= *len % CRYPT_BLOCKSIZE;
-  out = (unsigned char *) my_calloc(1, *len + 1);
+  out = (unsigned char *) calloc(1, *len + 1);
   memcpy(out, in, *len);
 
   if (!keydata || !*keydata) {

+ 4 - 4
src/crypto/bf_util.cc

@@ -153,7 +153,7 @@ bf_encrypt_ecb_binary(const char *keydata, unsigned char *in, size_t *inlen)
   if (len % CRYPT_BLOCKSIZE)             /* more than 1 block? */
     len += (CRYPT_BLOCKSIZE - (len % CRYPT_BLOCKSIZE));
 
-  out = (unsigned char *) my_calloc(1, len + 1);
+  out = (unsigned char *) calloc(1, len + 1);
   memcpy(out, in, *inlen);
   *inlen = len;
 
@@ -179,7 +179,7 @@ bf_decrypt_ecb_binary(const char *keydata, unsigned char *in, size_t *len)
   unsigned char *out = NULL;
 
   *len -= *len % CRYPT_BLOCKSIZE;
-  out = (unsigned char *) my_calloc(1, *len + 1);
+  out = (unsigned char *) calloc(1, *len + 1);
   memcpy(out, in, *len);
 
   if (!keydata || !*keydata) {
@@ -209,7 +209,7 @@ bf_encrypt_cbc_binary(const char *keydata, unsigned char *in, size_t *inlen, uns
   if (len % CRYPT_BLOCKSIZE)             /* more than 1 block? */
     len += (CRYPT_BLOCKSIZE - (len % CRYPT_BLOCKSIZE));
 
-  out = (unsigned char *) my_calloc(1, len + 1);
+  out = (unsigned char *) calloc(1, len + 1);
   *inlen = len;
 
   if (!keydata || !*keydata) {
@@ -230,7 +230,7 @@ bf_decrypt_cbc_binary(const char *keydata, unsigned char *in, size_t *len, unsig
   unsigned char *out = NULL;
 
   *len -= *len % CRYPT_BLOCKSIZE;
-  out = (unsigned char *) my_calloc(1, *len + 1);
+  out = (unsigned char *) calloc(1, *len + 1);
 
   if (!keydata || !*keydata) {
     /* No key, no decryption */

+ 1 - 1
src/crypto/dh_util.cc

@@ -125,7 +125,7 @@ bool DH1080_comp(const bd::String privateKey, const bd::String theirPublicKeyB64
   b_HisPubkey = BN_bin2bn(reinterpret_cast<const unsigned char*>(theirPublicKey.data()), theirPublicKey.length(), NULL);
 
   // Compute the Shared key
-  char *key = (char *)my_calloc(1, DH_size(dh));
+  char *key = (char *)calloc(1, DH_size(dh));
   size_t len = DH_compute_key((unsigned char *)key, b_HisPubkey, dh);
   DH_free(dh);
   BN_clear_free(b_HisPubkey);

+ 6 - 6
src/dcc.cc

@@ -920,10 +920,10 @@ append_line(int idx, char *line)
   } else {
     ++c->current_lines;
 
-    p = (struct msgq *) my_calloc(1, sizeof(struct msgq));
+    p = (struct msgq *) calloc(1, sizeof(struct msgq));
 
     p->len = l;
-    p->msg = (char *) my_calloc(1, l + 1);
+    p->msg = (char *) calloc(1, l + 1);
     p->next = NULL;
     strlcpy(p->msg, line, l + 1);
 
@@ -997,7 +997,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
       dcc[idx].encrypt = 2;
       if (dcc[idx].bot) {
         dcc[idx].type = &DCC_BOT_NEW;
-        dcc[idx].u.bot = (struct bot_info *) my_calloc(1, sizeof(struct bot_info));
+        dcc[idx].u.bot = (struct bot_info *) calloc(1, sizeof(struct bot_info));
         if (dcc[idx].status & STAT_UNIXDOMAIN)
           dcc[idx].status = STAT_UNIXDOMAIN|STAT_CALLED;
         else
@@ -1806,11 +1806,11 @@ dcc_telnet_id(int idx, char *buf, int atr)
     } else if (in_chain(dcc[idx].nick)) {
 
       dcc[idx].type = &DCC_DUPWAIT;
-      dcc[idx].u.dupwait = (struct dupwait_info *) my_calloc(1, sizeof(struct dupwait_info));
+      dcc[idx].u.dupwait = (struct dupwait_info *) calloc(1, sizeof(struct dupwait_info));
       dcc[idx].u.dupwait->atr = atr;
       return;
     }
-//    dcc[idx].u.enc = (struct enc_link_dcc *) my_calloc(1, sizeof(struct enc_link_dcc));
+//    dcc[idx].u.enc = (struct enc_link_dcc *) calloc(1, sizeof(struct enc_link_dcc));
 //    dcc[idx].u.enc->method_number = 0;
 //    link_get_method(idx);
   } else {
@@ -1879,7 +1879,7 @@ dcc_telnet_pass(int idx, int atr)
 
   if (!dcc[idx].bot) {
     //bots dont need this
-    dcc[idx].u.chat = (struct chat_info *) my_calloc(1, sizeof(struct chat_info));
+    dcc[idx].u.chat = (struct chat_info *) calloc(1, sizeof(struct chat_info));
     struct chat_info dummy;
     strlcpy(dcc[idx].u.chat->con_chan, chanset ? chanset->dname : "*", sizeof(dummy.con_chan));
   }

+ 7 - 7
src/dccutil.cc

@@ -70,9 +70,9 @@ init_dcc()
   if (max_dcc < 1)
     max_dcc = 1;
   if (dcc)
-    dcc = (struct dcc_t *) my_realloc(dcc, sizeof(struct dcc_t) * max_dcc);
+    dcc = (struct dcc_t *) realloc(dcc, sizeof(struct dcc_t) * max_dcc);
   else
-    dcc = (struct dcc_t *) my_calloc(1, sizeof(struct dcc_t) * max_dcc);
+    dcc = (struct dcc_t *) calloc(1, sizeof(struct dcc_t) * max_dcc);
 }
 
 /* Replace \n with \r\n */
@@ -375,7 +375,7 @@ dprintf_real(int idx, char* buf, size_t len, size_t bufsiz, const char* target)
       bounce_simul(idx, buf);
     } else if (unlikely(dcc[idx].irc)) {
 //      size_t size = strlen(dcc[idx].simulbot) + strlen(buf) + 20;
-//      char *ircbuf = (char *) my_calloc(1, size);
+//      char *ircbuf = (char *) calloc(1, size);
 
 //      simple_snprintf(ircbuf, size, "PRIVMSG %s :%s", dcc[idx].simulbot, buf);
 //      tputs(dcc[idx].sock, ircbuf, strlen(ircbuf));
@@ -771,7 +771,7 @@ new_dcc(struct dcc_table *type, int xtra_size)
 
   dcc[i].type = type;
   if (xtra_size)
-    dcc[i].u.other = (char *) my_calloc(1, xtra_size);
+    dcc[i].u.other = (char *) calloc(1, xtra_size);
   else
     dcc[i].u.other = NULL;
   dcc[i].simul = -1;
@@ -795,7 +795,7 @@ changeover_dcc(int i, struct dcc_table *type, int xtra_size)
   }
   dcc[i].type = type;
   if (xtra_size)
-    dcc[i].u.other = (char *) my_calloc(1, xtra_size);
+    dcc[i].u.other = (char *) calloc(1, xtra_size);
 }
 
 int
@@ -983,7 +983,7 @@ listen_all(in_port_t lport, bool off, bool should_v6)
           if (i > 0) {
 #endif /* USE_IPV6 */
             if (!pmap) {
-              pmap = (struct portmap *) my_calloc(1, sizeof(struct portmap));
+              pmap = (struct portmap *) calloc(1, sizeof(struct portmap));
               pmap->next = root;
               root = pmap;
             }
@@ -1210,7 +1210,7 @@ void set_cmd_pass(char *ln, int shareit)
       free(cp);
   } else if (ln[0]) {
     /* create */
-    cp = (struct cmd_pass *) my_calloc(1, sizeof(struct cmd_pass));
+    cp = (struct cmd_pass *) calloc(1, sizeof(struct cmd_pass));
     cp->next = cmdpass;
     cmdpass = cp;
     cp->name = strdup(cmd);

+ 2 - 2
src/egg_timer.cc

@@ -154,7 +154,7 @@ int timer_create_complex(egg_timeval_t *howlong, const char *name, Function call
 	egg_timer_t *timer = NULL;
 
 	/* Fill out a new timer. */
-	timer = (egg_timer_t *) my_calloc(1, sizeof(*timer));
+	timer = (egg_timer_t *) calloc(1, sizeof(*timer));
 	timer->id = timer_next_id++;
 	if (name) timer->name = strdup(name);
 	else timer->name = NULL;
@@ -296,7 +296,7 @@ int timer_list(int **ids)
 	for (timer = timer_repeat_head; timer; timer = timer->next) ntimers++;
 
 	/* Fill in array. */
-	*ids = (int *) my_calloc(1, sizeof(int) * (ntimers+1));
+	*ids = (int *) calloc(1, sizeof(int) * (ntimers+1));
 	ntimers = 0;
 	for (timer = timer_repeat_head; timer; timer = timer->next) {
 		(*ids)[ntimers++] = timer->id;

+ 1 - 1
src/enclink.cc

@@ -151,7 +151,7 @@ static const char *ghost_write(int snum, const char *src, size_t *len)
   char *srcbuf = NULL, *line = NULL, *eol = NULL, *eline = NULL;
 
   const size_t bufsiz = *len + 9 + 1;
-  srcbuf = (char *) my_calloc(1, bufsiz);
+  srcbuf = (char *) calloc(1, bufsiz);
   strlcpy(srcbuf, src, bufsiz);
   line = srcbuf;
   buf[0] = 0;

+ 1 - 1
src/flags.cc

@@ -359,7 +359,7 @@ set_user_flagrec(struct userrec *u, struct flag_record *fr, const char *chname)
         break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
-      cr = (struct chanuserrec *) my_calloc(1, sizeof(struct chanuserrec));
+      cr = (struct chanuserrec *) calloc(1, sizeof(struct chanuserrec));
 
       cr->next = u->chanrec;
       u->chanrec = cr;

+ 1 - 1
src/garble.cc

@@ -26,7 +26,7 @@ const char *degarble(int len, const char *g)
     garble_ptr = 0;
   if (garble_buffer[garble_ptr])
     free(garble_buffer[garble_ptr]);
-  garble_buffer[garble_ptr] = (unsigned char *) my_calloc(1, len + 1);
+  garble_buffer[garble_ptr] = (unsigned char *) calloc(1, len + 1);
   x = 0xFF;
   for (int i = 0; i < len; i++) {
     garble_buffer[garble_ptr][i] = g[i] ^ x;

+ 1 - 1
src/main.cc

@@ -167,7 +167,7 @@ have_cwd:
   if (!realpath(bin, buf))
     fatal(STR("realpath() failed on getting current working directory."), 0);
   size_t len = strlen(buf);
-  bin = (char *) my_realloc(bin, len + 1);
+  bin = (char *) realloc(bin, len + 1);
   strlcpy(bin, buf, len + 1);
 
   return bin;

+ 6 - 6
src/misc.cc

@@ -543,13 +543,13 @@ char *str_escape(const char *str, const char divc, const char mask)
   char		*buf = NULL, *b = NULL;
   const char	*s = NULL;
 
-  b = buf = (char *) my_calloc(1, buflen + 1);
+  b = buf = (char *) calloc(1, buflen + 1);
 
   for (s = str; *s; s++) {
     /* Resize buffer. */
     if ((buflen - blen) <= 3) {
       buflen <<= 1;		/* * 2 */
-      buf = (char *) my_realloc(buf, buflen + 1);
+      buf = (char *) realloc(buf, buflen + 1);
       if (!buf)
 	return NULL;
       b = buf + blen;
@@ -908,7 +908,7 @@ int updatebin(int idx, char *par, int secs)
   }
 
   size_t path_siz = strlen(binname) + strlen(par) + 2;
-  char *path = (char *) my_calloc(1, path_siz);
+  char *path = (char *) calloc(1, path_siz);
   char *newbin = NULL, buf[DIRMAX] = "";
   const char* argv[5];
   int i;
@@ -1167,7 +1167,7 @@ void showhelp(int idx, struct flag_record *flags, const char *string)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
   size_t help_siz = strlen(string) + 1000 + 1;
-  char *helpstr = (char *) my_calloc(1, help_siz);
+  char *helpstr = (char *) calloc(1, help_siz);
   char tmp[2] = "", flagstr[10] = "";
   bool ok = 1;
 
@@ -1396,11 +1396,11 @@ char *step_thru_file(FILE *fd)
     if (fgets(tempBuf, sizeof(tempBuf), fd) && !feof(fd)) {
       if (retStr == NULL) {
         ret_siz = strlen(tempBuf) + 2;
-        retStr = (char *) my_calloc(1, ret_siz);
+        retStr = (char *) calloc(1, ret_siz);
         strlcpy(retStr, tempBuf, ret_siz);
       } else {
         ret_siz = strlen(retStr) + strlen(tempBuf);
-        retStr = (char *) my_realloc(retStr, ret_siz);
+        retStr = (char *) realloc(retStr, ret_siz);
         strlcat(retStr, tempBuf, ret_siz);
       }
       if (retStr[strlen(retStr)-1] == '\n') {

+ 7 - 7
src/mod/channels.mod/chanmisc.cc

@@ -254,7 +254,7 @@ int SplitList(char *resultBuf, const char *list, int *argcPtr, const char ***arg
         }
     }
 
-    argv = (const char **) my_calloc(1, (unsigned) ((size * sizeof(char *)) + (l - list) + 1 + 15));	/* 15 cuz the tcl src is hard to follow */
+    argv = (const char **) calloc(1, (unsigned) ((size * sizeof(char *)) + (l - list) + 1 + 15));	/* 15 cuz the tcl src is hard to follow */
 
     length = strlen(list);
 
@@ -938,7 +938,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
 
 static void init_masklist(masklist *m)
 {
-  m->mask = (char *) my_calloc(1, 1);
+  m->mask = (char *) calloc(1, 1);
   m->who = NULL;
   m->next = NULL;
 }
@@ -955,16 +955,16 @@ static void init_channel(struct chanset_t *chan, bool reset)
   if (!reset)
     my_setkey(chan, NULL);
 
-  chan->channel.ban = (masklist *) my_calloc(1, sizeof(masklist));
+  chan->channel.ban = (masklist *) calloc(1, sizeof(masklist));
   init_masklist(chan->channel.ban);
 
-  chan->channel.exempt = (masklist *) my_calloc(1, sizeof(masklist));
+  chan->channel.exempt = (masklist *) calloc(1, sizeof(masklist));
   init_masklist(chan->channel.exempt);
 
-  chan->channel.invite = (masklist *) my_calloc(1, sizeof(masklist));
+  chan->channel.invite = (masklist *) calloc(1, sizeof(masklist));
   init_masklist(chan->channel.invite);
 
-  chan->channel.member = (memberlist *) my_calloc(1, sizeof(memberlist));
+  chan->channel.member = (memberlist *) calloc(1, sizeof(memberlist));
   chan->channel.member->nick[0] = 0;
   chan->channel.member->next = NULL;
   chan->channel.topic = NULL;
@@ -1098,7 +1098,7 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
     /* Already existing channel, maybe a reload of the channel file */
     chan->status &= ~CHAN_FLAGGED;	/* don't delete me! :) */
   } else {
-    chan = (struct chanset_t *) my_calloc(1, sizeof(struct chanset_t));
+    chan = (struct chanset_t *) calloc(1, sizeof(struct chanset_t));
 
     /* These are defaults, bzero already set them 0, but we set them for future reference */
     chan->limit_prot = 0;

+ 1 - 1
src/mod/channels.mod/channels.cc

@@ -231,7 +231,7 @@ static void got_cjoin(char *botnick, char *code, char *par)
     if (!match) {
       size_t size = strlen(par) + 12 + 1;
 
-      options = (char *) my_calloc(1, size);
+      options = (char *) calloc(1, size);
       simple_snprintf(options, size, "%s +inactive", par);
     } else if (match && chan && !shouldjoin(chan)) {
       if (!inactive)

+ 2 - 2
src/mod/channels.mod/userchan.cc

@@ -39,7 +39,7 @@ struct chanuserrec *get_chanrec(struct userrec *u, char *chname)
 struct chanuserrec *add_chanrec(struct userrec *u, char *chname)
 {
   if (findchan_by_dname(chname)) {
-    struct chanuserrec *ch = (struct chanuserrec *) my_calloc(1, sizeof(struct chanuserrec));
+    struct chanuserrec *ch = (struct chanuserrec *) calloc(1, sizeof(struct chanuserrec));
 
     ch->next = u->chanrec;
     u->chanrec = ch;
@@ -358,7 +358,7 @@ bool u_addmask(char type, struct chanset_t *chan, char *who, const char *from, c
   }
 
   if (p == NULL) {
-    p = (maskrec *) my_calloc(1, sizeof(maskrec));
+    p = (maskrec *) calloc(1, sizeof(maskrec));
     p->next = *u;
     *u = p;
   }

+ 2 - 2
src/mod/compress.mod/compress.cc

@@ -316,7 +316,7 @@ int compress_file(char *filename, int mode_num)
   int ret;
 
   /* Create temporary filename. */
-  temp_fn = (char *) my_calloc(1, strlen(filename) + 5);
+  temp_fn = (char *) calloc(1, strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);
@@ -342,7 +342,7 @@ int uncompress_file(char *filename)
   int ret;
 
   /* Create temporary filename. */
-  temp_fn = (char *) my_calloc(1, strlen(filename) + 5);
+  temp_fn = (char *) calloc(1, strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);

+ 3 - 3
src/mod/console.mod/console.cc

@@ -59,7 +59,7 @@ struct console_info {
 static bool
 console_unpack(struct userrec *u, struct user_entry *e)
 {
-  struct console_info *ci = (struct console_info *) my_calloc(1, sizeof(struct console_info));
+  struct console_info *ci = (struct console_info *) calloc(1, sizeof(struct console_info));
   char *par = e->u.list->extra, *arg = NULL;
 
   arg = newsplit(&par);
@@ -155,7 +155,7 @@ console_gotshare(struct userrec *u, struct user_entry *e, char *par, int idx)
     free(ci->channel);
     free(ci);
   }
-  ci = (struct console_info *) my_calloc(1, sizeof(struct console_info));
+  ci = (struct console_info *) calloc(1, sizeof(struct console_info));
   ci->channel = strdup(arg);
   arg = newsplit(&par);
   ci->conflags = logmodes(arg);
@@ -311,7 +311,7 @@ console_store(int idx, char *par, bool displaySave)
   struct console_info *i = (struct console_info *) get_user(&USERENTRY_CONSOLE, dcc[idx].user);
 
   if (!i) 
-    i = (struct console_info *) my_calloc(1, sizeof(struct console_info));
+    i = (struct console_info *) calloc(1, sizeof(struct console_info));
   
   if (i->channel)
     free(i->channel);

+ 8 - 8
src/mod/irc.mod/chan.cc

@@ -95,7 +95,7 @@ static void resolv_member_callback(int id, void *client_data, const char *host,
 
 void resolve_to_member(struct chanset_t *chan, char *nick, char *host)
 {
-  resolv_member *r = (resolv_member *) my_calloc(1, sizeof(resolv_member));
+  resolv_member *r = (resolv_member *) calloc(1, sizeof(resolv_member));
 
   r->chan = strdup(chan->dname);
   r->host = strdup(host);
@@ -167,7 +167,7 @@ void resolve_to_rbl(struct chanset_t *chan, const char *host, resolv_member *r)
   if (p)
     host = p + 1;
   if (!r) {
-    r = (resolv_member *) my_calloc(1, sizeof(resolv_member));
+    r = (resolv_member *) calloc(1, sizeof(resolv_member));
 
     r->chan = strdup(chan->dname);
     r->host = strdup(host);
@@ -197,7 +197,7 @@ void resolve_to_rbl(struct chanset_t *chan, const char *host, resolv_member *r)
   } else
     iplen += strlen(host) + 1;
 
-  char *ip = (char *) my_calloc(1, iplen);
+  char *ip = (char *) calloc(1, iplen);
   if (v6)
     socket_ipv6_to_dots(host, ip);
   else {
@@ -248,7 +248,7 @@ static memberlist *newmember(struct chanset_t *chan, char *nick)
 {
   memberlist *x = chan->channel.member, 
              *lx = NULL, 
-             *n = (memberlist *) my_calloc(1, sizeof(memberlist));
+             *n = (memberlist *) calloc(1, sizeof(memberlist));
 
   /* This sorts the list */
   while (x && x->nick[0] && (rfc_casecmp(x->nick, nick) < 0)) {
@@ -1347,8 +1347,8 @@ inline static char *
 take_massopline(char *op, char **to_op)
 {
   const size_t modes_len = 31, nicks_len = 151;
-  char *nicks = (char *) my_calloc(1, nicks_len),
-       *modes = (char *) my_calloc(1, modes_len),
+  char *nicks = (char *) calloc(1, nicks_len),
+       *modes = (char *) calloc(1, modes_len),
        *nick = NULL;
   bool useop = 0;
   static char ret[182] = "";
@@ -2572,7 +2572,7 @@ static void set_topic(struct chanset_t *chan, char *k)
     free(chan->channel.topic);
   if (k && k[0]) {
     size_t tlen = strlen(k) + 1;
-    chan->channel.topic = (char *) my_calloc(1, tlen);
+    chan->channel.topic = (char *) calloc(1, tlen);
     strlcpy(chan->channel.topic, k, tlen);
   } else
     chan->channel.topic = NULL;
@@ -2650,7 +2650,7 @@ static int gotjoin(char *from, char *chname)
     size_t l_chname = strlen(chname);
 
     if (l_chname > (CHANNEL_ID_LEN + 1)) {
-      char* ch_dname = (char *) my_calloc(1, l_chname + 1);
+      char* ch_dname = (char *) calloc(1, l_chname + 1);
       simple_snprintf(ch_dname, l_chname + 2, "!%s", chname + (CHANNEL_ID_LEN + 1));
       chan = findchan_by_dname(ch_dname);
       if (!chan) {

+ 7 - 7
src/mod/irc.mod/cmdsirc.cc

@@ -679,9 +679,9 @@ static void cmd_mmode(int idx, char *par)
   }
 
 
-  memberlist** targets = (memberlist**) my_calloc(1, chan->channel.members * sizeof(memberlist *));
-  int* overlaps = (int *) my_calloc(1, chan->channel.members * sizeof(int *));
-  memberlist** chanbots = (memberlist **) my_calloc(1, chan->channel.members * sizeof(memberlist *));
+  memberlist** targets = (memberlist**) calloc(1, chan->channel.members * sizeof(memberlist *));
+  int* overlaps = (int *) calloc(1, chan->channel.members * sizeof(int *));
+  memberlist** chanbots = (memberlist **) calloc(1, chan->channel.members * sizeof(memberlist *));
   memberlist *m = NULL;
   int chanbotcount = 0, targetcount = 0;
 
@@ -888,13 +888,13 @@ static void cmd_mmode(int idx, char *par)
   dprintf(idx, "  %d assumed modes per target nick.\n", overlap);
 
   int tpos = 0, bpos = 0, i = 0;
-  char **work_list = (char**) my_calloc((int)bots, sizeof(char**));
+  char **work_list = (char**) calloc((int)bots, sizeof(char**));
   char *work = NULL;
   size_t work_size = 2048;
 
   /* now use bots/modes to distribute nicks to MODE on */
   while (bots) {
-    work = work_list[bpos] = (char*) my_calloc(1, work_size);
+    work = work_list[bpos] = (char*) calloc(1, work_size);
 
     if (local) {
       strlcpy(work, mode, work_size);
@@ -1290,8 +1290,8 @@ static void cmd_find(int idx, char *par)
         if ((!lookup_user && wild_match(par, m->from)) || (lookup_user && m->user == u)) {
           fcount++;
           if (!found) {
-            found = (memberlist **) my_calloc(1, sizeof(memberlist *) * 100);
-            cfound = (struct chanset_t **) my_calloc(1, sizeof(struct chanset_t *) * 100);
+            found = (memberlist **) calloc(1, sizeof(memberlist *) * 100);
+            cfound = (struct chanset_t **) calloc(1, sizeof(struct chanset_t *) * 100);
           }
           found[fcount - 1] = m;
           cfound[fcount - 1] = chan;

+ 7 - 7
src/mod/irc.mod/irc.cc

@@ -301,7 +301,7 @@ void notice_invite(struct chanset_t *chan, char *handle, char *nick, char *uhost
 #ifdef CACHE
 static cache_t *cache_new(char *nick)
 {
-  cache_t *cache = (cache_t *) my_calloc(1, sizeof(cache_t));
+  cache_t *cache = (cache_t *) calloc(1, sizeof(cache_t));
 
   cache->next = NULL;
   strlcpy(cache->nick, nick, sizeof(cache->nick));
@@ -317,7 +317,7 @@ static cache_t *cache_new(char *nick)
 
 static cache_chan_t *cache_chan_add(cache_t *cache, char *chname)
 {
-  cache_chan_t *cchan = (cache_chan_t *) my_calloc(1, sizeof(cache_chan_t));
+  cache_chan_t *cchan = (cache_chan_t *) calloc(1, sizeof(cache_chan_t));
   
   cchan->next = NULL;
   strlcpy(cchan->dname, chname, sizeof(cchan->dname));
@@ -824,7 +824,7 @@ getin_request(char *botnick, char *code, char *par)
     if (chan->channel.mode & CHANKEY) {
       char *key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
       size_t siz = strlen(chan->dname) + strlen(key ? key : 0) + 6 + 1;
-      tmp = (char *) my_calloc(1, siz);
+      tmp = (char *) calloc(1, siz);
       simple_snprintf(tmp, siz, "gi K %s %s", chan->dname, key ? key : "");
       putbot(botnick, tmp);
       putlog(LOG_GETIN, "*", "inreq from %s/%s for %s - Sent key (%s)", botnick, nick, chan->dname, key ? key : "");
@@ -1125,7 +1125,7 @@ void
 my_setkey(struct chanset_t *chan, char *k)
 {
   free(chan->channel.key);
-  chan->channel.key = k ? strdup(k) : (char *) my_calloc(1, 1);
+  chan->channel.key = k ? strdup(k) : (char *) calloc(1, 1);
 }
 
 /* Adds a ban, exempt or invite mask to the list
@@ -1138,9 +1138,9 @@ new_mask(masklist *m, char *s, char *who)
   if (m->mask[0])
     return 1;                     /* Already existent mask */
 
-  m->next = (masklist *) my_calloc(1, sizeof(masklist));
+  m->next = (masklist *) calloc(1, sizeof(masklist));
   m->next->next = NULL;
-  m->next->mask = (char *) my_calloc(1, 1);
+  m->next->mask = (char *) calloc(1, 1);
   free(m->mask);
   m->mask = strdup(s);
   m->who = strdup(who);
@@ -1193,7 +1193,7 @@ killmember(struct chanset_t *chan, char *nick, bool cacheMember)
     putlog(LOG_MISC, "*", "(!) actually I know of %d members.", chan->channel.members);
   }
   if (unlikely(!chan->channel.member)) {
-    chan->channel.member = (memberlist *) my_calloc(1, sizeof(memberlist));
+    chan->channel.member = (memberlist *) calloc(1, sizeof(memberlist));
     chan->channel.member->nick[0] = 0;
     chan->channel.member->next = NULL;
   }

+ 9 - 9
src/mod/irc.mod/mode.cc

@@ -441,7 +441,7 @@ real_add_mode(struct chanset_t *chan, const char plus, const char mode, const ch
         flush_mode(chan, NORMAL);
       for (i = 0; i < (modesperline - 1); i++)
         if (!chan->ccmode[i].op) {
-          chan->ccmode[i].op = (char *) my_calloc(1, len);
+          chan->ccmode[i].op = (char *) calloc(1, len);
           chan->cbytes += len;    /* Add 1 for safety */
           strlcpy(chan->ccmode[i].op, op, len);
           break;
@@ -456,7 +456,7 @@ real_add_mode(struct chanset_t *chan, const char plus, const char mode, const ch
       for (i = 0; i < modesperline; i++)
         if (chan->cmode[i].type == 0) {
           chan->cmode[i].type = type;
-          chan->cmode[i].op = (char *) my_calloc(1, len);
+          chan->cmode[i].op = (char *) calloc(1, len);
           chan->bytes += len;     /* Add 1 for safety */
           strlcpy(chan->cmode[i].op, op, len);
           break;
@@ -469,7 +469,7 @@ real_add_mode(struct chanset_t *chan, const char plus, const char mode, const ch
     if (chan->key)
       free(chan->key);
     len = strlen(op) + 1;
-    chan->key = (char *) my_calloc(1, len);
+    chan->key = (char *) calloc(1, len);
     strlcpy(chan->key, op, len);
   }
   /* -k ? store removed key */
@@ -477,7 +477,7 @@ real_add_mode(struct chanset_t *chan, const char plus, const char mode, const ch
     if (chan->rmkey)
       free(chan->rmkey);
     len = strlen(op) + 1;
-    chan->rmkey = (char *) my_calloc(1, len);
+    chan->rmkey = (char *) calloc(1, len);
     strlcpy(chan->rmkey, op, len);
   }
   /* +l ? store limit */
@@ -634,7 +634,7 @@ got_op(struct chanset_t *chan, memberlist *m, memberlist *mv)
     char *buf = NULL;
     size_t siz = strlen(chan->dname) + 3 + 1;
 
-    buf = my_calloc(1, siz);
+    buf = calloc(1, siz);
     simple_snprintf(buf, siz, "jn %s", chan->dname);
     putallbots(buf);
     free(buf);
@@ -1071,7 +1071,7 @@ gotmode(char *from, char *msg)
 
       int i = 0, modecnt = 0, ops = 0, deops = 0, bans = 0, unbans = 0;
       bool me_opped = 0;
-      char **modes = (char **) my_calloc(1, sizeof(char *));
+      char **modes = (char **) calloc(1, sizeof(char *));
       char s[UHOSTLEN] = "";
       memberlist *mv = NULL;
 
@@ -1098,11 +1098,11 @@ gotmode(char *from, char *msg)
             }
 
             /* Just want o's and b's */
-            modes = (char **) my_realloc(modes, (modecnt * sizeof(char *)) + sizeof(char *));
-            //      char **modes = (char **) my_calloc(modesperline + 1, sizeof(char *));
+            modes = (char **) realloc(modes, (modecnt * sizeof(char *)) + sizeof(char *));
+            //      char **modes = (char **) calloc(modesperline + 1, sizeof(char *));
 
             size_t siz = (mp ? strlen(mp) : 0) + 3 + 1;
-            modes[modecnt] = (char *) my_calloc(1, siz);
+            modes[modecnt] = (char *) calloc(1, siz);
             simple_snprintf(modes[modecnt], siz, "%c%c %s", sign, chg[0], mp ? mp : "");
 
             ++modecnt;

+ 5 - 5
src/mod/server.mod/server.cc

@@ -696,7 +696,7 @@ void queue_server(int which, char *buf, int len)
       }
     }
 
-    struct msgq *q = (struct msgq *) my_calloc(1, sizeof(struct msgq));
+    struct msgq *q = (struct msgq *) calloc(1, sizeof(struct msgq));
 
     if (h->head) {
       if (!qnext) { //Not next, add to end of queue
@@ -709,7 +709,7 @@ void queue_server(int which, char *buf, int len)
     } else
       h->head = h->last = q;
     q->len = len;
-    q->msg = (char *) my_calloc(1, len + 1);
+    q->msg = (char *) calloc(1, len + 1);
     strlcpy(q->msg, buf, len + 1);
     ++(h->tot);
     h->warned = 0;
@@ -740,7 +740,7 @@ void add_server(char *ss)
     p = strchr(ss, ',');
     if (p)
       *p++ = 0;
-    x = (struct server_list *) my_calloc(1, sizeof(struct server_list));
+    x = (struct server_list *) calloc(1, sizeof(struct server_list));
 
     x->next = 0;
     x->port = 0;
@@ -762,7 +762,7 @@ void add_server(char *ss)
       }
 #endif /* USE_IPV6 */
       *q++ = 0;
-      x->name = (char *) my_calloc(1, q - ss);
+      x->name = (char *) calloc(1, q - ss);
       strlcpy(x->name, ss, q - ss);
       ss = q;
       q = strchr(ss, ':');
@@ -822,7 +822,7 @@ void next_server(int *ptr, char *servname, in_port_t *port, char *pass)
       i++;
     }
     /* Gotta add it: */
-    x = (struct server_list *) my_calloc(1, sizeof(struct server_list));
+    x = (struct server_list *) calloc(1, sizeof(struct server_list));
 
     x->next = 0;
     x->name = strdup(servname);

+ 1 - 1
src/mod/server.mod/servmsg.cc

@@ -1680,7 +1680,7 @@ hide_chans(const char *nick, struct userrec *u, char *_channels, bool publicOnly
   struct chanset_t *chan = NULL;
   struct flag_record fr = { FR_CHAN | FR_GLOBAL, 0, 0, 0 };
 
-  char *chans = (char *) my_calloc(1, len), *p = NULL;
+  char *chans = (char *) calloc(1, len), *p = NULL;
 
   while ((chname = newsplit(&channels))[0]) {
     /* skip any modes in front of #chan */

+ 8 - 8
src/mod/share.mod/share.cc

@@ -111,7 +111,7 @@ static void new_tbuf(char *bot)
 {
   tandbuf **old = &tbuf, *newbuf = NULL;
 
-  newbuf = (tandbuf *) my_calloc(1, sizeof(tandbuf));
+  newbuf = (tandbuf *) calloc(1, sizeof(tandbuf));
   strlcpy(newbuf->bot, bot, sizeof(newbuf->bot));
   newbuf->q = NULL;
   newbuf->timer = now;
@@ -165,11 +165,11 @@ static struct share_msgq *q_addmsg(struct share_msgq *qq, char *s)
   size_t siz = 0;
 
   if (!qq) {
-    q = (share_msgq *) my_calloc(1, sizeof *q);
+    q = (share_msgq *) calloc(1, sizeof *q);
 
     q->next = NULL;
     siz = strlen(s) + 1;
-    q->msg = (char *) my_calloc(1, siz);
+    q->msg = (char *) calloc(1, siz);
     strlcpy(q->msg, s, siz);
     return q;
   }
@@ -178,12 +178,12 @@ static struct share_msgq *q_addmsg(struct share_msgq *qq, char *s)
     cnt++;
   if (cnt > 1000)
     return NULL;                /* Return null: did not alter queue */
-  q->next = (share_msgq *) my_calloc(1, sizeof *q->next);
+  q->next = (share_msgq *) calloc(1, sizeof *q->next);
 
   q = q->next;
   q->next = NULL;
   siz = strlen(s) + 1;
-  q->msg = (char *) my_calloc(1, siz);
+  q->msg = (char *) calloc(1, siz);
   strlcpy(q->msg, s, siz);
   return qq;
 }
@@ -253,13 +253,13 @@ void dump_resync(int idx)
 static void
 add_delay(struct chanset_t *chan, int plsmns, int mode, char *mask)
 {
-  struct delay_mode *d = (struct delay_mode *) my_calloc(1, sizeof(struct delay_mode));
+  struct delay_mode *d = (struct delay_mode *) calloc(1, sizeof(struct delay_mode));
 
   d->chan = chan;
   d->plsmns = plsmns;
   d->mode = mode;
   size_t mlen = strlen(mask) + 1;
-  d->mask = (char *) my_calloc(1, mlen);
+  d->mask = (char *) calloc(1, mlen);
 
   strlcpy(d->mask, mask, mlen);
   d->seconds = (int) (now + randint(20));
@@ -657,7 +657,7 @@ share_change(int idx, char *par)
 
       if (uet->got_share) {
         if (!(e = find_user_entry(uet, u))) {
-          e = (struct user_entry *) my_calloc(1, sizeof(struct user_entry));
+          e = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
           e->type = uet;
           e->name = NULL;

+ 3 - 3
src/mod/transfer.mod/transfer.cc

@@ -92,7 +92,7 @@ static unsigned long pump_file_to_sock(FILE *file, long sock,
 {
   const unsigned long		 buf_len = pending_data >= PMAX_SIZE ?
 	  					PMAX_SIZE : pending_data;
-  char				*bf = (char *) my_calloc(1, buf_len);
+  char				*bf = (char *) calloc(1, buf_len);
   unsigned long	 actual_size;
 
   if (bf) {
@@ -467,7 +467,7 @@ void dcc_send(int idx, char *buf, int len)
     putlog(LOG_FILES, "*", "Problem writing file");
     fclose(dcc[idx].u.xfer->f);
     siz = strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1;
-    b = (char *) my_calloc(1, siz);
+    b = (char *) calloc(1, siz);
     strlcpy(b, tempdir, siz);
     strlcat(b, dcc[idx].u.xfer->filename, siz);
     unlink(b);
@@ -497,7 +497,7 @@ void dcc_send(int idx, char *buf, int len)
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host);
     fclose(dcc[idx].u.xfer->f);
     siz = strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1;
-    b = (char *) my_calloc(1, siz);
+    b = (char *) calloc(1, siz);
     strlcpy(b, tempdir, siz);
     strlcat(b, dcc[idx].u.xfer->filename, siz);
     unlink(b);

+ 2 - 2
src/net.cc

@@ -145,9 +145,9 @@ void init_net()
   MAXSOCKS = max_dcc + 10;
 
   if (socklist)
-    socklist = (sock_list *) my_realloc((void *) socklist, sizeof(sock_list) * MAXSOCKS);
+    socklist = (sock_list *) realloc((void *) socklist, sizeof(sock_list) * MAXSOCKS);
   else
-    socklist = (sock_list *) my_calloc(1, sizeof(sock_list) * MAXSOCKS);
+    socklist = (sock_list *) calloc(1, sizeof(sock_list) * MAXSOCKS);
 
   for (int i = 0; i < MAXSOCKS; i++) {
     bzero(&socklist[i], sizeof(socklist[i]));

+ 9 - 9
src/set.cc

@@ -175,7 +175,7 @@ char *var_sanitize(variable_t *var, const char *data)
     else if (var->b && (number > var->b))
       number = var->b;
 
-    dataout = (char*) my_calloc(1, 11);
+    dataout = (char*) calloc(1, 11);
     simple_snprintf(dataout, 11, "%d", number);
   } else if (var->flags & VAR_DETECTED) {
     if (data) {
@@ -205,7 +205,7 @@ char *var_sanitize(variable_t *var, const char *data)
       else if (num < 0 || !strcasecmp(data, "false") || !strcasecmp(data, "off"))
         num = 0;
     }
-    dataout = (char*) my_calloc(1, 2);
+    dataout = (char*) calloc(1, 2);
     simple_snprintf(dataout, 2, "%u", num ? 1 : 0);
   } else if (var->flags & VAR_STRING) {
     dataout = data ? strdup(data) : NULL;
@@ -236,7 +236,7 @@ char *var_sanitize(variable_t *var, const char *data)
     }
 
     /* No limit enforcing yet */
-    dataout = (char*) my_calloc(1, 21);
+    dataout = (char*) calloc(1, 21);
     simple_snprintf(dataout, 21, "%d:%d", rate.count, rate.time);
   } else if ((var->flags & VAR_SERVERS)) {
     dataout = data ? strdup(data) : NULL;
@@ -455,7 +455,7 @@ const char *var_string(variable_t *var)
       data = strdup(det_translate_num(*(int *) (var->mem)));
     } else {
       if (*(int *) (var->mem)) {
-        data = (char *) my_calloc(1, 11);
+        data = (char *) calloc(1, 11);
         simple_snprintf(data, 11, "%d", *(int *) (var->mem));
       }
     }
@@ -463,7 +463,7 @@ const char *var_string(variable_t *var)
     /* only bother setting if we have a value that's not 0 */
     if (*(int *) (var->mem)) {
       bool num = *(bool *) (var->mem);
-      data = (char *) my_calloc(1, 2);
+      data = (char *) calloc(1, 2);
       /* Only actually set 0 or 1 */
       simple_snprintf(data, 2, "%d", num ? 1 : 0);
     }
@@ -474,7 +474,7 @@ const char *var_string(variable_t *var)
   } else if (var->flags & VAR_RATE) {
     /* only bother setting if we don't have 0:0 */
     if ((*(rate_t *) (var->mem)).count && (*(rate_t *) (var->mem)).time) {
-      data = (char *) my_calloc(1, 21);
+      data = (char *) calloc(1, 21);
       simple_snprintf(data, 21, "%d:%d", (*(rate_t *) (var->mem)).count, (*(rate_t *) (var->mem)).time);
     }
   } else if (var->flags & VAR_SERVERS) {
@@ -643,7 +643,7 @@ void var_set_userentry(const char *target, const char *name, const char *data)
     u = get_user_by_handle(userlist, (char *) target);
 
   if (u) {
-    struct xtra_key *xk = (struct xtra_key *) my_calloc(1, sizeof(struct xtra_key));
+    struct xtra_key *xk = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
 
     xk->key = strdup(name);
     xk->data = data ? strdup(data) : NULL;
@@ -833,7 +833,7 @@ static int var_add_list(const char *botnick, variable_t *var, const char *elemen
   if (olddata && osiz) {
     size_t esiz = strlen(element) + 1;		// element + ,
 
-    data = (char *) my_calloc(1, osiz + esiz + 1);
+    data = (char *) calloc(1, osiz + esiz + 1);
     simple_snprintf(data, osiz + esiz + 1, "%s,%s", olddata, element);
   } else /* otherwise, just set the data to the element to be added */
     data = strdup(element);
@@ -877,7 +877,7 @@ static char *var_rem_list(const char *botnick, variable_t *var, const char *elem
   olddata = olddatap = strdup(olddatacp);
   size_t tsiz = strlen(olddata) + 1;
 
-  char *data = (char *) my_calloc(1, tsiz);
+  char *data = (char *) calloc(1, tsiz);
   char *word = NULL;
   while ((word = strsep(&olddata, delim))) {
     ++i;

+ 4 - 4
src/shell.cc

@@ -114,7 +114,7 @@ void clear_tmp()
         strcmp(dir_ent->d_name, "..")) {
 
       flen = strlen(dir_ent->d_name) + strlen(tempdir) + 1;
-      file = (char *) my_calloc(1, flen);
+      file = (char *) calloc(1, flen);
 
       strlcat(file, tempdir, flen);
       strlcat(file, dir_ent->d_name, flen);
@@ -211,7 +211,7 @@ void check_last() {
               char *work = NULL;
               size_t siz = strlen(out) + 7 + 2 + 1;
 
-              work = (char *) my_calloc(1, siz);
+              work = (char *) calloc(1, siz);
 
               simple_snprintf(work, siz, STR("Login: %s"), out);
               detected(DETECT_LOGIN, work);
@@ -492,7 +492,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput, bool
       if (fs == 0) {
         (*erroutput) = NULL;
       } else {
-        buf = (char *) my_calloc(1, fs + 1);
+        buf = (char *) calloc(1, fs + 1);
         fseek(err->f, 0, SEEK_SET);
         if (!fread(buf, 1, fs, err->f))
           fs = 0;
@@ -509,7 +509,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput, bool
       if (fs == 0) {
         (*output) = NULL;
       } else {
-        buf = (char *) my_calloc(1, fs + 1);
+        buf = (char *) calloc(1, fs + 1);
         fseek(out->f, 0, SEEK_SET);
         if (!fread(buf, 1, fs, out->f))
           fs = 0;

+ 1 - 1
src/socket.cc

@@ -79,7 +79,7 @@ static int egg_connect_timeout(void *client_data)
 
 static connect_info_t *attach(int idx, const char *host, int port, interval_t timeout)
 {
-        connect_info_t *connect_info = (connect_info_t *) my_calloc(1, sizeof(*connect_info));
+        connect_info_t *connect_info = (connect_info_t *) calloc(1, sizeof(*connect_info));
 
         connect_info->port = port;
         connect_info->idx = idx;

+ 9 - 9
src/userent.cc

@@ -128,7 +128,7 @@ bool def_set_real(struct userrec *u, struct user_entry *e, void *buf, bool prote
       l = 160;
 
 
-    e->u.string = (char *) my_realloc (e->u.string, l + 1);
+    e->u.string = (char *) realloc (e->u.string, l + 1);
 
     strlcpy (e->u.string, string, l + 1);
 
@@ -300,7 +300,7 @@ static bool set_unpack(struct userrec *u, struct user_entry *e)
   char *key = NULL, *data = NULL;
 
   while (curr) {
-    t = (struct xtra_key *) my_calloc(1, sizeof(struct xtra_key));
+    t = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
     data = curr->extra;
     key = newsplit(&data);
     if (data[0]) {
@@ -348,7 +348,7 @@ static bool set_gotshare(struct userrec *u, struct user_entry *e, char *buf, int
   /* not else if as the hub might have gotten a botset for itself */
   if (conf.bot->hub || conf.bot->localhub) {
   /* only hubs need to bother saving this stuff, leaf bots just store it in vars[] */
-    struct xtra_key *xk = (struct xtra_key *) my_calloc(1, sizeof(struct xtra_key));
+    struct xtra_key *xk = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
 
     xk->key = strdup(name);
     xk->data = (buf && buf[0]) ? strdup(buf) : NULL;
@@ -679,7 +679,7 @@ struct user_entry_type USERENTRY_SECPASS =
 static bool laston_unpack(struct userrec *u, struct user_entry *e)
 {
   char *par = e->u.list->extra, *arg = newsplit(&par);
-  struct laston_info *li = (struct laston_info *) my_calloc(1, sizeof(struct laston_info));
+  struct laston_info *li = (struct laston_info *) calloc(1, sizeof(struct laston_info));
 
   if (!par[0])
     par = "???";
@@ -760,7 +760,7 @@ struct user_entry_type USERENTRY_LASTON =
 static bool botaddr_unpack(struct userrec *u, struct user_entry *e)
 {
   char p[1024] = "", *q1 = NULL, *q2 = NULL;
-  struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+  struct bot_addr *bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   /* address:port/port:hublevel:uplink */
 
@@ -793,7 +793,7 @@ static bool botaddr_unpack(struct userrec *u, struct user_entry *e)
   if (!bi->relay_port)
     bi->relay_port = bi->telnet_port;
   if (!bi->uplink) {
-    bi->uplink = (char *) my_calloc(1, 1);
+    bi->uplink = (char *) calloc(1, 1);
   }
   list_type_kill(e->u.list);
   e->u.extra = bi;
@@ -865,7 +865,7 @@ static void botaddr_display(int idx, struct user_entry *e, struct userrec *u)
 
 static bool botaddr_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
 {
-  struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
+  struct bot_addr *bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
   char *arg = newsplit(&buf);
 
   bi->address = strdup(arg);
@@ -981,7 +981,7 @@ static bool hosts_set(struct userrec *u, struct user_entry *e, void *buf)
       } else
 	t = &((*t)->next);
     }
-    *t = (struct list_type *) my_calloc(1, sizeof(struct list_type));
+    *t = (struct list_type *) calloc(1, sizeof(struct list_type));
 
     (*t)->next = NULL;
     (*t)->extra = strdup(host);
@@ -1098,7 +1098,7 @@ bool set_user(struct user_entry_type *et, struct userrec *u, void *d)
   bool r;
 
   if (!(e = find_user_entry(et, u))) {
-    e = (struct user_entry *) my_calloc(1, sizeof(struct user_entry));
+    e = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
     e->type = et;
     e->name = NULL;

+ 2 - 2
src/userrec.cc

@@ -609,7 +609,7 @@ struct userrec *adduser(struct userrec *bu, const char *handle, char *host, char
   int oldshare = noshare;
 
   noshare = 1;
-  u = (struct userrec *) my_calloc(1, sizeof(struct userrec));
+  u = (struct userrec *) calloc(1, sizeof(struct userrec));
 
   u->bot = bot;
 
@@ -814,7 +814,7 @@ void touch_laston(struct userrec *u, char *where, time_t timeval)
     struct laston_info *li = (struct laston_info *) get_user(&USERENTRY_LASTON, u);
 
     if (!li)
-      li = (struct laston_info *) my_calloc(1, sizeof(struct laston_info));
+      li = (struct laston_info *) calloc(1, sizeof(struct laston_info));
 
     else if (li->lastonplace)
       free(li->lastonplace);

+ 10 - 10
src/users.cc

@@ -138,7 +138,7 @@ void addignore(char *ign, char *from, const char *mnote, time_t expire_time)
     }
 
   if (p == NULL) {
-    p = (struct igrec *) my_calloc(1, sizeof(struct igrec));
+    p = (struct igrec *) calloc(1, sizeof(struct igrec));
     p->next = global_ign;
     global_ign = p;
   } else {
@@ -243,7 +243,7 @@ static void addmask_fully(struct chanset_t *chan, maskrec **m, maskrec **global,
 			 char *note, time_t expire_time, int flags,
 			 time_t added, time_t last)
 {
-  maskrec *p = (maskrec *) my_calloc(1, sizeof(maskrec));
+  maskrec *p = (maskrec *) calloc(1, sizeof(maskrec));
   maskrec **u = (chan) ? m : global;
 
   p->next = *u;
@@ -353,7 +353,7 @@ static void restore_ignore(char *host)
 	added = "0";
 	desc = NULL;
       }
-      p = (struct igrec *) my_calloc(1, sizeof(struct igrec));
+      p = (struct igrec *) calloc(1, sizeof(struct igrec));
 
       p->next = global_ign;
       global_ign = p;
@@ -703,7 +703,7 @@ int stream_readuserfile(bd::Stream& stream, struct userrec **ret)
 		if (!rfc_casecmp(cr->channel, chname))
 		  break;
 	      if (!cr) {
-		cr = (struct chanuserrec *) my_calloc(1, sizeof(struct chanuserrec));
+		cr = (struct chanuserrec *) calloc(1, sizeof(struct chanuserrec));
 
 		cr->next = u->chanrec;
 		u->chanrec = cr;
@@ -807,7 +807,7 @@ int stream_readuserfile(bd::Stream& stream, struct userrec **ret)
 	      if (ue->name && !strcasecmp(code + 2, ue->name)) {
 		struct list_type *list = NULL;
 
-		list = (struct list_type *) my_calloc(1, sizeof(struct list_type));
+		list = (struct list_type *) calloc(1, sizeof(struct list_type));
 
 		list->next = NULL;
                 list->extra = strdup(s);
@@ -816,13 +816,13 @@ int stream_readuserfile(bd::Stream& stream, struct userrec **ret)
 	      }
             /* if we don't have the entry, make it */
 	    if (!ok) {
-	      ue = (struct user_entry *) my_calloc(1, sizeof(struct user_entry));
+	      ue = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
-//	      ue->name = (char *) my_calloc(1, strlen(code + 1));
+//	      ue->name = (char *) calloc(1, strlen(code + 1));
               ue->name = strdup(code + 2);
 	      ue->type = NULL;
 //	      strcpy(ue->name, code + 2);
-	      ue->u.list = (struct list_type *) my_calloc(1, sizeof(struct list_type));
+	      ue->u.list = (struct list_type *) calloc(1, sizeof(struct list_type));
 
 	      ue->u.list->next = NULL;
               ue->u.list->extra = strdup(s);
@@ -1094,7 +1094,7 @@ static void autolink_random_hub(char *avoidbot) {
     if (glob_bot(fr) && strcasecmp(u->handle, conf.bot->nick) && (bot_hublevel(u) < 999)) {
       if (strcmp(u->handle, avoidbot)) {
         hl2 = hl;
-        hl = (struct hublist_entry *) my_calloc(1, sizeof(struct hublist_entry));
+        hl = (struct hublist_entry *) calloc(1, sizeof(struct hublist_entry));
 
         hl->next = hl2;
         hlc++;
@@ -1107,7 +1107,7 @@ static void autolink_random_hub(char *avoidbot) {
   /* We probably have 1 hub and avoided it :/ */
   if (!hlc && tmpu) {
     hl2 = hl;
-    hl = (struct hublist_entry *) my_calloc(1, sizeof(struct hublist_entry));
+    hl = (struct hublist_entry *) calloc(1, sizeof(struct hublist_entry));
     hl->next = hl2;
     hlc++;
     hl->u = tmpu;