[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Thu Oct 11 06:35:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-11 11:34:31 UTC
Commited by: Tothwolf <tothwolf at techmonkeys.org>

Modified files:
     src/botnet.c src/cmds.c src/dcc.c src/dccutil.c src/dns.c
     src/eggdrop.h src/flags.c src/misc.c src/tcldcc.c src/tclhash.c
     src/userent.c src/egglib/hash_table.c
     src/mod/channels.mod/tclchan.c src/mod/console.mod/console.c
     src/mod/filesys.mod/filedb3.c src/mod/filesys.mod/filesys.c
     src/mod/irc.mod/chan.c src/mod/irc.mod/irc.c
     src/mod/irc.mod/mode.c src/mod/server.mod/server.c
     src/mod/server.mod/servmsg.c src/mod/transfer.mod/transfer.c

Log message:

* Use calloc() instead of malloc_memset macro

---------------------- diff included ----------------------
Index: eggdrop1.7/src/botnet.c
diff -u eggdrop1.7/src/botnet.c:1.41 eggdrop1.7/src/botnet.c:1.42
--- eggdrop1.7/src/botnet.c:1.41	Wed Oct 10 05:44:03 2001
+++ eggdrop1.7/src/botnet.c	Thu Oct 11 06:34:19 2001
@@ -7,7 +7,7 @@
  *   linking, unlinking, and relaying to another bot
  *   pinging the bots periodically and checking leaf status
  *
- * $Id: botnet.c,v 1.41 2001/10/10 10:44:03 tothwolf Exp $
+ * $Id: botnet.c,v 1.42 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1022,7 +1022,7 @@
       strcpy(dcc[i].host, bi->address);
       dcc[i].u.dns->ibuf = idx;
       dcc[i].u.dns->cptr = linker;
-      malloc_memset(dcc[i].u.dns->host, 0, strlen(dcc[i].host) + 1);
+      dcc[i].u.dns->host = calloc(1, strlen(dcc[i].host) + 1);
       strcpy(dcc[i].u.dns->host, dcc[i].host);
       dcc[i].u.dns->dns_success = botlink_resolve_success;
       dcc[i].u.dns->dns_failure = botlink_resolve_failure;
@@ -1156,13 +1156,13 @@
   dprintf(idx, _("(Type *BYE* on a line by itself to abort.)\n"));
   dcc[idx].type = &DCC_PRE_RELAY;
   ci = dcc[idx].u.chat;
-  malloc_memset(dcc[idx].u.relay, 0, sizeof(struct relay_info));
+  dcc[idx].u.relay = 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->sock = dcc[i].sock;
   dcc[i].timeval = now;
   dcc[i].u.dns->ibuf = dcc[idx].sock;
-  malloc_memset(dcc[i].u.dns->host, 0, strlen(bi->address) + 1);
+  dcc[i].u.dns->host = calloc(1, strlen(bi->address) + 1);
   strcpy(dcc[i].u.dns->host, bi->address);
   dcc[i].u.dns->dns_success = tandem_relay_resolve_success;
   dcc[i].u.dns->dns_failure = tandem_relay_resolve_failure;
@@ -1205,7 +1205,7 @@
 
   strcpy(dcc[i].addr, dcc[i].u.dns->host);
   changeover_dcc(i, &DCC_FORK_RELAY, sizeof(struct relay_info));
-  malloc_memset(dcc[i].u.relay->chat, 0, sizeof(struct chat_info));
+  dcc[i].u.relay->chat = calloc(1, sizeof(struct chat_info));
 
   dcc[i].u.relay->sock = sock;
   dcc[i].u.relay->port = dcc[i].port;
Index: eggdrop1.7/src/cmds.c
diff -u eggdrop1.7/src/cmds.c:1.70 eggdrop1.7/src/cmds.c:1.71
--- eggdrop1.7/src/cmds.c:1.70	Wed Oct 10 05:44:03 2001
+++ eggdrop1.7/src/cmds.c	Thu Oct 11 06:34:19 2001
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.70 2001/10/10 10:44:03 tothwolf Exp $
+ * $Id: cmds.c,v 1.71 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -2120,9 +2120,9 @@
 	 */
 	if (dcc[idx].u.chat->away != NULL)
 	  free(dcc[idx].u.chat->away);
-	malloc_memset(dcc[idx].u.chat->away, 0, strlen(dcc[idx].nick) + 1);
+	dcc[idx].u.chat->away = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-	malloc_memset(dcc[idx].u.chat->su_nick, 0, strlen(dcc[idx].nick) + 1);
+	dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -2139,7 +2139,7 @@
 	dprintf(idx, "Setting your username to %s.\n", par);
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
-	malloc_memset(dcc[idx].u.chat->su_nick, 0, strlen(dcc[idx].nick) + 1);
+	dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
Index: eggdrop1.7/src/dcc.c
diff -u eggdrop1.7/src/dcc.c:1.57 eggdrop1.7/src/dcc.c:1.58
--- eggdrop1.7/src/dcc.c:1.57	Wed Oct 10 09:50:01 2001
+++ eggdrop1.7/src/dcc.c	Thu Oct 11 06:34:19 2001
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.57 2001/10/10 14:50:01 tothwolf Exp $
+ * $Id: dcc.c,v 1.58 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -535,7 +535,7 @@
     if(dcc_bot_check_digest(idx, buf+7)) {
       free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      malloc_memset(dcc[idx].u.bot, 0, sizeof(struct bot_info));
+      dcc[idx].u.bot = calloc(1, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
@@ -555,7 +555,7 @@
     if (atr & USER_BOT) {
       free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      malloc_memset(dcc[idx].u.bot, 0, sizeof(struct bot_info));
+      dcc[idx].u.bot = calloc(1, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
@@ -743,9 +743,9 @@
     else
       for (q = c->buffer; q->next; q = q->next);
 
-    malloc_memset(p, 0, sizeof(struct msgq));
+    p = calloc(1, sizeof(struct msgq));
     p->len = l;
-    malloc_memset(p->msg, 0, l + 1);
+    p->msg = calloc(1, l + 1);
     p->next = NULL;
     strcpy(p->msg, line);
     if (q == NULL)
@@ -1054,7 +1054,7 @@
   dcc[i].port = port;
   dcc[i].timeval = now;
   strcpy(dcc[i].nick, "*");
-  malloc_memset(dcc[i].u.dns->host, 0, j + 1);
+  dcc[i].u.dns->host = calloc(1, j + 1);
   strcpy(dcc[i].u.dns->host, dcc[i].addr);
 debug3("|DCC| dcc_telnet: idx: %d addr: %s u.dns->host: %s", i, dcc[i].addr, dcc[i].u.dns->host);
   dcc[i].u.dns->dns_success = dcc_telnet_hostresolved;
@@ -1318,7 +1318,7 @@
 
       ci = dcc[idx].u.chat;
       dcc[idx].type = &DCC_DUPWAIT;
-      malloc_memset(dcc[idx].u.dupwait, 0, sizeof(struct dupwait_info));
+      dcc[idx].u.dupwait = calloc(1, sizeof(struct dupwait_info));
       dcc[idx].u.dupwait->chat = ci;
       dcc[idx].u.dupwait->atr = atr;
       return;
@@ -1385,7 +1385,7 @@
     struct chat_info *ci;
 
     ci = dcc[idx].u.chat;
-    malloc_memset(dcc[idx].u.file, 0, sizeof(struct file_info));
+    dcc[idx].u.file = calloc(1, sizeof(struct file_info));
     dcc[idx].u.file->chat = ci;
   }
 
@@ -1958,7 +1958,7 @@
   sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);
 
   dcc[i].type = &DCC_TELNET_ID;
-  malloc_memset(dcc[i].u.chat, 0, sizeof(struct chat_info));
+  dcc[i].u.chat = calloc(1, sizeof(struct chat_info));
 
   /* Copy acceptable-nick/host mask */
   dcc[i].status = STAT_TELNET | STAT_ECHO;
Index: eggdrop1.7/src/dccutil.c
diff -u eggdrop1.7/src/dccutil.c:1.37 eggdrop1.7/src/dccutil.c:1.38
--- eggdrop1.7/src/dccutil.c:1.37	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/dccutil.c	Thu Oct 11 06:34:19 2001
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.37 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: dccutil.c,v 1.38 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -421,7 +421,7 @@
 
   dcc[i].type = type;
   if (xtra_size)
-    malloc_memset(dcc[i].u.other, 0, xtra_size);
+    dcc[i].u.other = calloc(1, xtra_size);
   return i;
 }
 
@@ -437,7 +437,7 @@
 
   dcc[i].type = type;
   if (xtra_size)
-    malloc_memset(dcc[i].u.other, 0, xtra_size);
+    dcc[i].u.other = calloc(1, xtra_size);
 }
 
 int detect_dcc_flood(time_t * timer, struct chat_info *chat, int idx)
Index: eggdrop1.7/src/dns.c
diff -u eggdrop1.7/src/dns.c:1.25 eggdrop1.7/src/dns.c:1.26
--- eggdrop1.7/src/dns.c:1.25	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/dns.c	Thu Oct 11 06:34:19 2001
@@ -4,7 +4,7 @@
  *   provides the code used by the bot if the DNS module is not loaded
  *   DNS Tcl commands
  *
- * $Id: dns.c,v 1.25 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: dns.c,v 1.26 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Written by Fabian Knittel <fknittel at gmx.de>
@@ -114,7 +114,7 @@
         (!egg_strcasecmp(dcc[idx].u.dns->host, ip))) {
 debug3("|DNS| idx: %d, dcchostbyip: %s is %s", idx, ip, hostn);
       free(dcc[idx].u.dns->host);
-      malloc_memset(dcc[idx].u.dns->host, 0, strlen(hostn) + 1);
+      dcc[idx].u.dns->host = calloc(1, strlen(hostn) + 1);
       strcpy(dcc[idx].u.dns->host, hostn);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);
@@ -137,7 +137,7 @@
         !egg_strcasecmp(dcc[idx].u.dns->host, hostn)) {
 debug3("|DNS| idx: %d, dccipbyhost: %s is %s", idx, ip, hostn);
       free(dcc[idx].u.dns->host);
-      malloc_memset(dcc[idx].u.dns->host, 0, strlen(ip) + 1);
+      dcc[idx].u.dns->host = calloc(1, strlen(ip) + 1);
       strcpy(dcc[idx].u.dns->host, ip);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);
@@ -171,7 +171,7 @@
     }
   }
 
-  malloc_memset(de, 0, sizeof(devent_t));
+  de = calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -198,7 +198,7 @@
     }
   }
 
-  malloc_memset(de, 0, sizeof(devent_t));
+  de = calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -247,7 +247,7 @@
   devent_t *de;
   devent_tclinfo_t *tclinfo;
 
-  malloc_memset(de, 0, sizeof(devent_t));
+  de = calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -275,7 +275,7 @@
   devent_t *de;
   devent_tclinfo_t *tclinfo;
 
-  malloc_memset(de, 0, sizeof(devent_t));
+  de = calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -488,7 +488,7 @@
     /* Create a string with a leading space out of all provided
      * additional parameters.
      */
-    malloc_memset(paras, 0, 1);
+    paras = calloc(1, 1);
     for (p = 3; p < argc; p++) {
       l += strlen(argv[p]) + 1;
       paras = realloc(paras, l + 1);
Index: eggdrop1.7/src/eggdrop.h
diff -u eggdrop1.7/src/eggdrop.h:1.43 eggdrop1.7/src/eggdrop.h:1.44
--- eggdrop1.7/src/eggdrop.h:1.43	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/eggdrop.h	Thu Oct 11 06:34:19 2001
@@ -4,7 +4,7 @@
  *
  *   IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  *
- * $Id: eggdrop.h,v 1.43 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: eggdrop.h,v 1.44 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -167,14 +167,6 @@
     free(ptr);								\
     ptr = NULL;								\
   }
-
-/* Allocate memory and set it to byte
- */
-#define malloc_memset(ptr, byte, size)					\
-  do {									\
-    ptr = malloc(size);							\
-    memset(ptr, byte, size);						\
-  } while (0)
 
 /* Copy entry to target -- Uses dynamic memory allocation, which
  * means you'll eventually have to free the memory again. 'target'
Index: eggdrop1.7/src/egglib/hash_table.c
diff -u eggdrop1.7/src/egglib/hash_table.c:1.2 eggdrop1.7/src/egglib/hash_table.c:1.3
--- eggdrop1.7/src/egglib/hash_table.c:1.2	Wed Oct 10 05:44:05 2001
+++ eggdrop1.7/src/egglib/hash_table.c	Thu Oct 11 06:34:19 2001
@@ -11,7 +11,7 @@
 	if (nrows <= 0) nrows = 13; /* Give them a small table to start with. */
 
 	size = sizeof(*ht) + (nrows-1) * sizeof(hash_table_entry_t);
-	malloc_memset(ht, 0, size);
+	ht = calloc(1, size);
 
 	if (alg) ht->hash = alg;
 	else {
Index: eggdrop1.7/src/flags.c
diff -u eggdrop1.7/src/flags.c:1.20 eggdrop1.7/src/flags.c:1.21
--- eggdrop1.7/src/flags.c:1.20	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/flags.c	Thu Oct 11 06:34:19 2001
@@ -2,7 +2,7 @@
  * flags.c -- handles:
  *   all the flag matching/conversion functions in one neat package :)
  *
- * $Id: flags.c,v 1.20 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: flags.c,v 1.21 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -634,7 +634,7 @@
 	break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
-      malloc_memset(cr, 0, sizeof(struct chanuserrec));
+      cr = calloc(1, sizeof(struct chanuserrec));
       cr->next = u->chanrec;
       u->chanrec = cr;
       strncpyz(cr->channel, chname, sizeof cr->channel);
Index: eggdrop1.7/src/misc.c
diff -u eggdrop1.7/src/misc.c:1.46 eggdrop1.7/src/misc.c:1.47
--- eggdrop1.7/src/misc.c:1.46	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/misc.c	Thu Oct 11 06:34:19 2001
@@ -7,7 +7,7 @@
  *   help system
  *   motd display and %var substitution
  *
- * $Id: misc.c,v 1.46 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: misc.c,v 1.47 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -735,7 +735,7 @@
     }
     strcat(s, q);
     free(colstr);
-    malloc_memset(colstr, 0, 1);
+    colstr = calloc(1, 1);
   }
 }
 
@@ -954,7 +954,7 @@
 
 	    cols = atoi(q + 5);
 	    colsofar = 0;
-	    malloc_memset(colstr, 0, 1);
+	    colstr = calloc(1, 1);
 	    r = strchr(q + 5, '/');
 	    if (r != NULL)
 	      subwidth = atoi(r + 1);
Index: eggdrop1.7/src/mod/channels.mod/tclchan.c
diff -u eggdrop1.7/src/mod/channels.mod/tclchan.c:1.55 eggdrop1.7/src/mod/channels.mod/tclchan.c:1.56
--- eggdrop1.7/src/mod/channels.mod/tclchan.c:1.55	Wed Oct 10 12:02:06 2001
+++ eggdrop1.7/src/mod/channels.mod/tclchan.c	Thu Oct 11 06:34:20 2001
@@ -1,7 +1,7 @@
 /*
  * tclchan.c -- part of channels.mod
  *
- * $Id: tclchan.c,v 1.55 2001/10/10 17:02:06 stdarg Exp $
+ * $Id: tclchan.c,v 1.56 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1408,7 +1408,7 @@
 
 static void init_masklist(masklist *m)
 {
-  malloc_memset(m->mask, 0, 1);
+  m->mask = calloc(1, 1);
   m->who = NULL;
   m->next = NULL;
 }
@@ -1421,7 +1421,7 @@
   chan->channel.mode = 0;
   chan->channel.members = 0;
   if (!reset)
-    malloc_memset(chan->channel.key, 0, 1);
+    chan->channel.key = calloc(1, 1);
 
   chan->channel.ban = (masklist *) malloc(sizeof(masklist));
   init_masklist(chan->channel.ban);
@@ -1507,7 +1507,7 @@
     /* Already existing channel, maybe a reload of the channel file */
     chan->status &= ~CHAN_FLAGGED;	/* don't delete me! :) */
   } else {
-    malloc_memset(chan, 0, sizeof(struct chanset_t));
+    chan = calloc(1, sizeof(struct chanset_t));
     chan->limit_prot = 0;
     chan->limit = 0;
     chan->flood_pub_thr = gfld_chan_thr;
Index: eggdrop1.7/src/mod/console.mod/console.c
diff -u eggdrop1.7/src/mod/console.mod/console.c:1.26 eggdrop1.7/src/mod/console.mod/console.c:1.27
--- eggdrop1.7/src/mod/console.mod/console.c:1.26	Wed Oct 10 13:37:55 2001
+++ eggdrop1.7/src/mod/console.mod/console.c	Thu Oct 11 06:34:20 2001
@@ -3,7 +3,7 @@
  *   saved console settings based on console.tcl
  *   by cmwagner/billyjoe/D. Senso
  *
- * $Id: console.c,v 1.26 2001/10/10 18:37:55 stdarg Exp $
+ * $Id: console.c,v 1.27 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -158,7 +158,7 @@
 
   BADARGS(4, 9, " handle CONSOLE channel flags strip echo page conchan");
   if (!i)
-    malloc_memset(i, 0, sizeof(struct console_info));
+    i = calloc(1, sizeof(struct console_info));
   if (i->channel)
     free(i->channel);
   l = strlen(argv[3]);
@@ -284,7 +284,7 @@
   struct console_info *i = get_user(&USERENTRY_CONSOLE, u);
 
   if (!i)
-    malloc_memset(i, 0, sizeof(struct console_info));
+    i = calloc(1, sizeof(struct console_info));
   if (i->channel)
     free(i->channel);
   malloc_strcpy(i->channel, dcc[idx].u.chat->con_chan);
Index: eggdrop1.7/src/mod/filesys.mod/filedb3.c
diff -u eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.21 eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.22
--- eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.21	Wed Oct 10 05:44:06 2001
+++ eggdrop1.7/src/mod/filesys.mod/filedb3.c	Thu Oct 11 06:34:20 2001
@@ -4,7 +4,7 @@
  *
  * Rewritten by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filedb3.c,v 1.21 2001/10/10 10:44:06 tothwolf Exp $
+ * $Id: filedb3.c,v 1.22 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -101,7 +101,7 @@
 {
   filedb_entry *fdbe = NULL;
 
-  malloc_memset(fdbe, 0, sizeof(filedb_entry));
+  fdbe = calloc(1, sizeof(filedb_entry));
 
   /* Mark as new, will be overwritten if necessary. */
   fdbe->_type = TYPE_NEW;
Index: eggdrop1.7/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.7/src/mod/filesys.mod/filesys.c:1.52 eggdrop1.7/src/mod/filesys.mod/filesys.c:1.53
--- eggdrop1.7/src/mod/filesys.mod/filesys.c:1.52	Wed Oct 10 13:47:42 2001
+++ eggdrop1.7/src/mod/filesys.mod/filesys.c	Thu Oct 11 06:34:20 2001
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.52 2001/10/10 18:47:42 stdarg Exp $
+ * $Id: filesys.c,v 1.53 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -324,7 +324,7 @@
 	  botnet_send_part_idx(idx, "file system");
       }
       ci = dcc[idx].u.chat;
-      malloc_memset(dcc[idx].u.file, 0, sizeof(struct file_info));
+      dcc[idx].u.file = calloc(1, sizeof(struct file_info));
       dcc[idx].u.file->chat = ci;
       dcc[idx].type = &DCC_FILES;
       dcc[idx].status |= STAT_CHAT;
@@ -671,11 +671,11 @@
       dcc[i].user = u;
       strcpy(dcc[i].nick, nick);
       strcpy(dcc[i].host, from);
-      malloc_memset(dcc[i].u.dns->cbuf, 0, strlen(param) + 1);
+      dcc[i].u.dns->cbuf = calloc(1, strlen(param) + 1);
       strcpy(dcc[i].u.dns->cbuf, param);
       dcc[i].u.dns->ibuf = atoi(msg);
       
-      malloc_memset(dcc[i].u.dns->host, 0, strlen(dcc[i].addr) + 1);
+      dcc[i].u.dns->host = calloc(1, strlen(dcc[i].addr) + 1);
       strcpy(dcc[i].u.dns->host, dcc[i].addr);
 
       dcc[i].u.dns->dns_type = RES_HOSTBYIP;
@@ -731,10 +731,10 @@
   if (param[0] == '.')
     param[0] = '_';
   /* Save the original filename */
-  malloc_memset(dcc[i].u.xfer->origname, 0, strlen(param) + 1);
+  dcc[i].u.xfer->origname = calloc(1, strlen(param) + 1);
   strcpy(dcc[i].u.xfer->origname, param);
   tempf = mktempfile(param);
-  malloc_memset(dcc[i].u.xfer->filename, 0, strlen(tempf) + 1);
+  dcc[i].u.xfer->filename = calloc(1, strlen(tempf) + 1);
   strcpy(dcc[i].u.xfer->filename, tempf);
   /* We don't need the temporary buffers anymore */
   free_null(tempf);
@@ -857,7 +857,7 @@
       strcpy(dcc[i].host, from);
       dcc[i].status = STAT_ECHO;
       dcc[i].timeval = now;
-      malloc_memset(dcc[i].u.file->chat, 0, sizeof(struct chat_info));
+      dcc[i].u.file->chat = calloc(1, sizeof(struct chat_info));
       strcpy(dcc[i].u.file->chat->con_chan, "*");
       dcc[i].user = u;
       putlog(LOG_MISC, "*", "DCC connection: CHAT(file) (%s!%s)", nick, from);
Index: eggdrop1.7/src/mod/irc.mod/chan.c
diff -u eggdrop1.7/src/mod/irc.mod/chan.c:1.74 eggdrop1.7/src/mod/irc.mod/chan.c:1.75
--- eggdrop1.7/src/mod/irc.mod/chan.c:1.74	Wed Oct 10 05:44:06 2001
+++ eggdrop1.7/src/mod/irc.mod/chan.c	Thu Oct 11 06:34:20 2001
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.74 2001/10/10 10:44:06 tothwolf Exp $
+ * $Id: chan.c,v 1.75 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -44,7 +44,7 @@
   memberlist *x;
 
   for (x = chan->channel.member; x && x->nick[0]; x = x->next); 
-  malloc_memset(x->next, 0, sizeof(memberlist));
+  x->next = calloc(1, sizeof(memberlist));
   x->next->next = NULL;
   x->next->nick[0] = 0;
   x->next->split = 0L;
@@ -1311,7 +1311,7 @@
     putlog(LOG_JOIN, chan->dname, _("Bad key--cant join: %s"), chan->dname);
     if (chan->channel.key[0]) {
       free(chan->channel.key);
-      malloc_memset(chan->channel.key, 0, 1);
+      chan->channel.key = calloc(1, 1);
       dprintf(DP_MODE, "JOIN %s %s\n", chan->dname, chan->key_prot);
     } else
       check_tcl_need(chan->dname, "key");
@@ -1357,7 +1357,7 @@
   if (chan->channel.topic)
     free(chan->channel.topic);
   if (k && k[0]) {
-    malloc_memset(chan->channel.topic, 0, strlen(k) + 1);
+    chan->channel.topic = calloc(1, strlen(k) + 1);
     strcpy(chan->channel.topic, k);
   } else
     chan->channel.topic = NULL;
Index: eggdrop1.7/src/mod/irc.mod/irc.c
diff -u eggdrop1.7/src/mod/irc.mod/irc.c:1.66 eggdrop1.7/src/mod/irc.mod/irc.c:1.67
--- eggdrop1.7/src/mod/irc.mod/irc.c:1.66	Wed Oct 10 12:02:06 2001
+++ eggdrop1.7/src/mod/irc.mod/irc.c	Thu Oct 11 06:34:20 2001
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.66 2001/10/10 17:02:06 stdarg Exp $
+ * $Id: irc.c,v 1.67 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -286,10 +286,10 @@
 {
   free(chan->channel.key);
   if (k == NULL) {
-    malloc_memset(chan->channel.key, 0, 1);
+    chan->channel.key = calloc(1, 1);
     return;
   }
-  malloc_memset(chan->channel.key, 0, strlen(k) + 1);
+  chan->channel.key = calloc(1, strlen(k) + 1);
   strcpy(chan->channel.key, k);
 }
 
@@ -315,14 +315,14 @@
   if (m->mask[0])
     return;			/* Already existent mask */
 
-  malloc_memset(m->next, 0, sizeof(masklist));
+  m->next = calloc(1, sizeof(masklist));
   m->next->next = NULL;
-  malloc_memset(m->next->mask, 0, 1);
+  m->next->mask = calloc(1, 1);
   m->next->mask[0] = 0;
   free(m->mask);
-  malloc_memset(m->mask, 0, strlen(s) + 1);
+  m->mask = calloc(1, strlen(s) + 1);
   strcpy(m->mask, s);
-  malloc_memset(m->who, 0, strlen(who) + 1);
+  m->who = calloc(1, strlen(who) + 1);
   strcpy(m->who, who);
   m->timer = now;
 }
@@ -363,7 +363,7 @@
   }
   if (!chan->channel.member) {
     putlog(LOG_MISC, "*", "(!) BUG: memberlist is NULL");
-    malloc_memset(chan->channel.member, 0, sizeof(memberlist));
+    chan->channel.member = calloc(1, sizeof(memberlist));
     chan->channel.member->nick[0] = 0;
     chan->channel.member->next = NULL;
   }
@@ -425,7 +425,7 @@
   }
   if (!channel_pending(chan)) {
     free(chan->channel.key);
-    malloc_memset(chan->channel.key, 0, 1);
+    chan->channel.key = calloc(1, 1);
     clear_channel(chan, 1);
     chan->status |= CHAN_PEND;
     chan->status &= ~(CHAN_ACTIVE | CHAN_ASKEDMODES);
Index: eggdrop1.7/src/mod/irc.mod/mode.c
diff -u eggdrop1.7/src/mod/irc.mod/mode.c:1.51 eggdrop1.7/src/mod/irc.mod/mode.c:1.52
--- eggdrop1.7/src/mod/irc.mod/mode.c:1.51	Wed Oct 10 12:02:06 2001
+++ eggdrop1.7/src/mod/irc.mod/mode.c	Thu Oct 11 06:34:20 2001
@@ -4,7 +4,7 @@
  *   channel mode changes and the bot's reaction to them
  *   setting and getting the current wanted channel modes
  *
- * $Id: mode.c,v 1.51 2001/10/10 17:02:06 stdarg Exp $
+ * $Id: mode.c,v 1.52 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -283,7 +283,7 @@
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == 0) {
 	chan->cmode[i].type = type;
-	malloc_memset(chan->cmode[i].op, 0, l);
+	chan->cmode[i].op = calloc(1, l);
 	chan->bytes += l;	/* Add 1 for safety */
 	strcpy(chan->cmode[i].op, op);
 	break;
@@ -294,7 +294,7 @@
   else if (plus == '+' && mode == 'k') {
     if (chan->key)
       free(chan->key);
-    malloc_memset(chan->key, 0, strlen(op) + 1);
+    chan->key = calloc(1, strlen(op) + 1);
     if (chan->key)
       strcpy(chan->key, op);
   }
@@ -302,7 +302,7 @@
   else if (plus == '-' && mode == 'k') {
     if (chan->rmkey)
       free(chan->rmkey);
-    malloc_memset(chan->rmkey, 0, strlen(op) + 1);
+    chan->rmkey = calloc(1, strlen(op) + 1);
     if (chan->rmkey)
       strcpy(chan->rmkey, op);
   }
Index: eggdrop1.7/src/mod/server.mod/server.c
diff -u eggdrop1.7/src/mod/server.mod/server.c:1.83 eggdrop1.7/src/mod/server.mod/server.c:1.84
--- eggdrop1.7/src/mod/server.mod/server.c:1.83	Wed Oct 10 05:44:07 2001
+++ eggdrop1.7/src/mod/server.mod/server.c	Thu Oct 11 06:34:20 2001
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.83 2001/10/10 10:44:07 tothwolf Exp $
+ * $Id: server.c,v 1.84 2001/10/11 11:34:20 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1457,7 +1457,7 @@
     strcpy(dcc[i].host, from);
     dcc[i].timeval = now;
     dcc[i].user = u;
-    malloc_memset(dcc[i].u.dns->host, 0, strlen(dcc[i].addr) + 1);
+    dcc[i].u.dns->host = calloc(1, strlen(dcc[i].addr) + 1);
     strcpy(dcc[i].u.dns->host, dcc[i].addr);
     dcc[i].u.dns->dns_type = RES_HOSTBYIP;
     dcc[i].u.dns->dns_success = dcc_chat_hostresolved;
Index: eggdrop1.7/src/mod/server.mod/servmsg.c
diff -u eggdrop1.7/src/mod/server.mod/servmsg.c:1.68 eggdrop1.7/src/mod/server.mod/servmsg.c:1.69
--- eggdrop1.7/src/mod/server.mod/servmsg.c:1.68	Wed Oct 10 05:44:07 2001
+++ eggdrop1.7/src/mod/server.mod/servmsg.c	Thu Oct 11 06:34:21 2001
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.68 2001/10/10 10:44:07 tothwolf Exp $
+ * $Id: servmsg.c,v 1.69 2001/10/11 11:34:21 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1116,9 +1116,9 @@
 
     dcc[servidx].timeval = now;
     dcc[servidx].sock = -1;
-    malloc_memset(dcc[servidx].u.dns->host, 0, strlen(dcc[servidx].host) + 1);
+    dcc[servidx].u.dns->host = calloc(1, strlen(dcc[servidx].host) + 1);
     strcpy(dcc[servidx].u.dns->host, dcc[servidx].host);
-    malloc_memset(dcc[servidx].u.dns->cbuf, 0, strlen(pass) + 1);
+    dcc[servidx].u.dns->cbuf = calloc(1, strlen(pass) + 1);
     strcpy(dcc[servidx].u.dns->cbuf, pass);
     dcc[servidx].u.dns->dns_success = server_resolve_success;
     dcc[servidx].u.dns->dns_failure = server_resolve_failure;
Index: eggdrop1.7/src/mod/transfer.mod/transfer.c
diff -u eggdrop1.7/src/mod/transfer.mod/transfer.c:1.45 eggdrop1.7/src/mod/transfer.mod/transfer.c:1.46
--- eggdrop1.7/src/mod/transfer.mod/transfer.c:1.45	Wed Oct 10 05:44:08 2001
+++ eggdrop1.7/src/mod/transfer.mod/transfer.c	Thu Oct 11 06:34:21 2001
@@ -1,7 +1,7 @@
 /*
  * transfer.c -- part of transfer.mod
  *
- * $Id: transfer.c,v 1.45 2001/10/10 10:44:08 tothwolf Exp $
+ * $Id: transfer.c,v 1.46 2001/10/11 11:34:21 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1446,11 +1446,11 @@
   dcc[i].port = port;
   strcpy(dcc[i].nick, nick);
   strcpy(dcc[i].host, "irc");
-  malloc_memset(dcc[i].u.xfer->filename, 0, strlen(filename) + 1);
+  dcc[i].u.xfer->filename = calloc(1, strlen(filename) + 1);
   strcpy(dcc[i].u.xfer->filename, filename);
   if (strchr(nfn, ' '))
     nfn = buf = replace_spaces(nfn);
-  malloc_memset(dcc[i].u.xfer->origname, 0, strlen(nfn) + 1);
+  dcc[i].u.xfer->origname = calloc(1, strlen(nfn) + 1);
   strcpy(dcc[i].u.xfer->origname, nfn);
   strcpy(dcc[i].u.xfer->from, from);
   strcpy(dcc[i].u.xfer->dir, dir);
@@ -1505,7 +1505,7 @@
   char *par, *arg;
   struct filesys_stats *fs;
 
-  malloc_memset(fs, 0, sizeof(struct filesys_stats));
+  fs = calloc(1, sizeof(struct filesys_stats));
   par = e->u.list->extra;
   arg = newsplit(&par);
   if (arg[0])
@@ -1671,7 +1671,7 @@
     break;
   default:
     if (!(fs = e->u.extra))
-      malloc_memset(fs, 0, sizeof(struct filesys_stats));
+      fs = calloc(1, sizeof(struct filesys_stats));
     p = newsplit (&par);
     if (p[0])
       fs->uploads = atoi (p);
@@ -1713,7 +1713,7 @@
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
         !(fs = ue->u.extra))
-      malloc_memset(fs, 0, sizeof(struct filesys_stats));
+      fs = calloc(1, sizeof(struct filesys_stats));
     fs->dnloads++;
     fs->dnload_ks += ((bytes + 512) / 1024);
     set_user(&USERENTRY_FSTAT, u, fs);
@@ -1729,7 +1729,7 @@
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
         !(fs = ue->u.extra))
-      malloc_memset(fs, 0, sizeof(struct filesys_stats));
+      fs = calloc(1, sizeof(struct filesys_stats));
     fs->uploads++;
     fs->upload_ks += ((bytes + 512) / 1024);
     set_user(&USERENTRY_FSTAT, u, fs);
@@ -1752,7 +1752,7 @@
   case 'u':
   case 'd':
     if (!(fs = e->u.extra))
-      malloc_memset(fs, 0, sizeof(struct filesys_stats));
+      fs = calloc(1, sizeof(struct filesys_stats));
     switch (argv[3][0]) {
     case 'u':
       fs->uploads = f;
Index: eggdrop1.7/src/tcldcc.c
diff -u eggdrop1.7/src/tcldcc.c:1.33 eggdrop1.7/src/tcldcc.c:1.34
--- eggdrop1.7/src/tcldcc.c:1.33	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/tcldcc.c	Thu Oct 11 06:34:19 2001
@@ -2,7 +2,7 @@
  * tcldcc.c -- handles:
  *   Tcl stubs for the dcc commands
  *
- * $Id: tcldcc.c,v 1.33 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: tcldcc.c,v 1.34 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -430,7 +430,7 @@
     check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
   }
   hold = dcc[idx].u.other;
-  malloc_memset(dcc[idx].u.script, 0, sizeof(struct script_info));
+  dcc[idx].u.script = calloc(1, sizeof(struct script_info));
   dcc[idx].u.script->u.other = hold;
   dcc[idx].u.script->type = dcc[idx].type;
   dcc[idx].type = &DCC_SCRIPT;
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.41 eggdrop1.7/src/tclhash.c:1.42
--- eggdrop1.7/src/tclhash.c:1.41	Wed Oct 10 13:37:54 2001
+++ eggdrop1.7/src/tclhash.c	Thu Oct 11 06:34:19 2001
@@ -7,7 +7,7 @@
  *   (non-Tcl) procedure lookups for msg/dcc/file commands
  *   (Tcl) binding internal procedures to msg/dcc/file commands
  *
- * $Id: tclhash.c,v 1.41 2001/10/10 18:37:54 stdarg Exp $
+ * $Id: tclhash.c,v 1.42 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -255,7 +255,7 @@
       break;		/* New. Insert at start of list.	*/
   }
 
-  malloc_memset(tl, 0, sizeof(tcl_bind_list_t));
+  tl = calloc(1, sizeof(tcl_bind_list_t));
   strcpy(tl->name, nme);
   tl->flags = flg;
   tl->func = func;
@@ -489,7 +489,7 @@
 
   /* Create bind if it doesn't exist yet. */
   if (!tm) {
-    malloc_memset(tm, 0, sizeof(tcl_bind_mask_t));
+    tm = calloc(1, sizeof(tcl_bind_mask_t));
     malloc_strcpy(tm->mask, cmd);
 
 #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION >= 9)
@@ -525,7 +525,7 @@
     }
   }
 
-  malloc_memset(tc, 0, sizeof(tcl_cmd_t));
+  tc = calloc(1, sizeof(tcl_cmd_t));
   tc->flags.match = FR_GLOBAL | FR_CHAN;
   break_down_flags(flags, &(tc->flags), NULL);
   malloc_strcpy(tc->func_name, proc);
Index: eggdrop1.7/src/userent.c
diff -u eggdrop1.7/src/userent.c:1.22 eggdrop1.7/src/userent.c:1.23
--- eggdrop1.7/src/userent.c:1.22	Wed Oct 10 05:44:04 2001
+++ eggdrop1.7/src/userent.c	Thu Oct 11 06:34:19 2001
@@ -2,7 +2,7 @@
  * userent.c -- handles:
  *   user-entry handling, new stylem more versatile.
  *
- * $Id: userent.c,v 1.22 2001/10/10 10:44:04 tothwolf Exp $
+ * $Id: userent.c,v 1.23 2001/10/11 11:34:19 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -384,7 +384,7 @@
   if (argc == 5)
     malloc_strcpy(li->lastonplace, argv[4]);
   else
-    malloc_memset(li->lastonplace, 0, 1);
+    li->lastonplace = calloc(1, 1);
 
   li->laston = atoi(argv[3]);
   set_user(&USERENTRY_LASTON, u, li);
@@ -428,7 +428,7 @@
   char *p = NULL, *q;
   struct bot_addr *bi;
 
-  malloc_memset(bi, 0, sizeof(struct bot_addr));
+  bi = calloc(1, sizeof(struct bot_addr));
   q = (e->u.list->extra);
   malloc_strcpy(p, q);
   if (!(q = strchr_unescape(p, ':', '\\')))
@@ -535,7 +535,7 @@
   if (u->flags & USER_BOT) {
     /* Silently ignore for users */
     if (!bi) {
-      malloc_memset(bi, 0, sizeof(struct bot_addr));
+      bi = calloc(1, sizeof(struct bot_addr));
     } else {
       free(bi->address);
     }
@@ -567,7 +567,7 @@
   char *arg;
   struct bot_addr *bi;
 
-  malloc_memset(bi, 0, sizeof(struct bot_addr));
+  bi = calloc(1, sizeof(struct bot_addr));
   arg = newsplit(&buf);
   str_unescape(arg, '\\');
   malloc_strcpy(bi->address, arg);
@@ -670,7 +670,7 @@
   int l;
 
   BADARGS(4, 5, " handle type key ?value?");
-  malloc_memset(xk, 0, sizeof(struct xtra_key));
+  xk = calloc(1, sizeof(struct xtra_key));
   l = strlen(argv[3]);
   if (l > 500)
     l = 500;
@@ -765,7 +765,7 @@
   if (!arg[0])
     return 1;
 
-  malloc_memset(xk, 0, sizeof(struct xtra_key));
+  xk = calloc(1, sizeof(struct xtra_key));
   l = strlen(arg);
   if (l > 500)
     l = 500;
----------------------- End of diff -----------------------



More information about the Changes mailing list