[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Wed Oct 10 05:45:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-10 10:44:18 UTC
Commited by: tothwolf

Modified files:
     acinclude.m4 configure.in src/Makefile.am src/botnet.c
     src/chanprog.c src/cmds.c src/dcc.c src/dccutil.c src/dns.c
     src/dns.h src/eggdrop.h src/flags.c src/main.c src/main.h
     src/match.c src/misc.c src/modules.c src/modules.h src/net.c
     src/proto.h src/tcl.c src/tcldcc.c src/tclhash.c src/tclhash.h
     src/tcluser.c src/userent.c src/userrec.c src/users.c src/users.h
     src/compat/Makefile.am src/compat/compat.h src/compat/inet_aton.c
     src/compat/strcasecmp.c src/egglib/hash_table.c
     src/egglib/linked_list.c src/mod/module.h src/mod/modvals.h
     src/mod/assoc.mod/assoc.c src/mod/blowfish.mod/blowfish.c
     src/mod/channels.mod/channels.c src/mod/channels.mod/channels.h
     src/mod/channels.mod/cmdschan.c src/mod/channels.mod/tclchan.c
     src/mod/channels.mod/udefchan.c src/mod/channels.mod/userchan.c
     src/mod/compress.mod/compress.c src/mod/console.mod/console.c
     src/mod/filesys.mod/dbcompat.c src/mod/filesys.mod/filedb3.c
     src/mod/filesys.mod/filedb3.h src/mod/filesys.mod/filelist.c
     src/mod/filesys.mod/files.c src/mod/filesys.mod/filesys.c
     src/mod/filesys.mod/tclfiles.c src/mod/irc.mod/chan.c
     src/mod/irc.mod/irc.c src/mod/irc.mod/mode.c
     src/mod/irc.mod/msgcmds.c src/mod/notes.mod/cmdsnote.c
     src/mod/notes.mod/notes.c src/mod/server.mod/server.c
     src/mod/server.mod/server.h src/mod/server.mod/servmsg.c
     src/mod/server.mod/tclserv.c src/mod/share.mod/share.c
     src/mod/share.mod/uf_features.c src/mod/transfer.mod/transfer.c
     src/mod/uptime.mod/uptime.c src/mod/woobie.mod/woobie.c

Removed files:
     src/mem.c src/compat/memcpy.c src/compat/memcpy.h
     src/compat/memset.c src/compat/memset.h

Log message:

all expmem functions and support removed
all memory status/debugging code removed
all #ifdef DEBUG_MEM code removed

nmalloc macro/n_malloc function removed, use malloc() now
mod_malloc function removed
my_strdup function removed, use malloc_strcpy macro now
channel_malloc removed, use malloc_memset macro now
n_malloc_null function removed, use malloc_memset macro now
user_malloc macro/_user_malloc function removed, use malloc() now

nrealloc macro/n_realloc function removed, use realloc() now
mod_realloc function removed

nfree macro/n_free function removed, use free() now
mod_free function removed
my_free macro removed, use free_null macro now
Tcl_Free compat macro now uses free() instead of removed n_free function

malloc->strcpy now uses malloc_strcpy macro
free(ptr);ptr=NULL; now uses free_null macro
malloc->bzero now uses malloc_memset macro
get_data_ptr macro/_get_data_ptr function removed, use malloc_memset macro now

compat memcpy removed
compat memset removed
egg_memcpy/my_memcpy misuse/mess changed to memcpy
egg_bzero/bzero macro removed, use memset() now

many uninitialized pointers now default to NULL

match.c is now compiled on it's own instead of being included into tclhash.c
match.c cleanup, removed broken/incomplete ircII compat code
wild_match macro removed, _wild_match function renamed to wild_match
wild_match_per function no longer declared static
added prototypes for wild_match and wild_match_per functions

Major function/macro changes:
  nmalloc -> malloc()
  nrealloc -> realloc()
  nfree -> free()

Bugs found and fixed during audit:
  buffer overflow in adduser()

Bugs fixed when code was removed:
  typo in filedb3.c: EBUG_MEM -> DEBUG_MEM
  extra egg_bzero call from filesys.c

---------------------- diff included ----------------------
Index: eggdrop1.7/acinclude.m4
diff -u eggdrop1.7/acinclude.m4:1.1 eggdrop1.7/acinclude.m4:1.2
--- eggdrop1.7/acinclude.m4:1.1	Tue Oct  9 20:20:08 2001
+++ eggdrop1.7/acinclude.m4	Wed Oct 10 05:44:03 2001
@@ -1,7 +1,7 @@
 dnl acinclude.m4
 dnl   macros autoconf uses when building configure from configure.in
 dnl
-dnl $Id: acinclude.m4,v 1.1 2001/10/10 01:20:08 ite Exp $
+dnl $Id: acinclude.m4,v 1.2 2001/10/10 10:44:03 tothwolf Exp $
 dnl
 
 
@@ -1072,7 +1072,7 @@
 dnl EGG_DEBUG_OPTIONS
 dnl
 AC_DEFUN(EGG_DEBUG_OPTIONS, [dnl
-EGG_DEBUG="-DDEBUG_MEM -DEBUG_ASSERT"
+EGG_DEBUG="-DEBUG_ASSERT"
 AC_SUBST(EGG_DEBUG)
 ])dnl
 
Index: eggdrop1.7/configure.in
diff -u eggdrop1.7/configure.in:1.47 eggdrop1.7/configure.in:1.48
--- eggdrop1.7/configure.in:1.47	Tue Oct  9 20:20:08 2001
+++ eggdrop1.7/configure.in	Wed Oct 10 05:44:03 2001
@@ -66,7 +66,7 @@
 AC_CHECK_SIZEOF(int, 0)
 
 # Checks for library functions
-AC_CHECK_FUNCS(clock getrusage setpgid uname sigaction sigemptyset rename strcasecmp strncasecmp getdtablesize memset random srandom dlopen dprintf snprintf vsnprintf isascii inet_aton memcpy strftime fsync inet_pton inet_ntop)
+AC_CHECK_FUNCS(clock getrusage setpgid uname sigaction sigemptyset rename strcasecmp strncasecmp getdtablesize random srandom dlopen dprintf snprintf vsnprintf isascii inet_aton strftime fsync inet_pton inet_ntop)
 EGG_CHECK_FUNC_VSPRINTF
 
 # Make sure we have stdc headers, since we can't compile without them
Index: eggdrop1.7/src/Makefile.am
diff -u eggdrop1.7/src/Makefile.am:1.1 eggdrop1.7/src/Makefile.am:1.2
--- eggdrop1.7/src/Makefile.am:1.1	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/Makefile.am	Wed Oct 10 05:44:03 2001
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.1 2001/10/10 01:20:10 ite Exp $
+# $Id: Makefile.am,v 1.2 2001/10/10 10:44:03 tothwolf Exp $
 
 # FIXME: optionally allow a system wide install by ignoring the line below.
 bindir    = $(exec_prefix)
@@ -22,13 +22,13 @@
 eggdrop_SOURCES = bg.c \
 		chanprog.c \
 		dns.c \
-		mem.c \
 		net.c \
 		tclhash.c \
 		userrec.c \
 		botcmd.c \
 		cmds.c \
 		flags.c \
+		match.c \
 		misc.c \
 		rfc1459.c \
 		tclmisc.c \
Index: eggdrop1.7/src/botnet.c
diff -u eggdrop1.7/src/botnet.c:1.40 eggdrop1.7/src/botnet.c:1.41
--- eggdrop1.7/src/botnet.c:1.40	Sat Oct  6 23:02:54 2001
+++ eggdrop1.7/src/botnet.c	Wed Oct 10 05:44:03 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.40 2001/10/07 04:02:54 stdarg Exp $
+ * $Id: botnet.c,v 1.41 2001/10/10 10:44:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -55,23 +55,6 @@
 static bind_table_t *BT_chjn = NULL;
 static bind_table_t *BT_chpt = NULL;
 
-int expmem_botnet()
-{
-  int size = 0, i;
-  tand_t *bot;
-
-  for (bot = tandbot; bot; bot = bot->next)
-    size += sizeof(tand_t);
-  size += (maxparty * sizeof(party_t));
-  for (i = 0; i < parties; i++) {
-    if (party[i].away)
-      size += strlen(party[i].away) + 1;
-    if (party[i].from)
-      size += strlen(party[i].from) + 1;
-  }
-  return size;
-}
-
 static void init_bots();
 
 void botnet_init()
@@ -87,7 +70,7 @@
   tandbot = NULL;
   /* Grab space for 50 bots for now -- expand later as needed */
   maxparty = 50;
-  party = (party_t *) nmalloc(maxparty * sizeof(party_t));
+  party = (party_t *) malloc(maxparty * sizeof(party_t));
 }
 
 tand_t *findbot(char *who)
@@ -111,7 +94,7 @@
       putlog(LOG_BOTS, "*", "!!! Duplicate botnet bot entry!!");
     ptr = &((*ptr)->next);
   }
-  ptr2 = nmalloc(sizeof(tand_t));
+  ptr2 = malloc(sizeof(tand_t));
   strncpy(ptr2->bot, who, HANDLEN);
   ptr2->bot[HANDLEN] = 0;
   ptr2->share = flag;
@@ -175,9 +158,8 @@
 	  flag = '-';
 	party[i].flag = flag;
 	if (party[i].from)
-	  nfree(party[i].from);
-	party[i].from = nmalloc(strlen(from) + 1);
-	strcpy(party[i].from, from);
+	  free(party[i].from);
+	malloc_strcpy(party[i].from, from);
       }
       *idx = i;
       return oldchan;
@@ -186,7 +168,7 @@
   /* New member */
   if (parties == maxparty) {
     maxparty += 50;
-    party = (party_t *) nrealloc((void *) party, maxparty * sizeof(party_t));
+    party = (party_t *) realloc((void *) party, maxparty * sizeof(party_t));
   }
   strncpy(party[parties].nick, nick, HANDLEN);
   party[parties].nick[HANDLEN] = 0;
@@ -201,12 +183,10 @@
     if (flag == ' ')
       flag = '-';
     party[parties].flag = flag;
-    party[parties].from = nmalloc(strlen(from) + 1);
-    strcpy(party[parties].from, from);
+    malloc_strcpy(party[parties].from, from);
   } else {
     party[parties].flag = ' ';
-    party[parties].from = nmalloc(10);
-    strcpy(party[parties].from, "(unknown)");
+    malloc_strcpy(party[parties].from, "(unknown)");
   }
   *idx = parties;
   parties++;
@@ -302,11 +282,10 @@
     if ((!egg_strcasecmp(party[i].bot, bot)) &&
 	(party[i].sock == sock)) {
       if (party[i].away)
-	nfree(party[i].away);
-      if (msg[0]) {
-	party[i].away = nmalloc(strlen(msg) + 1);
-	strcpy(party[i].away, msg);
-      } else
+	free(party[i].away);
+      if (msg[0])
+	malloc_strcpy(party[i].away, msg);
+      else
 	party[i].away = 0;
     }
   }
@@ -330,7 +309,7 @@
 
   ptr2 = *ptr;
   *ptr = ptr2->next;
-  nfree(ptr2);
+  free(ptr2);
   tands--;
 
   dupwait_notify(who);
@@ -345,9 +324,9 @@
 	(party[i].sock == sock)) {
       parties--;
       if (party[i].from)
-	nfree(party[i].from);
+	free(party[i].from);
       if (party[i].away)
-	nfree(party[i].away);
+	free(party[i].away);
       if (i < parties) {
 	strcpy(party[i].bot, party[parties].bot);
 	strcpy(party[i].nick, party[parties].nick);
@@ -1043,7 +1022,7 @@
       strcpy(dcc[i].host, bi->address);
       dcc[i].u.dns->ibuf = idx;
       dcc[i].u.dns->cptr = linker;
-      dcc[i].u.dns->host = get_data_ptr(strlen(dcc[i].host) + 1);
+      malloc_memset(dcc[i].u.dns->host, 0, 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;
@@ -1105,7 +1084,7 @@
 
     dprintf(uidx, "%s %s.\n", _("Could not link to"), dcc[idx].nick);
     dcc[uidx].status = dcc[uidx].u.relay->old_status;
-    nfree(dcc[uidx].u.relay);
+    free(dcc[uidx].u.relay);
     dcc[uidx].u.chat = ci;
     dcc[uidx].type = &DCC_CHAT;
     killsock(dcc[idx].sock);
@@ -1177,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;
-  dcc[idx].u.relay = get_data_ptr(sizeof(struct relay_info));
+  malloc_memset(dcc[idx].u.relay, 0, 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;
-  dcc[i].u.dns->host = get_data_ptr(strlen(bi->address) + 1);
+  malloc_memset(dcc[i].u.dns->host, 0, 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;
@@ -1213,7 +1192,7 @@
   ci = dcc[uidx].u.relay->chat;
   dprintf(uidx, _("Could not link to %s.\n"), dcc[idx].nick);
   dcc[uidx].status = dcc[uidx].u.relay->old_status;
-  nfree(dcc[uidx].u.relay);
+  free(dcc[uidx].u.relay);
   dcc[uidx].u.chat = ci;
   dcc[uidx].type = &DCC_CHAT;
   killsock(dcc[idx].sock);
@@ -1226,7 +1205,7 @@
 
   strcpy(dcc[i].addr, dcc[i].u.dns->host);
   changeover_dcc(i, &DCC_FORK_RELAY, sizeof(struct relay_info));
-  dcc[i].u.relay->chat = get_data_ptr(sizeof(struct chat_info));
+  malloc_memset(dcc[i].u.relay->chat, 0, sizeof(struct chat_info));
 
   dcc[i].u.relay->sock = sock;
   dcc[i].u.relay->port = dcc[i].port;
@@ -1280,7 +1259,7 @@
     putlog(LOG_MISC, "*", _("Relay aborted: %s -> %s"), dcc[idx].nick,
 	   dcc[tidx].nick);
     dcc[idx].status = dcc[idx].u.relay->old_status;
-    nfree(dcc[idx].u.relay);
+    free(dcc[idx].u.relay);
     dcc[idx].u.chat = ci;
     dcc[idx].type = &DCC_CHAT;
     killsock(dcc[tidx].sock);
@@ -1396,7 +1375,7 @@
 	 dcc[idx].nick);
   dprintf(j, "\n\n*** %s %s\n", _("RELAY CONNECTION DROPPED.\nYou are now back on"), botnetnick);
   ci = dcc[j].u.relay->chat;
-  nfree(dcc[j].u.relay);
+  free(dcc[j].u.relay);
   dcc[j].u.chat = ci;
   dcc[j].type = &DCC_CHAT;
   if (dcc[j].u.chat->channel >= 0) {
@@ -1497,7 +1476,7 @@
       botnet_send_join_idx(idx, -1);
   }
   ci = dcc[idx].u.relay->chat;
-  nfree(dcc[idx].u.relay);
+  free(dcc[idx].u.relay);
   dcc[idx].u.chat = ci;
   dcc[idx].type = &DCC_CHAT;
   check_tcl_chon(dcc[idx].nick, dcc[idx].sock);
@@ -1529,23 +1508,13 @@
   strcpy(other, "other  >rly");
 }
 
-static int expmem_relay(void *x)
-{
-  register struct relay_info *p = (struct relay_info *) x;
-  int tot = sizeof(struct relay_info);
-
-  if (p->chat)
-    tot += DCC_CHAT.expmem(p->chat);
-  return tot;
-}
-
 static void kill_relay(int idx, void *x)
 {
   register struct relay_info *p = (struct relay_info *) x;
 
   if (p->chat)
     DCC_CHAT.kill(idx, p->chat);
-  nfree(p);
+  free(p);
 }
 
 struct dcc_table DCC_RELAY =
@@ -1557,7 +1526,6 @@
   NULL,
   NULL,
   display_relay,
-  expmem_relay,
   kill_relay,
   NULL
 };
@@ -1581,7 +1549,6 @@
   NULL,
   NULL,
   display_relaying,
-  expmem_relay,
   kill_relay,
   out_relay
 };
@@ -1595,7 +1562,6 @@
   &connect_timeout,
   failed_tandem_relay,
   display_tandem_relay,
-  expmem_relay,
   kill_relay,
   NULL
 };
@@ -1609,7 +1575,6 @@
   NULL,
   NULL,
   display_pre_relay,
-  expmem_relay,
   kill_relay,
   NULL
 };
Index: eggdrop1.7/src/chanprog.c
diff -u eggdrop1.7/src/chanprog.c:1.28 eggdrop1.7/src/chanprog.c:1.29
--- eggdrop1.7/src/chanprog.c:1.28	Wed Aug 15 12:09:53 2001
+++ eggdrop1.7/src/chanprog.c	Wed Oct 10 05:44:03 2001
@@ -5,7 +5,7 @@
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts
  *
- * $Id: chanprog.c,v 1.28 2001/08/15 17:09:53 guppy Exp $
+ * $Id: chanprog.c,v 1.29 2001/10/10 10:44:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -203,20 +203,6 @@
 	m->user = rec;
 }
 
-/* Calculate the memory we should be using
- */
-int expmem_chanprog()
-{
-  register int		 tot = 0;
-  register tcl_timer_t	*t;
-
-  for (t = timer; t; t = t->next)
-    tot += sizeof(tcl_timer_t) + strlen(t->cmd) + 1;
-  for (t = utimer; t; t = t->next)
-    tot += sizeof(tcl_timer_t) + strlen(t->cmd) + 1;
-  return tot;
-}
-
 /* Dump status info out to dcc
  */
 void tell_verbose_status(int idx)
@@ -247,9 +233,8 @@
 #endif
 
   i = count_users(userlist);
-  dprintf(idx, "I am %s, running %s:  %d user%s (mem: %uk)\n",
-	  botnetnick, ver, i, i == 1 ? "" : "s",
-          (int) (expected_memory() / 1024));
+  dprintf(idx, "I am %s, running %s:  %d user%s\n",
+	  botnetnick, ver, i, i == 1 ? "" : "s");
   dprintf(idx, "Running on %s %s\n", uni_t, vers_t);
   if (admin[0])
     dprintf(idx, "Admin: %s\n", admin);
@@ -392,14 +377,10 @@
     fatal(_("CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)"), 0);
   for (i = 0; i < max_logs; i++) {
     if (logs[i].flags & LF_EXPIRING) {
-      if (logs[i].filename != NULL) {
-        nfree(logs[i].filename);
-        logs[i].filename = NULL;
-      }
-      if (logs[i].chname != NULL) {
-        nfree(logs[i].chname);
-        logs[i].chname = NULL;
-      }
+      if (logs[i].filename != NULL)
+        free_null(logs[i].filename);
+      if (logs[i].chname != NULL)
+        free_null(logs[i].chname);
       if (logs[i].f != NULL) {
         fclose(logs[i].f);
         logs[i].f = NULL;
@@ -506,11 +487,11 @@
 {
   tcl_timer_t *old = (*stack);
 
-  *stack = (tcl_timer_t *) nmalloc(sizeof(tcl_timer_t));
+  *stack = (tcl_timer_t *) malloc(sizeof(tcl_timer_t));
   (*stack)->next = old;
   (*stack)->mins = elapse;
-  (*stack)->cmd = (char *) nmalloc(strlen(cmd) + 1);
-  strcpy((*stack)->cmd, cmd);
+  malloc_strcpy((*stack)->cmd, cmd);
+
   /* If it's just being added back and already had an id,
    * don't create a new one.
   */
@@ -533,8 +514,8 @@
       ok++;
       old = *stack;
       *stack = ((*stack)->next);
-      nfree(old->cmd);
-      nfree(old);
+      free(old->cmd);
+      free(old);
     } else
       stack = &((*stack)->next);
   }
@@ -561,8 +542,8 @@
     if (!old->mins) {
       egg_snprintf(x, sizeof x, "timer%lu", old->id);
       do_tcl(x, old->cmd);
-      nfree(old->cmd);
-      nfree(old);
+      free(old->cmd);
+      free(old);
     } else {
       old->next = *stack;
       *stack = old;
@@ -579,8 +560,8 @@
   while (mark) {
     old = mark;
     mark = mark->next;
-    nfree(old->cmd);
-    nfree(old);
+    free(old->cmd);
+    free(old);
   }
   *stack = NULL;
 }
Index: eggdrop1.7/src/cmds.c
diff -u eggdrop1.7/src/cmds.c:1.69 eggdrop1.7/src/cmds.c:1.70
--- eggdrop1.7/src/cmds.c:1.69	Sat Oct  6 23:02:54 2001
+++ eggdrop1.7/src/cmds.c	Wed Oct 10 05:44:03 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.69 2001/10/07 04:02:54 stdarg Exp $
+ * $Id: cmds.c,v 1.70 2001/10/10 10:44:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -570,14 +570,12 @@
     }
     putlog(LOG_CMDS, "*", "#%s# status all", dcc[idx].nick);
     tell_verbose_status(idx);
-    tell_mem_status_dcc(idx);
     dprintf(idx, "\n");
     tell_settings(idx);
     do_module_report(idx, 1, NULL);
   } else {
     putlog(LOG_CMDS, "*", "#%s# status", dcc[idx].nick);
     tell_verbose_status(idx);
-    tell_mem_status_dcc(idx);
     do_module_report(idx, 0, NULL);
   }
 }
@@ -786,7 +784,7 @@
       putlog(LOG_CMDS, "*", "#%s# +bot %s %s", dcc[idx].nick, handle, addr);
       userlist = adduser(userlist, handle, "none", "-", USER_BOT);
       u1 = get_user_by_handle(userlist, handle);
-      bi = user_malloc(sizeof(struct bot_addr));
+      bi = malloc(sizeof(struct bot_addr));
 
       if (*addr == '[') {
 	addr++;
@@ -804,12 +802,11 @@
 	  addrlen = strlen(addr);
       }
       if (!q) {
-	bi->address = user_malloc(addrlen + 1);
-	strcpy(bi->address, addr);
+	malloc_strcpy(bi->address, addr);
 	bi->telnet_port = 3333;
 	bi->relay_port = 3333;
       } else {
-	bi->address = user_malloc(addrlen + 1);
+	bi->address = malloc(addrlen + 1);
 	strncpyz(bi->address, addr, addrlen + 1);
 	p = q + 1;
 	bi->telnet_port = atoi(p);
@@ -989,7 +986,7 @@
     relay_port = bi->relay_port;
   }
 
-  bi = user_malloc(sizeof(struct bot_addr));
+  bi = malloc(sizeof(struct bot_addr));
 
   if (*addr == '[') {
     addr++;
@@ -1007,12 +1004,11 @@
 	addrlen = strlen(addr);
   }
   if (!q) {
-    bi->address = user_malloc(addrlen + 1);
-    strcpy(bi->address, addr);
+    malloc_strcpy(bi->address, addr);
     bi->telnet_port = telnet_port;
     bi->relay_port = relay_port;
   } else {
-    bi->address = user_malloc(addrlen + 1);
+    bi->address = malloc(addrlen + 1);
     strncpyz(bi->address, addr, addrlen + 1);
     p = q + 1;
     bi->telnet_port = atoi(p);
@@ -1119,7 +1115,8 @@
     debug_help(idx);
   } else {
     putlog(LOG_CMDS, "*", "#%s# debug", dcc[idx].nick);
-    debug_mem_to_dcc(idx);
+    dprintf(idx, "Eggdrop no longer has built-in memory debugging.\n");
+    tell_netdebug(idx);
   }
 }
 
@@ -1362,7 +1359,7 @@
 	  struct chat_info *ci;
 
 	  ci = dcc[i].u.file->chat;
-	  nfree(dcc[i].u.file);
+	  free(dcc[i].u.file);
 	  dcc[i].u.chat = ci;
 	  dcc[i].status &= (~STAT_CHAT);
 	  dcc[i].type = &DCC_CHAT;
@@ -1514,7 +1511,7 @@
 	return;
       }
     } else if (arg && !strpbrk(chg, "&|")) {
-      tmpchg = nmalloc(strlen(chg) + 2);
+      tmpchg = malloc(strlen(chg) + 2);
       strcpy(tmpchg, "|");
       strcat(tmpchg, chg);
       chg = tmpchg;
@@ -1528,14 +1525,14 @@
   if (!chan && !glob_botmast(user)) {
     dprintf(idx, "You do not have Bot Master privileges.\n");
     if (tmpchg)
-      nfree(tmpchg);
+      free(tmpchg);
     return;
   }
   if (chan && !glob_master(user) && !chan_master(user)) {
     dprintf(idx, "You do not have channel master privileges for channel %s\n",
 	    par);
     if (tmpchg)
-      nfree(tmpchg);
+      free(tmpchg);
     return;
   }
   user.match &= fl;
@@ -1631,7 +1628,7 @@
     }
   }
   if (tmpchg)
-    nfree(tmpchg);
+    free(tmpchg);
 }
 
 static void cmd_botattr(struct userrec *u, int idx, char *par)
@@ -1704,9 +1701,9 @@
 	return;
       }
     } else if (arg && !strpbrk(chg, "&|")) {
-      tmpchg = nmalloc(strlen(chg) + 2);
-      strcpy (tmpchg, "|");
-      strcat (tmpchg, chg);
+      tmpchg = malloc(strlen(chg) + 2);
+      strcpy(tmpchg, "|");
+      strcat(tmpchg, chg);
       chg = tmpchg;
     }
   }
@@ -1717,7 +1714,7 @@
   if (!glob_botmast(user)) {
     dprintf(idx, "You do not have Bot Master privileges.\n");
     if (tmpchg)
-      nfree(tmpchg);
+      free(tmpchg);
     return;
   }
   if (chg) {
@@ -1776,7 +1773,7 @@
       dprintf(idx, "No bot flags for %s on %s.\n", hand, chan->dname);
   }
   if (tmpchg)
-    nfree(tmpchg);
+    free(tmpchg);
 }
 
 static void cmd_chat(struct userrec *u, int idx, char *par)
@@ -2122,10 +2119,10 @@
 	 * their password right ;)
 	 */
 	if (dcc[idx].u.chat->away != NULL)
-	  nfree(dcc[idx].u.chat->away);
-        dcc[idx].u.chat->away = get_data_ptr(strlen(dcc[idx].nick) + 1);
+	  free(dcc[idx].u.chat->away);
+	malloc_memset(dcc[idx].u.chat->away, 0, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-        dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
+	malloc_memset(dcc[idx].u.chat->su_nick, 0, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -2142,7 +2139,7 @@
 	dprintf(idx, "Setting your username to %s.\n", par);
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
-        dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
+	malloc_memset(dcc[idx].u.chat->su_nick, 0, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -2738,8 +2735,7 @@
 		dcc[idx].user = get_user_by_handle(userlist, dcc[idx].u.chat->su_nick);
 		dcc[idx].type = &DCC_CHAT;
 		dprintf(idx, "Returning to real nick %s!\n", dcc[idx].u.chat->su_nick);
-		nfree(dcc[idx].u.chat->su_nick);
-		dcc[idx].u.chat->su_nick = NULL;
+		free_null(dcc[idx].u.chat->su_nick);
 		dcc_chatter(idx);
 		if (dcc[idx].u.chat->channel < 100000 && dcc[idx].u.chat->channel >= 0) {
 			botnet_send_join_idx(idx, -1);
Index: eggdrop1.7/src/compat/Makefile.am
diff -u eggdrop1.7/src/compat/Makefile.am:1.1 eggdrop1.7/src/compat/Makefile.am:1.2
--- eggdrop1.7/src/compat/Makefile.am:1.1	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/compat/Makefile.am	Wed Oct 10 05:44:04 2001
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.1 2001/10/10 01:20:10 ite Exp $
+# $Id: Makefile.am,v 1.2 2001/10/10 10:44:04 tothwolf Exp $
 
 ## libcompat is built as convenience library
 
@@ -15,10 +15,6 @@
 		  inet_ntop.h \
 		  inet_pton.c \
 		  inet_pton.h \
-		  memcpy.c \
-		  memcpy.h \
-		  memset.c \
-		  memset.h \
 		  snprintf.c \
 		  snprintf.h \
 		  strcasecmp.c \
Index: eggdrop1.7/src/compat/compat.h
diff -u eggdrop1.7/src/compat/compat.h:1.4 eggdrop1.7/src/compat/compat.h:1.5
--- eggdrop1.7/src/compat/compat.h:1.4	Thu Jul 26 12:04:33 2001
+++ eggdrop1.7/src/compat/compat.h	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * compat.h
  *   wrap-around header for all compability functions.
  *
- * $Id: compat.h,v 1.4 2001/07/26 17:04:33 drummer Exp $
+ * $Id: compat.h,v 1.5 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 2000, 2001 Eggheads Development Team
@@ -29,8 +29,6 @@
 
 #include "inet_aton.h"
 #include "snprintf.h"
-#include "memset.h"
-#include "memcpy.h"
 #include "strcasecmp.h"
 #include "strftime.h"
 #include "inet_pton.h"
Index: eggdrop1.7/src/compat/inet_aton.c
diff -u eggdrop1.7/src/compat/inet_aton.c:1.6 eggdrop1.7/src/compat/inet_aton.c:1.7
--- eggdrop1.7/src/compat/inet_aton.c:1.6	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/compat/inet_aton.c	Wed Oct 10 05:44:04 2001
@@ -1,7 +1,7 @@
 /*
  * inet_aton.c -- provides inet_aton() if necessary.
  *
- * $Id: inet_aton.c,v 1.6 2001/10/10 01:20:10 ite Exp $
+ * $Id: inet_aton.c,v 1.7 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Poritions Copyright (C) 2000, 2001 Eggheads Development Team
@@ -113,7 +113,7 @@
 	u_32bit_t parts[4];
 	register u_32bit_t *pp = parts;
 
-	egg_bzero(parts, sizeof (parts));
+	memset(parts, 0, sizeof (parts));
 
 	c = *cp;
 	for (;;) {
Index: eggdrop1.7/src/compat/memcpy.c
diff -u eggdrop1.7/src/compat/memcpy.c:1.3 eggdrop1.7/src/compat/memcpy.c:removed
--- eggdrop1.7/src/compat/memcpy.c:1.3	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/compat/memcpy.c	Wed Oct 10 05:44:18 2001
@@ -1,35 +0,0 @@
-/*
- * memcpy.c -- provides memcpy() if necessary.
- *
- * $Id: memcpy.c,v 1.3 2001/10/10 01:20:10 ite Exp $
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#include "../main.h"
-#include "memcpy.h"
-
-#ifndef HAVE_MEMCPY
-void *egg_memcpy(void *dest, const void *src, size_t n)
-{
-  while (n--)
-    *((char *) dest)++ = *((char *) src)++;
-  return dest;
-}
-#endif /* !HAVE_MEMCPY */
Index: eggdrop1.7/src/compat/memcpy.h
diff -u eggdrop1.7/src/compat/memcpy.h:1.3 eggdrop1.7/src/compat/memcpy.h:removed
--- eggdrop1.7/src/compat/memcpy.h:1.3	Wed Apr 11 21:39:44 2001
+++ eggdrop1.7/src/compat/memcpy.h	Wed Oct 10 05:44:19 2001
@@ -1,38 +0,0 @@
-/*
- * memcpy.h
- *   prototypes for memcpy.c
- *
- * $Id: memcpy.h,v 1.3 2001/04/12 02:39:44 guppy Exp $
- */
-/*
- * Copyright (C) 2000, 2001 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef _EGG_COMPAT_MEMCPY_H
-#define _EGG_COMPAT_MEMCPY_H
-
-#include "src/main.h"
-#include <string.h>
-
-#ifndef HAVE_MEMCPY
-/* Use our own implementation. */
-void *egg_memcpy(void *dest, const void *src, size_t n);
-#else
-#  define egg_memcpy	memcpy
-#endif
-
-#endif	/* !__EGG_COMPAT_MEMCPY_H */
Index: eggdrop1.7/src/compat/memset.c
diff -u eggdrop1.7/src/compat/memset.c:1.4 eggdrop1.7/src/compat/memset.c:removed
--- eggdrop1.7/src/compat/memset.c:1.4	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/compat/memset.c	Wed Oct 10 05:44:19 2001
@@ -1,35 +0,0 @@
-/*
- * memset.c -- provides memset() if necessary.
- *
- * $Id: memset.c,v 1.4 2001/10/10 01:20:10 ite Exp $
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#include "../main.h"
-#include "memset.h"
-
-#ifndef HAVE_MEMSET
-void *egg_memset(void *dest, int c, size_t n)
-{
-  while (n--)
-    *((u_8bit_t *) dest)++ = c;
-  return dest;
-}
-#endif /* !HAVE_MEMSET */
Index: eggdrop1.7/src/compat/memset.h
diff -u eggdrop1.7/src/compat/memset.h:1.3 eggdrop1.7/src/compat/memset.h:removed
--- eggdrop1.7/src/compat/memset.h:1.3	Wed Apr 11 21:39:44 2001
+++ eggdrop1.7/src/compat/memset.h	Wed Oct 10 05:44:19 2001
@@ -1,42 +0,0 @@
-/*
- * memset.h
- *   prototypes for memset.c
- *
- * $Id: memset.h,v 1.3 2001/04/12 02:39:44 guppy Exp $
- */
-/*
- * Copyright (C) 2000, 2001 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef _EGG_COMPAT_MEMSET_H
-#define _EGG_COMPAT_MEMSET_H
-
-#include "src/main.h"
-#include <string.h>
-
-#ifndef HAVE_MEMSET
-/* Use our own implementation. */
-void *egg_memset(void *dest, int c, size_t n);
-#else
-#  define egg_memset	memset
-#endif
-
-/* Use memset instead of bzero.
- */
-#define egg_bzero(dest, n)	egg_memset(dest, 0, n)
-
-#endif	/* !__EGG_COMPAT_MEMSET_H */
Index: eggdrop1.7/src/compat/strcasecmp.c
diff -u eggdrop1.7/src/compat/strcasecmp.c:1.3 eggdrop1.7/src/compat/strcasecmp.c:1.4
--- eggdrop1.7/src/compat/strcasecmp.c:1.3	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/compat/strcasecmp.c	Wed Oct 10 05:44:04 2001
@@ -1,7 +1,7 @@
 /*
  * strcasecmp.c -- provides strcasecmp() and strncasecmp if necessary.
  *
- * $Id: strcasecmp.c,v 1.3 2001/10/10 01:20:10 ite Exp $
+ * $Id: strcasecmp.c,v 1.4 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -23,7 +23,6 @@
  */
 
 #include "../main.h"
-#include "memcpy.h"
 
 #ifndef HAVE_STRCASECMP
 int egg_strcasecmp(const char *s1, const char *s2)
Index: eggdrop1.7/src/dcc.c
diff -u eggdrop1.7/src/dcc.c:1.55 eggdrop1.7/src/dcc.c:1.56
--- eggdrop1.7/src/dcc.c:1.55	Thu Oct  4 17:15:19 2001
+++ eggdrop1.7/src/dcc.c	Wed Oct 10 05:44:03 2001
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.55 2001/10/04 22:15:19 stdarg Exp $
+ * $Id: dcc.c,v 1.56 2001/10/10 10:44:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -365,18 +365,13 @@
   sprintf(buf, "bot*  waited %lus", now - dcc[idx].timeval);
 }
 
-static int expmem_dcc_bot_(void *x)
-{
-  return sizeof(struct bot_info);
-}
-
 static void free_dcc_bot_(int n, void *x)
 {
   if (dcc[n].type == &DCC_BOT) {
     unvia(n, findbot(dcc[n].nick));
     rembot(dcc[n].nick);
   }
-  nfree(x);
+  free(x);
 }
 
 struct dcc_table DCC_BOT_NEW =
@@ -388,7 +383,6 @@
   &bot_timeout,
   timeout_dcc_bot_new,
   display_dcc_bot_new,
-  expmem_dcc_bot_,
   free_dcc_bot_,
   NULL
 };
@@ -475,7 +469,6 @@
   NULL,
   NULL,
   display_dcc_bot,
-  expmem_dcc_bot_,
   free_dcc_bot_,
   NULL
 };
@@ -489,7 +482,6 @@
   &connect_timeout,
   failed_link,
   display_dcc_fork_bot,
-  expmem_dcc_bot_,
   free_dcc_bot_,
   NULL
 };
@@ -541,9 +533,9 @@
   /* Check for MD5 digest from remote _bot_. <cybah> */
   if ((atr & USER_BOT) && !egg_strncasecmp(buf, "digest ", 7)) {
     if(dcc_bot_check_digest(idx, buf+7)) {
-      nfree(dcc[idx].u.chat);
+      free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      dcc[idx].u.bot = get_data_ptr(sizeof(struct bot_info));
+      malloc_memset(dcc[idx].u.bot, 0, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
@@ -561,10 +553,9 @@
 
   if (u_pass_match(dcc[idx].user, buf)) {
     if (atr & USER_BOT) {
-      nfree(dcc[idx].u.chat);
+      free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      dcc[idx].u.bot = get_data_ptr(sizeof(struct bot_info));
-
+      malloc_memset(dcc[idx].u.bot, 0, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
@@ -572,10 +563,8 @@
       /* Log entry for successful login -slennox 3/28/1999 */
       putlog(LOG_MISC, "*", _("Logged in: %s (%s/%d)"), dcc[idx].nick,
 	     dcc[idx].host, dcc[idx].port);
-      if (dcc[idx].u.chat->away) {
-	nfree(dcc[idx].u.chat->away);
-	dcc[idx].u.chat->away = NULL;
-      }
+      if (dcc[idx].u.chat->away)
+	free_null(dcc[idx].u.chat->away);
       dcc[idx].type = &DCC_CHAT;
       dcc[idx].status &= ~STAT_CHAT;
       dcc[idx].u.chat->con_flags = (atr & USER_MASTER) ? conmask : 0;
@@ -598,10 +587,8 @@
 	dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
       dcc[idx].user = get_user_by_handle(userlist, dcc[idx].u.chat->away);
       strcpy(dcc[idx].nick, dcc[idx].u.chat->away);
-      nfree(dcc[idx].u.chat->away);
-      nfree(dcc[idx].u.chat->su_nick);
-      dcc[idx].u.chat->away = NULL;
-      dcc[idx].u.chat->su_nick = NULL;
+      free_null(dcc[idx].u.chat->away);
+      free_null(dcc[idx].u.chat->su_nick);
       dcc[idx].type = &DCC_CHAT;
       if (dcc[idx].u.chat->channel < 100000)
 	botnet_send_join_idx(idx, -1);
@@ -635,28 +622,6 @@
   sprintf(buf, "pass  waited %lus", now - dcc[idx].timeval);
 }
 
-static int expmem_dcc_general(void *x)
-{
-  register struct chat_info *p = (struct chat_info *) x;
-  int tot = sizeof(struct chat_info);
-
-  if (p->away)
-    tot += strlen(p->away) + 1;
-  if (p->buffer) {
-    struct msgq *q = p->buffer;
-
-    while (q) {
-      tot += sizeof(struct list_type);
-
-      tot += q->len + 1;
-      q = q->next;
-    }
-  }
-  if (p->su_nick)
-    tot += strlen(p->su_nick) + 1;
-  return tot;
-}
-
 static void kill_dcc_general(int idx, void *x)
 {
   register struct chat_info *p = (struct chat_info *) x;
@@ -667,14 +632,14 @@
 
       for (r = dcc[idx].u.chat->buffer; r; r = q) {
 	q = r->next;
-	nfree(r->msg);
-	nfree(r);
+	free(r->msg);
+	free(r);
       }
     }
     if (p->away) {
-      nfree(p->away);
+      free(p->away);
     }
-    nfree(p);
+    free(p);
   }
 }
 
@@ -760,8 +725,8 @@
     /* They're probably trying to fill up the bot nuke the sods :) */
     for (p = c->buffer; p; p = q) {
       q = p->next;
-      nfree(p->msg);
-      nfree(p);
+      free(p->msg);
+      free(p);
     }
     c->buffer = 0;
     dcc[idx].status &= ~STAT_PAGE;
@@ -778,10 +743,9 @@
     else
       for (q = c->buffer; q->next; q = q->next);
 
-    p = get_data_ptr(sizeof(struct msgq));
-
+    malloc_memset(p, 0, sizeof(struct msgq));
     p->len = l;
-    p->msg = get_data_ptr(l + 1);
+    malloc_memset(p->msg, 0, l + 1);
     p->next = NULL;
     strcpy(p->msg, line);
     if (q == NULL)
@@ -814,7 +778,6 @@
   &password_timeout,
   tout_dcc_chat_pass,
   display_dcc_chat_pass,
-  expmem_dcc_general,
   kill_dcc_general,
   out_dcc_general
 };
@@ -994,7 +957,6 @@
   NULL,
   NULL,
   display_dcc_chat,
-  expmem_dcc_general,
   kill_dcc_general,
   out_dcc_general
 };
@@ -1092,7 +1054,7 @@
   dcc[i].port = port;
   dcc[i].timeval = now;
   strcpy(dcc[i].nick, "*");
-  dcc[i].u.dns->host = get_data_ptr(j + 1);
+  malloc_memset(dcc[i].u.dns->host, 0, 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;
@@ -1198,7 +1160,6 @@
   NULL,
   display_telnet,
   NULL,
-  NULL,
   NULL
 };
 
@@ -1240,16 +1201,6 @@
   sprintf(buf, "wait  duplicate?");
 }
 
-static int expmem_dupwait(void *x)
-{
-  register struct dupwait_info *p = (struct dupwait_info *) x;
-  int tot = sizeof(struct dupwait_info);
-
-  if (p && p->chat && DCC_CHAT.expmem)
-    tot += DCC_CHAT.expmem(p->chat);
-  return tot;
-}
-
 static void kill_dupwait(int idx, void *x)
 {
   register struct dupwait_info *p = (struct dupwait_info *) x;
@@ -1257,7 +1208,7 @@
   if (p) {
     if (p->chat && DCC_CHAT.kill)
       DCC_CHAT.kill(idx, p->chat);
-    nfree(p);
+    free(p);
   }
 }
 
@@ -1270,7 +1221,6 @@
   &dupwait_timeout,
   timeout_dupwait,
   display_dupwait,
-  expmem_dupwait,
   kill_dupwait,
   NULL
 };
@@ -1368,7 +1318,7 @@
 
       ci = dcc[idx].u.chat;
       dcc[idx].type = &DCC_DUPWAIT;
-      dcc[idx].u.dupwait = get_data_ptr(sizeof(struct dupwait_info));
+      malloc_memset(dcc[idx].u.dupwait, 0, sizeof(struct dupwait_info));
       dcc[idx].u.dupwait->chat = ci;
       dcc[idx].u.dupwait->atr = atr;
       return;
@@ -1413,7 +1363,7 @@
     struct chat_info *ci;
 
     ci = dcc[idx].u.dupwait->chat;
-    nfree(dcc[idx].u.dupwait);
+    free(dcc[idx].u.dupwait);
     dcc[idx].u.chat = ci;
   }
   dcc[idx].type = &DCC_CHAT_PASS;
@@ -1435,7 +1385,7 @@
     struct chat_info *ci;
 
     ci = dcc[idx].u.chat;
-    dcc[idx].u.file = get_data_ptr(sizeof(struct file_info));
+    malloc_memset(dcc[idx].u.file, 0, sizeof(struct file_info));
     dcc[idx].u.file->chat = ci;
   }
 
@@ -1496,7 +1446,6 @@
   &password_timeout,
   timeout_dcc_telnet_id,
   display_dcc_telnet_id,
-  expmem_dcc_general,
   kill_dcc_general,
   out_dcc_general
 };
@@ -1666,7 +1615,6 @@
   &password_timeout,
   tout_dcc_telnet_new,
   display_dcc_telnet_new,
-  expmem_dcc_general,
   kill_dcc_general,
   out_dcc_general
 };
@@ -1680,7 +1628,6 @@
   &password_timeout,
   tout_dcc_telnet_pw,
   display_dcc_telnet_pw,
-  expmem_dcc_general,
   kill_dcc_general,
   out_dcc_general
 };
@@ -1719,7 +1666,7 @@
 
     old_other = dcc[idx].u.script->u.other;
     dcc[idx].type = dcc[idx].u.script->type;
-    nfree(dcc[idx].u.script);
+    free(dcc[idx].u.script);
     dcc[idx].u.other = old_other;
     if (dcc[idx].type == &DCC_SOCKET) {
       /* Kill the whole thing off */
@@ -1756,7 +1703,7 @@
   dcc[idx].type->flags = oldflags;
   old = dcc[idx].u.script->u.other;
   dcc[idx].type = dcc[idx].u.script->type;
-  nfree(dcc[idx].u.script);
+  free(dcc[idx].u.script);
   dcc[idx].u.other = old;
   /* Then let it fall thru to the real one */
   if (dcc[idx].type && dcc[idx].type->eof)
@@ -1774,23 +1721,13 @@
   sprintf(buf, "scri  %s", dcc[idx].u.script->command);
 }
 
-static int expmem_dcc_script(void *x)
-{
-  register struct script_info *p = (struct script_info *) x;
-  int tot = sizeof(struct script_info);
-
-  if (p->type && p->u.other)
-    tot += p->type->expmem(p->u.other);
-  return tot;
-}
-
 static void kill_dcc_script(int idx, void *x)
 {
   register struct script_info *p = (struct script_info *) x;
 
   if (p->type && p->u.other)
     p->type->kill(idx, p->u.other);
-  nfree(p);
+  free(p);
 }
 
 static void out_dcc_script(int idx, char *buf, void *x)
@@ -1812,7 +1749,6 @@
   NULL,
   NULL,
   display_dcc_script,
-  expmem_dcc_script,
   kill_dcc_script,
   out_dcc_script
 };
@@ -1842,7 +1778,6 @@
   NULL,
   display_dcc_socket,
   NULL,
-  NULL,
   NULL
 };
 
@@ -1861,7 +1796,6 @@
   NULL,
   display_dcc_lost,
   NULL,
-  NULL,
   NULL
 };
 
@@ -1903,7 +1837,6 @@
   NULL,
   display_dcc_identwait,
   NULL,
-  NULL,
   NULL
 };
 
@@ -1963,7 +1896,6 @@
   eof_dcc_ident,
   display_dcc_ident,
   NULL,
-  NULL,
   NULL
 };
 
@@ -2026,8 +1958,7 @@
   sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);
 
   dcc[i].type = &DCC_TELNET_ID;
-  dcc[i].u.chat = get_data_ptr(sizeof(struct chat_info));
-  egg_bzero(dcc[i].u.chat, sizeof(struct chat_info));
+  malloc_memset(dcc[i].u.chat, 0, 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.36 eggdrop1.7/src/dccutil.c:1.37
--- eggdrop1.7/src/dccutil.c:1.36	Sat Oct  6 23:02:54 2001
+++ eggdrop1.7/src/dccutil.c	Wed Oct 10 05:44:04 2001
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.36 2001/10/07 04:02:54 stdarg Exp $
+ * $Id: dccutil.c,v 1.37 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -55,33 +55,20 @@
   if (max_dcc < 1)
     max_dcc = 1;
   if (dcc)
-    dcc = nrealloc(dcc, sizeof(struct dcc_t) * max_dcc);
+    dcc = realloc(dcc, sizeof(struct dcc_t) * max_dcc);
   else
-    dcc = nmalloc(sizeof(struct dcc_t) * max_dcc);
+    dcc = malloc(sizeof(struct dcc_t) * max_dcc);
 
   MAXSOCKS = max_dcc + 10;
   if (socklist)
-    socklist = (sock_list *) nrealloc((void *) socklist,
+    socklist = (sock_list *) realloc((void *) socklist,
 				      sizeof(sock_list) * MAXSOCKS);
   else
-    socklist = (sock_list *) nmalloc(sizeof(sock_list) * MAXSOCKS);
+    socklist = (sock_list *) malloc(sizeof(sock_list) * MAXSOCKS);
   for (; osock < MAXSOCKS; osock++)
     socklist[osock].flags = SOCK_UNUSED;
 }
 
-int expmem_dccutil()
-{
-  int tot, i;
-
-  tot = sizeof(struct dcc_t) * max_dcc + sizeof(sock_list) * MAXSOCKS;
-
-  for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && dcc[i].type->expmem)
-      tot += dcc[i].type->expmem(dcc[i].u.other);
-  }
-  return tot;
-}
-
 
 /* Replace \n with \r\n */
 char *add_cr(char *buf)
@@ -267,8 +254,8 @@
   if (dcc[n].type && dcc[n].type->kill)
     dcc[n].type->kill(n, dcc[n].u.other);
   else if (dcc[n].u.other)
-    nfree(dcc[n].u.other);
-  egg_bzero(&dcc[n], sizeof(struct dcc_t));
+    free(dcc[n].u.other);
+  memset(&dcc[n], 0, sizeof(struct dcc_t));
 
   dcc[n].sock = (-1);
   dcc[n].type = &DCC_LOST;
@@ -286,12 +273,12 @@
   if (dcc[n].type && dcc[n].type->kill)
     dcc[n].type->kill(n, dcc[n].u.other);
   else if (dcc[n].u.other)
-    nfree(dcc[n].u.other);
+    free(dcc[n].u.other);
   dcc_total--;
   if (n < dcc_total)
-    egg_memcpy(&dcc[n], &dcc[dcc_total], sizeof(struct dcc_t));
+    memcpy(&dcc[n], &dcc[dcc_total], sizeof(struct dcc_t));
   else
-    egg_bzero(&dcc[n], sizeof(struct dcc_t)); /* drummer */
+    memset(&dcc[n], 0, sizeof(struct dcc_t)); /* drummer */
 }
 
 /* Clean up sockets that were just left for dead.
@@ -361,8 +348,7 @@
     }
   }
   dprintf(idx, "You're not away any more.\n");
-  nfree(dcc[idx].u.chat->away);
-  dcc[idx].u.chat->away = NULL;
+  free_null(dcc[idx].u.chat->away);
   check_tcl_away(botnetnick, dcc[idx].sock, NULL);
 }
 
@@ -377,9 +363,8 @@
     return;
   }
   if (dcc[idx].u.chat->away != NULL)
-    nfree(dcc[idx].u.chat->away);
-  dcc[idx].u.chat->away = (char *) nmalloc(strlen(s) + 1);
-  strcpy(dcc[idx].u.chat->away, s);
+    free(dcc[idx].u.chat->away);
+  malloc_strcpy(dcc[idx].u.chat->away, s);
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(-1, dcc[idx].u.chat->channel,
 		"*** %s is now away: %s\n", dcc[idx].nick, s);
@@ -391,24 +376,6 @@
   check_tcl_away(botnetnick, dcc[idx].sock, s);
 }
 
-/* This helps the memory debugging
- */
-void *_get_data_ptr(int size, char *file, int line)
-{
-  char *p;
-#ifdef DEBUG_MEM
-  char x[1024];
-
-  p = strrchr(file, '/');
-  egg_snprintf(x, sizeof x, "dccutil.c:%s", p ? p + 1 : file);
-  p = n_malloc(size, x, line);
-#else
-  p = nmalloc(size);
-#endif
-  egg_bzero(p, size);
-  return p;
-}
-
 /* Make a password, 10-15 random letters and digits
  */
 void makepass(char *s)
@@ -427,9 +394,9 @@
   while (p && c < (ci->max_line)) {
     ci->current_lines--;
     tputs(dcc[idx].sock, p->msg, p->len);
-    nfree(p->msg);
+    free(p->msg);
     o = p->next;
-    nfree(p);
+    free(p);
     p = o;
     c++;
   }
@@ -450,13 +417,11 @@
   if (dcc_total == max_dcc)
     return -1;
   dcc_total++;
-  egg_bzero((char *) &dcc[i], sizeof(struct dcc_t));
+  memset((char *) &dcc[i], 0, sizeof(struct dcc_t));
 
   dcc[i].type = type;
-  if (xtra_size) {
-    dcc[i].u.other = nmalloc(xtra_size);
-    egg_bzero(dcc[i].u.other, xtra_size);
-  }
+  if (xtra_size)
+    malloc_memset(dcc[i].u.other, 0, xtra_size);
   return i;
 }
 
@@ -467,16 +432,12 @@
   /* Free old structure. */
   if (dcc[i].type && dcc[i].type->kill)
     dcc[i].type->kill(i, dcc[i].u.other);
-  else if (dcc[i].u.other) {
-    nfree(dcc[i].u.other);
-    dcc[i].u.other = NULL;
-  }
+  else if (dcc[i].u.other)
+    free_null(dcc[i].u.other);
 
   dcc[i].type = type;
-  if (xtra_size) {
-    dcc[i].u.other = nmalloc(xtra_size);
-    egg_bzero(dcc[i].u.other, xtra_size);
-  }
+  if (xtra_size)
+    malloc_memset(dcc[i].u.other, 0, 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.24 eggdrop1.7/src/dns.c:1.25
--- eggdrop1.7/src/dns.c:1.24	Fri Aug 10 18:51:20 2001
+++ eggdrop1.7/src/dns.c	Wed Oct 10 05:44:04 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.24 2001/08/10 23:51:20 ite Exp $
+ * $Id: dns.c,v 1.25 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Written by Fabian Knittel <fknittel at gmx.de>
@@ -70,31 +70,16 @@
   sprintf(buf, "dns   waited %lus", now - dcc[idx].timeval);
 }
 
-static int expmem_dcc_dnswait(void *x)
-{
-  register struct dns_info *p = (struct dns_info *) x;
-  int size = 0;
-
-  if (p) {
-    size = sizeof(struct dns_info);
-    if (p->host)
-      size += strlen(p->host) + 1;
-    if (p->cbuf)
-      size += strlen(p->cbuf) + 1;
-  }
-  return size;
-}
-
 static void kill_dcc_dnswait(int idx, void *x)
 {
   register struct dns_info *p = (struct dns_info *) x;
 
   if (p) {
     if (p->host)
-      nfree(p->host);
+      free(p->host);
     if (p->cbuf)
-      nfree(p->cbuf);
-    nfree(p);
+      free(p->cbuf);
+    free(p);
   }
 }
 
@@ -107,7 +92,6 @@
   0,
   0,
   display_dcc_dnswait,
-  expmem_dcc_dnswait,
   kill_dcc_dnswait,
   0
 };
@@ -129,8 +113,8 @@
         (dcc[idx].u.dns->dns_type == RES_HOSTBYIP) &&
         (!egg_strcasecmp(dcc[idx].u.dns->host, ip))) {
 debug3("|DNS| idx: %d, dcchostbyip: %s is %s", idx, ip, hostn);
-      nfree(dcc[idx].u.dns->host);
-      dcc[idx].u.dns->host = get_data_ptr(strlen(hostn) + 1);
+      free(dcc[idx].u.dns->host);
+      malloc_memset(dcc[idx].u.dns->host, 0, strlen(hostn) + 1);
       strcpy(dcc[idx].u.dns->host, hostn);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);
@@ -152,8 +136,8 @@
         (dcc[idx].u.dns->dns_type == RES_IPBYHOST) &&
         !egg_strcasecmp(dcc[idx].u.dns->host, hostn)) {
 debug3("|DNS| idx: %d, dccipbyhost: %s is %s", idx, ip, hostn);
-      nfree(dcc[idx].u.dns->host);
-      dcc[idx].u.dns->host = get_data_ptr(strlen(ip) + 1);
+      free(dcc[idx].u.dns->host);
+      malloc_memset(dcc[idx].u.dns->host, 0, strlen(ip) + 1);
       strcpy(dcc[idx].u.dns->host, ip);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);
@@ -163,20 +147,13 @@
   }
 }
 
-static int dns_dccexpmem(void *other)
-{
-  return 0;
-}
-
 devent_type DNS_DCCEVENT_HOSTBYIP = {
   "DCCEVENT_HOSTBYIP",
-  dns_dccexpmem,
   dns_dcchostbyip
 };
 
 devent_type DNS_DCCEVENT_IPBYHOST = {
   "DCCEVENT_IPBYHOST",
-  dns_dccexpmem,
   dns_dccipbyhost
 };
 
@@ -194,8 +171,7 @@
     }
   }
 
-  de = nmalloc(sizeof(devent_t));
-  egg_bzero(de, sizeof(devent_t));
+  malloc_memset(de, 0, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -203,8 +179,7 @@
 
   de->type = &DNS_DCCEVENT_IPBYHOST;
   de->lookup = RES_IPBYHOST;
-  de->hostname = nmalloc(strlen(hostn) + 1);
-  strcpy(de->hostname, hostn);
+  malloc_strcpy(de->hostname, hostn);
 
   /* Send request. */
   dns_ipbyhost(hostn);
@@ -223,8 +198,7 @@
     }
   }
 
-  de = nmalloc(sizeof(devent_t));
-  egg_bzero(de, sizeof(devent_t));
+  malloc_memset(de, 0, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -232,9 +206,7 @@
 
   de->type = &DNS_DCCEVENT_HOSTBYIP;
   de->lookup = RES_HOSTBYIP;
-  
-  de->hostname = nmalloc(strlen(ip) + 1);
-  strcpy(de->hostname, ip);
+  malloc_strcpy(de->hostname, ip);
 
   /* Send request. */
   dns_hostbyip(ip);
@@ -254,36 +226,19 @@
     putlog(LOG_MISC, "*", _("Tcl error [%s]: %s"), tclinfo->proc, interp->result);
 
   /* Free the memory. It will be unused after this event call. */
-  nfree(tclinfo->proc);
+  free(tclinfo->proc);
   if (tclinfo->paras)
-    nfree(tclinfo->paras);
-  nfree(tclinfo);
-}
-
-static int dns_tclexpmem(void *other)
-{
-  devent_tclinfo_t *tclinfo = (devent_tclinfo_t *) other;
-  int l = 0;
-
-  if (tclinfo) {
-    l = sizeof(devent_tclinfo_t);
-    if (tclinfo->proc)
-      l += strlen(tclinfo->proc) + 1;
-    if (tclinfo->paras)
-      l += strlen(tclinfo->paras) + 1;
-  }
-  return l;
+    free(tclinfo->paras);
+  free(tclinfo);
 }
 
 devent_type DNS_TCLEVENT_HOSTBYIP = {
   "TCLEVENT_HOSTBYIP",
-  dns_tclexpmem,
   dns_tcl_iporhostres
 };
 
 devent_type DNS_TCLEVENT_IPBYHOST = {
   "TCLEVENT_IPBYHOST",
-  dns_tclexpmem,
   dns_tcl_iporhostres
 };
 
@@ -292,8 +247,7 @@
   devent_t *de;
   devent_tclinfo_t *tclinfo;
 
-  de = nmalloc(sizeof(devent_t));
-  egg_bzero(de, sizeof(devent_t));
+  malloc_memset(de, 0, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -301,17 +255,14 @@
 
   de->type = &DNS_TCLEVENT_IPBYHOST;
   de->lookup = RES_IPBYHOST;
-  de->hostname = nmalloc(strlen(hostn) + 1);
-  strcpy(de->hostname, hostn);
+  malloc_strcpy(de->hostname, hostn);
 
   /* Store additional data. */
-  tclinfo = nmalloc(sizeof(devent_tclinfo_t));
-  tclinfo->proc = nmalloc(strlen(proc) + 1);
-  strcpy(tclinfo->proc, proc);
-  if (paras) {
-    tclinfo->paras = nmalloc(strlen(paras) + 1);
-    strcpy(tclinfo->paras, paras);
-  } else
+  tclinfo = malloc(sizeof(devent_tclinfo_t));
+  malloc_strcpy(tclinfo->proc, proc);
+  if (paras)
+    malloc_strcpy(tclinfo->paras, paras);
+  else
     tclinfo->paras = NULL;
   de->other = tclinfo;
 
@@ -324,8 +275,7 @@
   devent_t *de;
   devent_tclinfo_t *tclinfo;
 
-  de = nmalloc(sizeof(devent_t));
-  egg_bzero(de, sizeof(devent_t));
+  malloc_memset(de, 0, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -333,17 +283,14 @@
 
   de->type = &DNS_TCLEVENT_HOSTBYIP;
   de->lookup = RES_HOSTBYIP;
-  de->hostname = nmalloc(strlen(ip) + 1);
-  strcpy(de->hostname, ip);
+  malloc_strcpy(de->hostname, ip);
 
   /* Store additional data. */
-  tclinfo = nmalloc(sizeof(devent_tclinfo_t));
-  tclinfo->proc = nmalloc(strlen(proc) + 1);
-  strcpy(tclinfo->proc, proc);
-  if (paras) {
-    tclinfo->paras = nmalloc(strlen(paras) + 1);
-    strcpy(tclinfo->paras, paras);
-  } else
+  tclinfo = malloc(sizeof(devent_tclinfo_t));
+  malloc_strcpy(tclinfo->proc, proc);
+  if (paras)
+    malloc_strcpy(tclinfo->paras, paras);
+  else
     tclinfo->paras = NULL;
   de->other = tclinfo;
 
@@ -356,21 +303,6 @@
  *    Event functions
  */
 
-inline static int dnsevent_expmem(void)
-{
-  devent_t *de;
-  int tot = 0;
-  
-  for (de = dns_events; de; de = de->next) {
-    tot += sizeof(devent_t);
-    if (de->hostname)
-      tot += strlen(de->hostname) + 1;
-    if (de->type && de->type->expmem)
-      tot += de->type->expmem(de->other);
-  }
-  return tot;
-}
-
 void call_hostbyip(char *ip, char *hostn, int ok)
 {
   devent_t *de = dns_events, *ode = NULL, *nde = NULL;
@@ -393,8 +325,8 @@
 	putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
 	       (de->type && de->type->name) ? de->type->name : "<empty>");
       if (de->hostname)
-          nfree(de->hostname);
-      nfree(de);
+          free(de->hostname);
+      free(de);
       de = ode;
     }
     ode = de;
@@ -425,8 +357,8 @@
 	       (de->type && de->type->name) ? de->type->name : "<empty>");
 
       if (de->hostname)
-	nfree(de->hostname);
-      nfree(de);
+	free(de->hostname);
+      free(de);
       de = ode;
     }
     ode = de;
@@ -532,16 +464,6 @@
 #endif
 
 /*
- *   Misc functions
- */
-
-int expmem_dns(void)
-{
-  return dnsevent_expmem();
-}
-
-
-/*
  *   Tcl functions
  */
 
@@ -566,11 +488,10 @@
     /* Create a string with a leading space out of all provided
      * additional parameters.
      */
-    paras = nmalloc(1);
-    paras[0] = 0;
+    malloc_memset(paras, 0, 1);
     for (p = 3; p < argc; p++) {
       l += strlen(argv[p]) + 1;
-      paras = nrealloc(paras, l + 1);
+      paras = realloc(paras, l + 1);
       strcat(paras, " ");
       strcat(paras, argv[p]);
     }
@@ -585,7 +506,7 @@
   else
     tcl_dnsipbyhost(argv[1], argv[2], paras);
   if (paras)
-    nfree(paras);
+    free(paras);
   return TCL_OK;
 }
 
@@ -607,12 +528,11 @@
 #ifdef IPV6
     struct sockaddr_in6 in6;
 #endif
-    char *origname;
+    char *origname = NULL;
 
     if (egg_inet_pton(AF_INET, ip, &in.sin_addr)) {
 debug1("|DNS| adns_dns_hostbyip(\"%s\") (IPv4)", ip);
-	origname = nmalloc(strlen(ip) + 1);
-	strcpy(origname, ip);
+	malloc_strcpy(origname, ip);
 	in.sin_family = AF_INET;
 	in.sin_port = 0;
 	r = adns_submit_reverse(ads, (struct sockaddr *) &in,
@@ -624,8 +544,7 @@
 #ifdef IPV6
     } else if (egg_inet_pton(AF_INET6, ip, &in6.sin6_addr)) {
 debug1("|DNS| adns_dns_hostbyip(\"%s\") (IPv6)", ip);
-	origname = nmalloc(strlen(ip) + 1);
-	strcpy(origname, ip);
+	malloc_strcpy(origname, ip);
 	in6.sin6_family = AF_INET6;
 	in6.sin6_port = 0;
 	r = adns_submit_reverse(ads, (struct sockaddr *) &in6,
@@ -660,10 +579,9 @@
 	call_ipbyhost(host, host, 1);
     } else {
 	char *p;
-	char *origname;
+	char *origname = NULL;
 	int type, r;
-	origname = nmalloc(strlen(host) + 1);
-	strcpy(origname, host);
+	malloc_strcpy(origname, host);
 	if (!egg_strncasecmp("ipv6%", host, 5)) {
 #ifdef IPV6
 	    type = adns_r_addr6;
Index: eggdrop1.7/src/dns.h
diff -u eggdrop1.7/src/dns.h:1.7 eggdrop1.7/src/dns.h:1.8
--- eggdrop1.7/src/dns.h:1.7	Thu Jul 26 12:04:33 2001
+++ eggdrop1.7/src/dns.h	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * dns.h
  *   stuff used by dns.c
  *
- * $Id: dns.h,v 1.7 2001/07/26 17:04:33 drummer Exp $
+ * $Id: dns.h,v 1.8 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Written by Fabian Knittel <fknittel at gmx.de>
@@ -29,7 +29,6 @@
 
 typedef struct {
   char *name;
-  int  (*expmem)(void *);
   void (*event)(char *, char *, int, void *);
 } devent_type;
 
Index: eggdrop1.7/src/eggdrop.h
diff -u eggdrop1.7/src/eggdrop.h:1.42 eggdrop1.7/src/eggdrop.h:1.43
--- eggdrop1.7/src/eggdrop.h:1.42	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/eggdrop.h	Wed Oct 10 05:44:04 2001
@@ -4,7 +4,7 @@
  *
  *   IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  *
- * $Id: eggdrop.h,v 1.42 2001/10/10 01:20:10 ite Exp $
+ * $Id: eggdrop.h,v 1.43 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -84,7 +84,6 @@
 #  include <libintl.h>
 #  define _(x) gettext(x)
 
-
 /* Have to use a weird way to make the compiler error out cos not all
  * compilers support #error or error
  */
@@ -160,13 +159,35 @@
 #endif
 
 
-/*
- *    Handy aliases for memory tracking and core dumps
+/* Macros for commonly used commands.
  */
 
-#define nmalloc(x)	n_malloc((x),__FILE__,__LINE__)
-#define nrealloc(x,y)	n_realloc((x),(y),__FILE__,__LINE__)
-#define nfree(x)	n_free((x),__FILE__,__LINE__)
+#define free_null(ptr)							\
+  if (ptr) {								\
+    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'
+ * will be overwritten.
+ */
+#define malloc_strcpy(target, entry)					\
+do {									\
+  if (entry) {								\
+    (target) = realloc((target), strlen(entry) + 1);			\
+    strcpy((target), (entry));						\
+  } else								\
+    free_null(target);							\
+} while (0)
 
 #ifdef DEBUG_CONTEXT
 #  define Context		eggContext(__FILE__, __LINE__, NULL)
@@ -185,13 +206,6 @@
 #  define Assert(expr)	do {	} while (0)
 #endif
 
-#ifndef COMPILING_MEM
-#  undef malloc
-#  define malloc(x)	dont_use_old_malloc(x)
-#  undef free
-#  define free(x)	dont_use_old_free(x)
-#endif /* !COMPILING_MEM */
-
 /* 32 bit type */
 #if (SIZEOF_INT == 4)
 typedef unsigned int		u_32bit_t;
@@ -236,7 +250,6 @@
   int *timeout_val;
   void (*timeout) ();
   void (*display) (int, char *);
-  int (*expmem) (void *);
   void (*kill) (int, void *);
   void (*output) (int, char *, void *);
   void (*outdone) (int);
Index: eggdrop1.7/src/egglib/hash_table.c
diff -u eggdrop1.7/src/egglib/hash_table.c:1.1 eggdrop1.7/src/egglib/hash_table.c:1.2
--- eggdrop1.7/src/egglib/hash_table.c:1.1	Wed Jul 25 15:32:02 2001
+++ eggdrop1.7/src/egglib/hash_table.c	Wed Oct 10 05:44:05 2001
@@ -11,8 +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);
-	ht = (hash_table_t *)malloc(size);
-	memset(ht, 0, size);
+	malloc_memset(ht, 0, size);
 
 	if (alg) ht->hash = alg;
 	else {
Index: eggdrop1.7/src/egglib/linked_list.c
diff -u eggdrop1.7/src/egglib/linked_list.c:1.1 eggdrop1.7/src/egglib/linked_list.c:1.2
--- eggdrop1.7/src/egglib/linked_list.c:1.1	Wed Jul 25 15:32:02 2001
+++ eggdrop1.7/src/egglib/linked_list.c	Wed Oct 10 05:44:05 2001
@@ -54,10 +54,11 @@
 {
 	linked_list_cursor_t *c;
 
-	if (cursor) c = cursor;
-	else c = (linked_list_cursor_t *)malloc(sizeof(*c));
+	if (cursor)
+		c = cursor;
+	else
+		malloc_memset(c, 0, sizeof(*c));
 
-	memset(c, 0, sizeof(*c));
 	c->list = list;
 	c->node = list->head;
 	if (cursor) c->flags = LINKED_LIST_STATIC;
Index: eggdrop1.7/src/flags.c
diff -u eggdrop1.7/src/flags.c:1.19 eggdrop1.7/src/flags.c:1.20
--- eggdrop1.7/src/flags.c:1.19	Sat Aug 25 22:16:43 2001
+++ eggdrop1.7/src/flags.c	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * flags.c -- handles:
  *   all the flag matching/conversion functions in one neat package :)
  *
- * $Id: flags.c,v 1.19 2001/08/26 03:16:43 stdarg Exp $
+ * $Id: flags.c,v 1.20 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -342,10 +342,10 @@
     else
       return;			/* We dont actually want any..huh? */
   }
-  egg_bzero(plus, sizeof(struct flag_record));
+  memset(plus, 0, sizeof(struct flag_record));
 
   if (minus)
-    egg_bzero(minus, sizeof(struct flag_record));
+    memset(minus, 0, sizeof(struct flag_record));
 
   plus->match = FR_OR;		/* Default binding type OR */
   while (*string) {
@@ -634,9 +634,7 @@
 	break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
-      cr = user_malloc(sizeof(struct chanuserrec));
-      egg_bzero(cr, sizeof(struct chanuserrec));
-
+      malloc_memset(cr, 0, sizeof(struct chanuserrec));
       cr->next = u->chanrec;
       u->chanrec = cr;
       strncpyz(cr->channel, chname, sizeof cr->channel);
@@ -717,16 +715,16 @@
   struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
 
   fr.bot = e->u.ulong;
-  e->u.list = user_malloc(sizeof(struct list_type));
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc (build_flags (x, &fr, NULL) + 1);
+  e->u.list->extra = malloc(build_flags(x, &fr, NULL) + 1);
   strcpy(e->u.list->extra, x);
   return 1;
 }
 
 static int botfl_kill(struct user_entry *e)
 {
-  nfree(e);
+  free(e);
   return 1;
 }
 
@@ -793,11 +791,6 @@
   return TCL_OK;
 }
 
-static int botfl_expmem(struct user_entry *e)
-{
-  return 0;
-}
-
 static void botfl_display(int idx, struct user_entry *e)
 {
   struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
@@ -821,7 +814,6 @@
   botfl_set,
   botfl_tcl_get,
   botfl_tcl_set,
-  botfl_expmem,
   botfl_display,
   "BOTFL"
 };
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.78 eggdrop1.7/src/main.c:1.79
--- eggdrop1.7/src/main.c:1.78	Thu Sep 27 22:15:34 2001
+++ eggdrop1.7/src/main.c	Wed Oct 10 05:44:04 2001
@@ -5,7 +5,7 @@
  *   command line arguments
  *   context and assert debugging
  *
- * $Id: main.c,v 1.78 2001/09/28 03:15:34 stdarg Exp $
+ * $Id: main.c,v 1.79 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -176,23 +176,6 @@
   }
 }
 
-
-int expmem_chanprog(), expmem_users(), expmem_misc(), expmem_dccutil(),
- expmem_botnet(), expmem_tcl(), expmem_tclhash(), expmem_net(),
- expmem_modules(int), expmem_tcldcc();
-
-/* For mem.c : calculate memory we SHOULD be using
- */
-int expected_memory(void)
-{
-  int tot;
-
-  tot = expmem_chanprog() + expmem_users() + expmem_misc() +
-    expmem_dccutil() + expmem_botnet() + expmem_tcl() + expmem_tclhash() +
-    expmem_net() + expmem_modules(0) + expmem_tcldcc();
-  return tot;
-}
-
 static void check_expired_dcc()
 {
   int i;
@@ -299,7 +282,7 @@
 	    (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
     tell_dcc(-x);
     dprintf(-x, "\n");
-    debug_mem_to_dcc(-x);
+    tell_netdebug(-x);
     killsock(x);
     close(x);
     putlog(LOG_MISC, "*", "* Wrote DEBUG");
@@ -530,10 +513,9 @@
       tell_verbose_status(DP_STDOUT);
       do_module_report(DP_STDOUT, 0, "server");
       do_module_report(DP_STDOUT, 0, "channels");
-      tell_mem_status_dcc(DP_STDOUT);
     }
   }
-  egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm));
+  memcpy(&nowtm, localtime(&now), sizeof(struct tm));
   if (nowtm.tm_min != lastmin) {
     int i = 0;
 
@@ -669,8 +651,8 @@
 
 #include "mod/static.h"
 #endif
-int init_mem(), init_dcc_max(), init_userent(), init_misc(),
- init_net(), init_modules(), init_tcl(int, char **);
+int init_dcc_max(), init_userent(), init_misc(), init_net(),
+ init_modules(), init_tcl(int, char **);
 void botnet_init();
 
 void patch(const char *str)
@@ -702,7 +684,7 @@
   struct sigaction sv;
   struct chanset_t *chan;
 
-#ifdef DEBUG_MEM
+#ifdef DEBUG_ASSERT
   /* Make sure it can write core, if you make debug. Else it's pretty
    * useless (dw)
    */
@@ -774,10 +756,9 @@
   /* Initialize variables and stuff */
   now = time(NULL);
   chanset = NULL;
-  egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm));
+  memcpy(&nowtm, localtime(&now), sizeof(struct tm));
   lastmin = nowtm.tm_min;
   srandom(now % (getpid() + getppid()));
-  init_mem();
   if (argc > 1)
     for (i = 1; i < argc; i++)
       do_arg(argv[i]);
Index: eggdrop1.7/src/main.h
diff -u eggdrop1.7/src/main.h:1.19 eggdrop1.7/src/main.h:1.20
--- eggdrop1.7/src/main.h:1.19	Mon Aug 13 15:47:52 2001
+++ eggdrop1.7/src/main.h	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * main.h
  *   include file to include most other include files
  *
- * $Id: main.h,v 1.19 2001/08/13 20:47:52 guppy Exp $
+ * $Id: main.h,v 1.20 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -71,7 +71,7 @@
 
 /* For pre Tcl7.5p1 versions */
 #ifndef HAVE_TCL_FREE
-#  define Tcl_Free(x) n_free(x, "", 0)
+#  define Tcl_Free(x) free(x)
 #endif
 
 /* For pre7.6 Tcl versions */
Index: eggdrop1.7/src/match.c
diff -u eggdrop1.7/src/match.c:1.5 eggdrop1.7/src/match.c:1.6
--- eggdrop1.7/src/match.c:1.5	Sun Jan 30 13:26:20 2000
+++ eggdrop1.7/src/match.c	Wed Oct 10 05:44:04 2001
@@ -3,7 +3,7 @@
  *   wildcard matching functions
  *   (rename to reg.c for ircII)
  * 
- * $Id: match.c,v 1.5 2000/01/30 19:26:20 fabian Exp $
+ * $Id: match.c,v 1.6 2001/10/10 10:44:04 tothwolf Exp $
  */
 /* 
  * Once this code was working, I added support for % so that I could
@@ -13,7 +13,7 @@
  * though, for sanity reasons).
  * 
  * This code would not have been possible without the prior work and
- * suggestions of various sourced.  Special thanks to Robey for
+ * suggestions of various sources.  Special thanks to Robey for
  * all his time/help tracking down bugs and his ever-helpful advice.
  * 
  * 04/09:  Fixed the "*\*" against "*a" bug (caused an endless loop)
@@ -22,94 +22,126 @@
  *     crf at cfox.bchs.uh.edu
  * 
  * I hereby release this code into the public domain
- * 
- */
-
-/* 
- * This will get us around most of the mess and replace the chunk that
- * was removed from the middle of this file.   --+ Dagmar
- */
-/* 
- * You'll also want to grab the rfc1459.c file or change all rfc_*()
- * calls to the standard library call to make this work with ircII
- * derivatives now.
  */
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
-/* Remove the next line to use this in IrcII */
-#define EGGDROP
+/* needed for prototypes ... this is ugly */
+#include "main.h"
 
-/* 
- * Best to leave stuff after this point alone, but go on and change
- * it if you're adventurous...
- */
 
-/* The quoting character -- what overrides wildcards (do not undef) */
+/* The quoting character -- what overrides wildcards */
 #define QUOTE '\\'
 
-/* The "matches ANYTHING" wildcard (do not undef) */
+/* The "matches ANYTHING" wildcard */
 #define WILDS '*'
 
-/* The "matches ANY NUMBER OF NON-SPACE CHARS" wildcard (do not undef) */
+/* The "matches ANY NUMBER OF NON-SPACE CHARS" wildcard */
 #define WILDP '%'
 
-/* The "matches EXACTLY ONE CHARACTER" wildcard (do not undef) */
+/* The "matches EXACTLY ONE CHARACTER" wildcard */
 #define WILDQ '?'
 
-/* The "matches AT LEAST ONE SPACE" wildcard (undef me to disable!) */
+/* The "matches AT LEAST ONE SPACE" wildcard */
 #define WILDT '~'
 
-/* 
- * This makes sure WILDT doesn't get used in in the IrcII version of
- * this code.  If ya wanna live dangerously, you can remove these 3
- * lines, but WARNING: IT WOULD MAKE THIS CODE INCOMPATIBLE WITH THE
- * CURRENT reg.c OF IrcII!!!  Support for ~ is NOT in the reg.c of
- * IrcII, and adding it may cause compatibility problems, especially
- * in scripts.  If you don't think you have to worry about that, go
- * for it!
- */
-#ifndef EGGDROP
-#undef WILDT
-#endif
+/* Changing these is probably counter-productive :) */
+#define UNQUOTED (0x7FFF)
+#define QUOTED   (0x8000)
+#define NOMATCH 0
+#define MATCH ((match+sofar)&UNQUOTED)
+#define MATCH_PER (match+saved+sofar)
+
 
 /* 
- * If you edit below this line and it stops working, don't even THINK
- * about whining to *ME* about it!
+ * wild_match(char *ma, char *na)
+ * 
+ * Features:  Backwards, case-insensitive, ?, *
+ * Best use:  Matching of hostmasks (since they are likely to begin
+ *            with a * rather than end with one).
  */
-
 /* 
- * No problem, you got it wrong anyway, Chris.  You should have gone to
- * uppercase instead of lowercase.  (A really minor mistake)
+ * sofar's high bit is used as a flag of whether or not we are quoting.
+ * The other matchers don't need this because when you're going forward,
+ * you just skip over the quote char.
+ * No "saved" is used to track "%" and no special quoting ability is
+ * needed, so we just have (match+sofar) as the result.
  */
+int wild_match(register unsigned char *m, register unsigned char *n)
+{
+  unsigned char *ma = m, *na = n, *lsm = 0, *lsn = 0;
+  int match = 1;
+  register int sofar = 0;
+
+  /* take care of null strings (should never match) */
+  if ((ma == 0) || (na == 0) || (!*ma) || (!*na))
+    return NOMATCH;
+  /* find the end of each string */
+  while (*(++m));
+    m--;
+  while (*(++n));
+    n--;
+
+  while (n >= na) {
+    if ((m <= ma) || (m[-1] != QUOTE)) {	/* Only look if no quote */
+      switch (*m) {
+      case WILDS:		/* Matches anything */
+	do
+	  m--;			/* Zap redundant wilds */
+	while ((m >= ma) && ((*m == WILDS) || (*m == WILDP)));
+	if ((m >= ma) && (*m == '\\'))
+	  m++;			/* Keep quoted wildcard! */
+	lsm = m;
+	lsn = n;
+	match += sofar;
+	sofar = 0;		/* Update fallback pos */
+	continue;		/* Next char, please */
+      case WILDQ:
+	m--;
+	n--;
+	continue;		/* '?' always matches */
+      }
+      sofar &= UNQUOTED;	/* Remember not quoted */
+    } else
+      sofar |= QUOTED;		/* Remember quoted */
+    if (rfc_toupper(*m) == rfc_toupper(*n)) {	/* If matching char */
+      m--;
+      n--;
+      sofar++;			/* Tally the match */
+      if (sofar & QUOTED)
+	m--;			/* Skip the quote char */
+      continue;			/* Next char, please */
+    }
+    if (lsm) {			/* To to fallback on '*' */
+      n = --lsn;
+      m = lsm;
+      if (n < na)
+	lsm = 0;		/* Rewind to saved pos */
+      sofar = 0;
+      continue;			/* Next char, please */
+    }
+    return NOMATCH;		/* No fallback=No match */
+  }
+  while ((m >= ma) && ((*m == WILDS) || (*m == WILDP)))
+    m--;			/* Zap leftover %s & *s */
+  return (m >= ma) ? NOMATCH : MATCH;	/* Start of both = match */
+}
 
-/* Changing these is probably counter-productive :) */
-#define MATCH (match+saved+sofar)
-#define NOMATCH 0
 
 /* 
- * EGGDROP:   wild_match_per(char *m, char *n)
- * IrcII:     wild_match(char *m, char *n)
+ * wild_match_per(char *m, char *n)
  * 
  * Features:  Forward, case-insensitive, ?, *, %, ~(optional)
  * Best use:  Generic string matching, such as in IrcII-esque bindings
  */
-#ifdef EGGDROP
-static int wild_match_per(register unsigned char *m, register unsigned char *n)
-#else
-int wild_match(register unsigned char *m, register unsigned char *n)
-#endif
+int wild_match_per(register unsigned char *m, register unsigned char *n)
 {
   unsigned char *ma = m, *lsm = 0, *lsn = 0, *lpm = 0, *lpn = 0;
-  int match = 1, saved = 0;
+  int match = 1, saved = 0, space;
   register unsigned int sofar = 0;
 
-#ifdef WILDT
-  int space;
-#endif
-
   /* take care of null strings (should never match) */
   if ((m == 0) || (n == 0) || (!*n))
     return NOMATCH;
@@ -122,7 +154,6 @@
 
   while (*n) {
     /* Used to test for (!*m) here, but this scheme seems to work better */
-#ifdef WILDT
     if (*m == WILDT) {		/* Match >=1 space */
       space = 0;		/* Don't need any spaces */
       do {
@@ -140,14 +171,13 @@
     }
     /* Do the fallback       */
     else {
-#endif
       switch (*m) {
       case 0:
 	do
 	  m--;			/* Search backwards */
 	while ((m > ma) && (*m == '?'));	/* For first non-? char */
 	if ((m > ma) ? ((*m == '*') && (m[-1] != QUOTE)) : (*m == '*'))
-	  return MATCH;		/* nonquoted * = match */
+	  return MATCH_PER;		/* nonquoted * = match */
 	break;
       case WILDP:
 	while (*(++m) == WILDP);	/* Zap redundant %s */
@@ -184,9 +214,7 @@
 	sofar++;
 	continue;		/* Tally the match */
       }
-#ifdef WILDT
     }
-#endif
     if (lpm) {			/* Try to fallback on '%' */
       n = ++lpn;
       m = lpm;
@@ -206,116 +234,5 @@
   }
   while ((*m == WILDS) || (*m == WILDP))
     m++;			/* Zap leftover %s & *s */
-  return (*m) ? NOMATCH : MATCH;	/* End of both = match */
+  return (*m) ? NOMATCH : MATCH_PER;	/* End of both = match */
 }
-
-#ifndef EGGDROP
-
-/* For IrcII compatibility */
-
-int _wild_match(ma, na)
-register unsigned char *ma, *na;
-{
-  return wild_match(ma, na) - 1;	/* Don't think IrcII's code
-					 * actually uses this directly,
-					 * but just in case */
-}
-
-int match(ma, na)
-register unsigned char *ma, *na;
-{
-  return wild_match(ma, na) ? 1 : 0;	/* Returns 1 for match,
-					 * 0 for non-match */
-}
-
-#else
-
-/* 
- * Remaining code is not used by IrcII
- */
-
-/* 
- * For this matcher, sofar's high bit is used as a flag of whether or
- * not we are quoting.  The other matchers don't need this because
- * when you're going forward, you just skip over the quote char.
- */
-#define UNQUOTED (0x7FFF)
-#define QUOTED   (0x8000)
-
-#undef MATCH
-#define MATCH ((match+sofar)&UNQUOTED)
-
-/* 
- * EGGDROP:   wild_match(char *ma, char *na)
- * IrcII:     NOT USED
- * 
- * Features:  Backwards, case-insensitive, ?, *
- * Best use:  Matching of hostmasks (since they are likely to begin
- *            with a * rather than end with one).
- */
-int _wild_match(register unsigned char *m, register unsigned char *n)
-{
-  unsigned char *ma = m, *na = n, *lsm = 0, *lsn = 0;
-  int match = 1;
-  register int sofar = 0;
-
-  /* take care of null strings (should never match) */
-  if ((ma == 0) || (na == 0) || (!*ma) || (!*na))
-    return NOMATCH;
-  /* find the end of each string */
-  while (*(++m));
-    m--;
-  while (*(++n));
-    n--;
-
-  while (n >= na) {
-    if ((m <= ma) || (m[-1] != QUOTE)) {	/* Only look if no quote */
-      switch (*m) {
-      case WILDS:		/* Matches anything */
-	do
-	  m--;			/* Zap redundant wilds */
-	while ((m >= ma) && ((*m == WILDS) || (*m == WILDP)));
-	if ((m >= ma) && (*m == '\\'))
-	  m++;			/* Keep quoted wildcard! */
-	lsm = m;
-	lsn = n;
-	match += sofar;
-	sofar = 0;		/* Update fallback pos */
-	continue;		/* Next char, please */
-      case WILDQ:
-	m--;
-	n--;
-	continue;		/* '?' always matches */
-      }
-      sofar &= UNQUOTED;	/* Remember not quoted */
-    } else
-      sofar |= QUOTED;		/* Remember quoted */
-    if (rfc_toupper(*m) == rfc_toupper(*n)) {	/* If matching char */
-      m--;
-      n--;
-      sofar++;			/* Tally the match */
-      if (sofar & QUOTED)
-	m--;			/* Skip the quote char */
-      continue;			/* Next char, please */
-    }
-    if (lsm) {			/* To to fallback on '*' */
-      n = --lsn;
-      m = lsm;
-      if (n < na)
-	lsm = 0;		/* Rewind to saved pos */
-      sofar = 0;
-      continue;			/* Next char, please */
-    }
-    return NOMATCH;		/* No fallback=No match */
-  }
-  while ((m >= ma) && ((*m == WILDS) || (*m == WILDP)))
-    m--;			/* Zap leftover %s & *s */
-  return (m >= ma) ? NOMATCH : MATCH;	/* Start of both = match */
-}
-
-/* 
- * For this matcher, no "saved" is used to track "%" and no special quoting
- * ability is needed, so we just have (match+sofar) as the result.
- */
-
-#endif
Index: eggdrop1.7/src/mem.c
diff -u eggdrop1.7/src/mem.c:1.17 eggdrop1.7/src/mem.c:removed
--- eggdrop1.7/src/mem.c:1.17	Thu Aug 16 08:27:38 2001
+++ eggdrop1.7/src/mem.c	Wed Oct 10 05:44:19 2001
@@ -1,383 +0,0 @@
-/*
- * mem.c -- handles:
- *   memory allocation and deallocation
- *   keeping track of what memory is being used by whom
- *
- * $Id: mem.c,v 1.17 2001/08/16 13:27:38 drummer Exp $
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#define MEMTBLSIZE 25000	/* yikes! */
-#define COMPILING_MEM
-
-#include "main.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "mod/modvals.h"
-
-
-extern module_entry	*module_list;
-
-#ifdef DEBUG_MEM
-unsigned long	memused = 0;
-static int	lastused = 0;
-
-struct {
-  void	*ptr;
-  int	 size;
-  short	 line;
-  char	 file[20];
-} memtbl[MEMTBLSIZE];
-#endif
-
-/* Prototypes */
-int expected_memory();
-int expmem_chanprog();
-int expmem_misc();
-int expmem_fileq();
-int expmem_users();
-int expmem_dccutil();
-int expmem_botnet();
-int expmem_tcl();
-int expmem_tclhash();
-int expmem_net();
-int expmem_modules();
-int expmem_tcldcc();
-int expmem_dns();
-
-
-/* Initialize the memory structure
- */
-void init_mem()
-{
-#ifdef DEBUG_MEM
-  int i;
-
-  for (i = 0; i < MEMTBLSIZE; i++)
-    memtbl[i].ptr = NULL;
-#endif
-}
-
-/* Tell someone the gory memory details
- */
-void tell_mem_status(char *nick)
-{
-#ifdef DEBUG_MEM
-  float per;
-
-  per = ((lastused * 1.0) / (MEMTBLSIZE * 1.0)) * 100.0;
-  dprintf(DP_HELP, "NOTICE %s :Memory table usage: %d/%d (%.1f%% full)\n",
-	  nick, lastused, MEMTBLSIZE, per);
-#endif
-  dprintf(DP_HELP, "NOTICE %s :Think I'm using about %dk.\n", nick,
-	  (int) (expected_memory() / 1024));
-}
-
-void tell_mem_status_dcc(int idx)
-{
-#ifdef DEBUG_MEM
-  int exp;
-  float per;
-
-  exp = expected_memory();	/* in main.c ? */
-  per = ((lastused * 1.0) / (MEMTBLSIZE * 1.0)) * 100.0;
-  dprintf(idx, "Memory table: %d/%d (%.1f%% full)\n", lastused, MEMTBLSIZE,
-	  per);
-  per = ((exp * 1.0) / (memused * 1.0)) * 100.0;
-  if (per != 100.0)
-    dprintf(idx, "Memory fault: only accounting for %d/%ld (%.1f%%)\n",
-	    exp, memused, per);
-  dprintf(idx, "Memory table itself occupies an additional %dk static\n",
-	  (int) (sizeof(memtbl) / 1024));
-#endif
-}
-
-void debug_mem_to_dcc(int idx)
-{
-#ifdef DEBUG_MEM
-#define MAX_MEM 11
-  unsigned long exp[MAX_MEM], use[MAX_MEM], l;
-  int i, j;
-  char fn[20], sofar[81];
-  module_entry *me;
-  char *p;
-
-  exp[0] = expmem_dns();
-  exp[1] = expmem_chanprog();
-  exp[2] = expmem_misc();
-  exp[3] = expmem_users();
-  exp[4] = expmem_net();
-  exp[5] = expmem_dccutil();
-  exp[6] = expmem_botnet();
-  exp[7] = expmem_tcl();
-  exp[8] = expmem_tclhash();
-  exp[9] = expmem_modules(1);
-  exp[10] = expmem_tcldcc();
-  for (me = module_list; me; me = me->next)
-    me->mem_work = 0;
-  for (i = 0; i < MAX_MEM; i++)
-    use[i] = 0;
-  for (i = 0; i < lastused; i++) {
-    strcpy(fn, memtbl[i].file);
-    p = strchr(fn, ':');
-    if (p)
-      *p = 0;
-    l = memtbl[i].size;
-    if (!strcmp(fn, "dns.c"))
-      use[0] += l;
-    else if (!strcmp(fn, "chanprog.c"))
-      use[1] += l;
-    else if (!strcmp(fn, "misc.c"))
-      use[2] += l;
-    else if (!strcmp(fn, "userrec.c"))
-      use[3] += l;
-    else if (!strcmp(fn, "net.c"))
-      use[4] += l;
-    else if (!strcmp(fn, "dccutil.c"))
-      use[5] += l;
-    else if (!strcmp(fn, "botnet.c"))
-      use[6] += l;
-    else if (!strcmp(fn, "tcl.c"))
-      use[7] += l;
-    else if (!strcmp(fn, "tclhash.c"))
-      use[8] += l;
-    else if (!strcmp(fn, "modules.c"))
-      use[9] += l;
-    else if (!strcmp(fn, "tcldcc.c"))
-      use[10] += l;
-    else if (p) {
-      for (me = module_list; me; me = me->next)
-	if (!strcmp(fn, me->name))
-	  me->mem_work += l;
-    } else
-      dprintf(idx, "Not logging file %s!\n", fn);
-  }
-  for (i = 0; i < MAX_MEM; i++) {
-    switch (i) {
-    case 0:
-      strcpy(fn, "dns.c");
-      break;
-    case 1:
-      strcpy(fn, "chanprog.c");
-      break;
-    case 2:
-      strcpy(fn, "misc.c");
-      break;
-    case 3:
-      strcpy(fn, "userrec.c");
-      break;
-    case 4:
-      strcpy(fn, "net.c");
-      break;
-    case 5:
-      strcpy(fn, "dccutil.c");
-      break;
-    case 6:
-      strcpy(fn, "botnet.c");
-      break;
-    case 7:
-      strcpy(fn, "tcl.c");
-      break;
-    case 8:
-      strcpy(fn, "tclhash.c");
-      break;
-    case 9:
-      strcpy(fn, "modules.c");
-      break;
-    case 10:
-      strcpy(fn, "tcldcc.c");
-      break;
-    }
-    if (use[i] == exp[i]) {
-      dprintf(idx, "File '%-10s' accounted for %lu/%lu (ok)\n", fn, exp[i],
-	      use[i]);
-    } else {
-      dprintf(idx, "File '%-10s' accounted for %lu/%lu (debug follows:)\n",
-	      fn, exp[i], use[i]);
-      strcpy(sofar, "   ");
-      for (j = 0; j < lastused; j++) {
-	if ((p = strchr(memtbl[j].file, ':')))
-	  *p = 0;
-	if (!egg_strcasecmp(memtbl[j].file, fn)) {
-	  if (p)
-	    sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04d) ",
-		    p + 1, memtbl[j].line, memtbl[j].size);
-	  else
-	    sprintf(&sofar[strlen(sofar)], "%-4d:(%04d) ",
-		    memtbl[j].line, memtbl[j].size);
-
-	  if (strlen(sofar) > 60) {
-	    sofar[strlen(sofar) - 1] = 0;
-	    dprintf(idx, "%s\n", sofar);
-	    strcpy(sofar, "   ");
-	  }
-	}
-	if (p)
-	  *p = ':';
-      }
-      if (sofar[0]) {
-	sofar[strlen(sofar) - 1] = 0;
-	dprintf(idx, "%s\n", sofar);
-      }
-    }
-  }
-  for (me = module_list; me; me = me->next) {
-    Function *f = me->funcs;
-    int expt = 0;
-
-    if ((f != NULL) && (f[MODCALL_EXPMEM] != NULL))
-      expt = f[MODCALL_EXPMEM] ();
-    if (me->mem_work == expt) {
-      dprintf(idx, "Module '%-10s' accounted for %lu/%lu (ok)\n", me->name,
-	      expt, me->mem_work);
-    } else {
-      dprintf(idx, "Module '%-10s' accounted for %lu/%lu (debug follows:)\n",
-	      me->name, expt, me->mem_work);
-      strcpy(sofar, "   ");
-      for (j = 0; j < lastused; j++) {
-	strcpy(fn, memtbl[j].file);
-	if ((p = strchr(fn, ':')) != NULL) {
-	  *p = 0;
-	  if (!egg_strcasecmp(fn, me->name)) {
-	    sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04X) ", p + 1,
-		    memtbl[j].line, memtbl[j].size);
-	    if (strlen(sofar) > 60) {
-	      sofar[strlen(sofar) - 1] = 0;
-	      dprintf(idx, "%s\n", sofar);
-	      strcpy(sofar, "   ");
-	    }
-	    *p = ':';
-	  }
-	}
-      }
-      if (sofar[0]) {
-	sofar[strlen(sofar) - 1] = 0;
-	dprintf(idx, "%s\n", sofar);
-      }
-    }
-  }
-  dprintf(idx, "--- End of debug memory list.\n");
-#else
-  dprintf(idx, "Compiled without extensive memory debugging (sorry).\n");
-#endif
-  tell_netdebug(idx);
-}
-
-void *n_malloc(int size, const char *file, int line)
-{
-  void	*x;
-#ifdef DEBUG_MEM
-  int	 i = 0;
-  char	*p;
-#endif
-
-  x = (void *) malloc(size);
-  if (x == NULL) {
-    putlog(LOG_MISC, "*", "*** FAILED MALLOC %s (%d) (%d): %s", file, line,
-	   size, strerror(errno));
-    fatal("Memory allocation failed", 0);
-  }
-#ifdef DEBUG_MEM
-  if (lastused == MEMTBLSIZE) {
-    putlog(LOG_MISC, "*", "*** MEMORY TABLE FULL: %s (%d)", file, line);
-    fatal("Memory table full", 0);
-  }
-  i = lastused;
-  memtbl[i].ptr = x;
-  memtbl[i].line = line;
-  memtbl[i].size = size;
-  p = strrchr(file, '/');
-  strncpy(memtbl[i].file, p ? p + 1 : file, 19);
-  memtbl[i].file[19] = 0;
-  memused += size;
-  lastused++;
-#endif
-  return x;
-}
-
-void *n_realloc(void *ptr, int size, const char *file, int line)
-{
-  void *x;
-  int i = 0;
-#ifdef DEBUG_MEM
-  char *p;
-#endif
-
-  /* ptr == NULL is valid. Avoiding duplicate code further down */
-  if (!ptr)
-    return n_malloc(size, file, line);
-
-  x = (void *) realloc(ptr, size);
-  if (x == NULL) {
-    i = i;
-    putlog(LOG_MISC, "*", "*** FAILED REALLOC %s (%d)", file, line);
-    return NULL;
-  }
-#ifdef DEBUG_MEM
-  for (i = 0; (i < lastused) && (memtbl[i].ptr != ptr); i++);
-  if (i == lastused) {
-    putlog(LOG_MISC, "*", "*** ATTEMPTING TO REALLOC NON-MALLOC'D PTR: %s (%d)",
-	   file, line);
-    return NULL;
-  }
-  memused -= memtbl[i].size;
-  memtbl[i].ptr = x;
-  memtbl[i].line = line;
-  memtbl[i].size = size;
-  p = strrchr(file, '/');
-  strncpy(memtbl[i].file, p ? p + 1 : file, 19);
-  memtbl[i].file[19] = 0;
-  memused += size;
-#endif
-  return x;
-}
-
-void n_free(void *ptr, const char *file, int line)
-{
-  int i = 0;
-
-  if (ptr == NULL) {
-    putlog(LOG_MISC, "*", "*** ATTEMPTING TO FREE NULL PTR: %s (%d)",
-	   file, line);
-    i = i;
-    return;
-  }
-#ifdef DEBUG_MEM
-  /* Give tcl builtins an escape mechanism */
-  if (line) {
-    for (i = 0; (i < lastused) && (memtbl[i].ptr != ptr); i++);
-    if (i == lastused) {
-      putlog(LOG_MISC, "*", "*** ATTEMPTING TO FREE NON-MALLOC'D PTR: %s (%d)",
-	     file, line);
-      return;
-    }
-    memused -= memtbl[i].size;
-    lastused--;
-    memtbl[i].ptr = memtbl[lastused].ptr;
-    memtbl[i].size = memtbl[lastused].size;
-    memtbl[i].line = memtbl[lastused].line;
-    strcpy(memtbl[i].file, memtbl[lastused].file);
-  }
-#endif
-  free(ptr);
-}
Index: eggdrop1.7/src/misc.c
diff -u eggdrop1.7/src/misc.c:1.45 eggdrop1.7/src/misc.c:1.46
--- eggdrop1.7/src/misc.c:1.45	Mon Aug 13 11:21:48 2001
+++ eggdrop1.7/src/misc.c	Wed Oct 10 05:44:04 2001
@@ -7,7 +7,7 @@
  *   help system
  *   motd display and %var substitution
  *
- * $Id: misc.c,v 1.45 2001/08/13 16:21:48 guppy Exp $
+ * $Id: misc.c,v 1.46 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -72,23 +72,6 @@
 } *help_list = NULL;
 
 
-/* Expected memory usage
- */
-int expmem_misc()
-{
-  struct help_ref *current;
-  struct help_list_t *item;
-  int tot = 0;
-
-  for (current = help_list; current; current = current->next) {
-    tot += sizeof(struct help_ref) + strlen(current->name) + 1;
-
-    for (item = current->first; item; item = item->next)
-      tot += sizeof(struct help_list_t) + strlen(item->name) + 1;
-  }
-  return tot + (max_logs * sizeof(log_t));
-}
-
 void init_misc()
 {
   static int last = 0;
@@ -96,9 +79,9 @@
   if (max_logs < 1)
     max_logs = 1;
   if (logs)
-    logs = nrealloc(logs, max_logs * sizeof(log_t));
+    logs = realloc(logs, max_logs * sizeof(log_t));
   else
-    logs = nmalloc(max_logs * sizeof(log_t));
+    logs = malloc(max_logs * sizeof(log_t));
   for (; last < max_logs; last++) {
     logs[last].filename = logs[last].chname = NULL;
     logs[last].mask = 0;
@@ -729,7 +712,7 @@
 
   if ((newcol[0]) && (newcol[0] != '\377'))
     colsofar++;
-  colstr = nrealloc(colstr, strlen(colstr) + strlen(newcol) +
+  colstr = realloc(colstr, strlen(colstr) + strlen(newcol) +
 		    (colstr[0] ? 2 : 1));
   if ((newcol[0]) && (newcol[0] != '\377')) {
     if (colstr[0])
@@ -751,9 +734,8 @@
       p = strchr(q, '\377');
     }
     strcat(s, q);
-    nfree(colstr);
-    colstr = (char *) nmalloc(1);
-    colstr[0] = 0;
+    free(colstr);
+    malloc_memset(colstr, 0, 1);
   }
 }
 
@@ -797,10 +779,8 @@
     blind = 0;
     cols = 0;
     subwidth = 70;
-    if (colstr != NULL) {
-      nfree(colstr);
-      colstr = NULL;
-    }
+    if (colstr != NULL)
+      free_null(colstr);
     help_flags = isdcc;
     return;
   }
@@ -963,8 +943,7 @@
 	    if (cols) {
 	      sub[0] = 0;
 	      subst_addcol(sub, "\377");
-	      nfree(colstr);
-	      colstr = NULL;
+	      free_null(colstr);
 	      cols = 0;
 	      towrite = sub;
 	    }
@@ -975,8 +954,7 @@
 
 	    cols = atoi(q + 5);
 	    colsofar = 0;
-	    colstr = (char *) nmalloc(1);
-	    colstr[0] = 0;
+	    malloc_memset(colstr, 0, 1);
 	    r = strchr(q + 5, '/');
 	    if (r != NULL)
 	      subwidth = atoi(r + 1);
@@ -1052,9 +1030,9 @@
 	  q += 7;
 	  if ((p = strchr(q, '}'))) {
 	    *p = 0;
-	    list = nmalloc(sizeof(struct help_list_t));
+	    list = malloc(sizeof(struct help_list_t));
 
-	    list->name = nmalloc(p - q + 1);
+	    list->name = malloc(p - q + 1);
 	    strcpy(list->name, q);
 	    list->next = current->first;
 	    list->type = type;
@@ -1077,10 +1055,9 @@
   for (current = help_list; current; current = current->next)
     if (!strcmp(current->name, file))
       return;			/* Already exists, can't re-add :P */
-  current = nmalloc(sizeof(struct help_ref));
+  current = malloc(sizeof(struct help_ref));
 
-  current->name = nmalloc(strlen(file) + 1);
-  strcpy(current->name, file);
+  malloc_strcpy(current->name, file);
   current->next = help_list;
   current->first = NULL;
   help_list = current;
@@ -1101,15 +1078,15 @@
     if (!strcmp(current->name, file)) {
       while ((item = current->first)) {
 	current->first = item->next;
-	nfree(item->name);
-	nfree(item);
+	free(item->name);
+	free(item);
       }
-      nfree(current->name);
+      free(current->name);
       if (last)
 	last->next = current->next;
       else
 	help_list = current->next;
-      nfree(current);
+      free(current);
       return;
     }
 }
@@ -1123,13 +1100,13 @@
   while (current) {
     while ((item = current->first)) {
       current->first = item->next;
-      nfree(item->name);
-      nfree(item);
+      free(item->name);
+      free(item);
     }
     add_help_reference(current->name);
-    nfree(current->name);
+    free(current->name);
     next = current->next;
-    nfree(current);
+    free(current);
     current = next;
   }
 }
@@ -1431,7 +1408,7 @@
 {
   const int	 len = strlen(str);
   int		 buflen = (2 * len), blen = 0;
-  char		*buf = nmalloc(buflen + 1), *b = buf;
+  char		*buf = malloc(buflen + 1), *b = buf;
   const char	*s;
 
   if (!buf)
@@ -1440,7 +1417,7 @@
     /* Resize buffer. */
     if ((buflen - blen) <= 3) {
       buflen = (buflen * 2);
-      buf = nrealloc(buf, buflen + 1);
+      buf = realloc(buf, buflen + 1);
       if (!buf)
 	return NULL;
       b = buf + blen;
Index: eggdrop1.7/src/mod/assoc.mod/assoc.c
diff -u eggdrop1.7/src/mod/assoc.mod/assoc.c:1.20 eggdrop1.7/src/mod/assoc.mod/assoc.c:1.21
--- eggdrop1.7/src/mod/assoc.mod/assoc.c:1.20	Tue Oct  9 20:20:11 2001
+++ eggdrop1.7/src/mod/assoc.mod/assoc.c	Wed Oct 10 05:44:05 2001
@@ -2,7 +2,7 @@
  * assoc.c -- part of assoc.mod
  *   the assoc code, moved here mainly from botnet.c for module work
  *
- * $Id: assoc.c,v 1.20 2001/10/10 01:20:11 ite Exp $
+ * $Id: assoc.c,v 1.21 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -59,16 +59,6 @@
       botnet_send_zapf(idx2, botnetnick, dcc[idx2].nick, x);
 }
 
-static int assoc_expmem()
-{
-  assoc_t *a;
-  int size = 0;
-
-  for (a = assoc; a; a = a->next)
-    size += sizeof(assoc_t);
-  return size;
-}
-
 static void link_assoc(char *bot, char *via)
 {
   char x[1024];
@@ -97,8 +87,7 @@
 	last->next = a->next;
       else
 	assoc = a->next;
-      nfree(a);
-      a = NULL;
+      free_null(a);
     } else {
       last = a;
       a = a->next;
@@ -112,7 +101,7 @@
 
   for (a = assoc; a; a = x) {
     x = a->next;
-    nfree(a);
+    free(a);
   }
   assoc = NULL;
 }
@@ -135,7 +124,7 @@
   /* Add in numerical order */
   for (a = assoc; a; old = a, a = a->next) {
     if (a->channel > chan) {
-      b = (assoc_t *) nmalloc(sizeof(assoc_t));
+      b = (assoc_t *) malloc(sizeof(assoc_t));
       b->next = a;
       b->channel = chan;
       strncpyz(b->name, name, sizeof b->name);
@@ -147,7 +136,7 @@
     }
   }
   /* Add at the end */
-  b = (assoc_t *) nmalloc(sizeof(assoc_t));
+  b = (assoc_t *) malloc(sizeof(assoc_t));
   b->next = NULL;
   b->channel = chan;
   strncpyz(b->name, name, sizeof b->name);
@@ -401,7 +390,7 @@
 {
   (Function) start,
   (Function) assoc_close,
-  (Function) assoc_expmem,
+  (Function) 0,
   (Function) assoc_report,
 };
 
Index: eggdrop1.7/src/mod/blowfish.mod/blowfish.c
diff -u eggdrop1.7/src/mod/blowfish.mod/blowfish.c:1.22 eggdrop1.7/src/mod/blowfish.mod/blowfish.c:1.23
--- eggdrop1.7/src/mod/blowfish.mod/blowfish.c:1.22	Tue Oct  9 20:20:11 2001
+++ eggdrop1.7/src/mod/blowfish.mod/blowfish.c	Wed Oct 10 05:44:05 2001
@@ -2,7 +2,7 @@
  * blowfish.c -- part of blowfish.mod
  *   encryption and decryption of passwords
  *
- * $Id: blowfish.c,v 1.22 2001/10/10 01:20:11 ite Exp $
+ * $Id: blowfish.c,v 1.23 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -63,19 +63,6 @@
 static u_32bit_t *bf_P;
 static u_32bit_t **bf_S;
 
-static int blowfish_expmem()
-{
-  int i, tot = 0;
-
-  for (i = 0; i < BOXES; i++)
-    if (box[i].P != NULL) {
-      tot += ((bf_N + 2) * sizeof(u_32bit_t));
-      tot += (4 * sizeof(u_32bit_t *));
-      tot += (4 * 256 * sizeof(u_32bit_t));
-    }
-  return tot;
-}
-
 static void blowfish_encipher(u_32bit_t * xl, u_32bit_t * xr)
 {
   union aword Xl;
@@ -201,17 +188,17 @@
 	lowest = box[i].lastuse;
 	bx = i;
       }
-    nfree(box[bx].P);
+    free(box[bx].P);
     for (i = 0; i < 4; i++)
-      nfree(box[bx].S[i]);
-    nfree(box[bx].S);
+      free(box[bx].S[i]);
+    free(box[bx].S);
   }
   /* Initialize new buffer */
   /* uh... this is over 4k */
-  box[bx].P = (u_32bit_t *) nmalloc((bf_N + 2) * sizeof(u_32bit_t));
-  box[bx].S = (u_32bit_t **) nmalloc(4 * sizeof(u_32bit_t *));
+  box[bx].P = (u_32bit_t *) malloc((bf_N + 2) * sizeof(u_32bit_t));
+  box[bx].S = (u_32bit_t **) malloc(4 * sizeof(u_32bit_t *));
   for (i = 0; i < 4; i++)
-    box[bx].S[i] = (u_32bit_t *) nmalloc(256 * sizeof(u_32bit_t));
+    box[bx].S[i] = (u_32bit_t *) malloc(256 * sizeof(u_32bit_t));
   bf_P = box[bx].P;
   bf_S = box[bx].S;
   box[bx].keybytes = keybytes;
@@ -313,12 +300,12 @@
   int i;
 
   /* Pad fake string with 8 bytes to make sure there's enough */
-  s = (char *) nmalloc(strlen(str) + 9);
+  s = (char *) malloc(strlen(str) + 9);
   strcpy(s, str);
   if ((!key) || (!key[0]))
     return s;
   p = s;
-  dest = (char *) nmalloc((strlen(str) + 9) * 2);
+  dest = (char *) malloc((strlen(str) + 9) * 2);
   while (*p)
     p++;
   for (i = 0; i < 8; i++)
@@ -346,7 +333,7 @@
     }
   }
   *d = 0;
-  nfree(s);
+  free(s);
   return dest;
 }
 
@@ -359,12 +346,12 @@
   int i;
 
   /* Pad encoded string with 0 bits in case it's bogus */
-  s = (char *) nmalloc(strlen(str) + 12);
+  s = (char *) malloc(strlen(str) + 12);
   strcpy(s, str);
   if ((!key) || (!key[0]))
     return s;
   p = s;
-  dest = (char *) nmalloc(strlen(str) + 12);
+  dest = (char *) malloc(strlen(str) + 12);
   while (*p)
     p++;
   for (i = 0; i < 12; i++)
@@ -386,7 +373,7 @@
       *d++ = (right & (0xff << ((3 - i) * 8))) >> ((3 - i) * 8);
   }
   *d = 0;
-  nfree(s);
+  free(s);
   return dest;
 }
 
@@ -397,7 +384,7 @@
   BADARGS(3, 3, " key string");
   p = encrypt_string(argv[1], argv[2]);
   Tcl_AppendResult(irp, p, NULL);
-  nfree(p);
+  free(p);
   return TCL_OK;
 }
 
@@ -408,7 +395,7 @@
   BADARGS(3, 3, " key string");
   p = decrypt_string(argv[1], argv[2]);
   Tcl_AppendResult(irp, p, NULL);
-  nfree(p);
+  free(p);
   return TCL_OK;
 }
 
@@ -446,7 +433,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) blowfish_close,
-  (Function) blowfish_expmem,
+  (Function) 0,
   (Function) blowfish_report,
   /* 4 - 7 */
   (Function) encrypt_string,
Index: eggdrop1.7/src/mod/channels.mod/channels.c
diff -u eggdrop1.7/src/mod/channels.mod/channels.c:1.61 eggdrop1.7/src/mod/channels.mod/channels.c:1.62
--- eggdrop1.7/src/mod/channels.mod/channels.c:1.61	Tue Oct  9 20:20:11 2001
+++ eggdrop1.7/src/mod/channels.mod/channels.c	Wed Oct 10 05:44:05 2001
@@ -2,7 +2,7 @@
  * channels.c -- part of channels.mod
  *   support for channels within the bot
  *
- * $Id: channels.c,v 1.61 2001/10/10 01:20:11 ite Exp $
+ * $Id: channels.c,v 1.62 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -74,19 +74,6 @@
 #include "udefchan.c"
 
 
-static void *channel_malloc(int size, char *file, int line)
-{
-  char *p;
-
-#ifdef DEBUG_MEM
-  p = ((void *) (global[0] (size, MODULE_NAME, file, line)));
-#else
-  p = nmalloc(size);
-#endif
-  egg_bzero(p, size);
-  return p;
-}
-
 static void set_mode_protect(struct chanset_t *chan, char *set)
 {
   int i, pos = 1;
@@ -296,14 +283,14 @@
    /* Remove channel specific user flags */
    user_del_chan(chan->dname);
    noshare = 0;
-   nfree(chan->channel.key);
+   free(chan->channel.key);
    for (i = 0; i < 6 && chan->cmode[i].op; i++)
-     nfree(chan->cmode[i].op);
+     free(chan->cmode[i].op);
    if (chan->key)
-     nfree(chan->key);
+     free(chan->key);
    if (chan->rmkey)
-     nfree(chan->rmkey);
-   nfree(chan);
+     free(chan->rmkey);
+   free(chan);
 }
 
 /* Bind this to chon and *if* the users console channel == ***
@@ -652,48 +639,6 @@
   }
 }
 
-static int expmem_masklist(masklist *m)
-{
-  int result = 0;
-
-  for (; m; m = m->next) {
-    result += sizeof(masklist);
-    if (m->mask)
-        result += strlen(m->mask) + 1;
-    if (m->who)
-        result += strlen(m->who) + 1;
-  }
-  return result;
-}
-
-static int channels_expmem()
-{
-  int tot = 0, i;
-  struct chanset_t *chan;
-
-  for (chan = chanset; chan; chan = chan->next) {
-    tot += sizeof(struct chanset_t);
-
-    tot += strlen(chan->channel.key) + 1;
-    if (chan->channel.topic)
-      tot += strlen(chan->channel.topic) + 1;
-    tot += (sizeof(struct memstruct) * (chan->channel.members + 1));
-
-    tot += expmem_masklist(chan->channel.ban);
-    tot += expmem_masklist(chan->channel.exempt);
-    tot += expmem_masklist(chan->channel.invite);
-
-    for (i = 0; i < 6 && chan->cmode[i].op; i++)
-      tot += strlen(chan->cmode[i].op) + 1;
-    if (chan->key)
-      tot += strlen(chan->key) + 1;
-    if (chan->rmkey)
-      tot += strlen(chan->rmkey) + 1;
-  }
-  tot += expmem_udef(udef);
-  return tot;
-}
-
 static char *traced_globchanset(ClientData cdata, Tcl_Interp * irp,
 				char *name1, char *name2, int flags)
 {
@@ -800,7 +745,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) channels_close,
-  (Function) channels_expmem,
+  (Function) 0,
   (Function) channels_report,
   /* 4 - 7 */
   (Function) u_setsticky_mask,
@@ -813,7 +758,7 @@
   (Function) del_chanrec,
   (Function) set_handle_chaninfo,
   /* 12 - 15 */
-  (Function) channel_malloc,
+  (Function) 0,
   (Function) u_match_mask,
   (Function) u_equals_mask,
   (Function) clear_channel,
Index: eggdrop1.7/src/mod/channels.mod/channels.h
diff -u eggdrop1.7/src/mod/channels.mod/channels.h:1.18 eggdrop1.7/src/mod/channels.mod/channels.h:1.19
--- eggdrop1.7/src/mod/channels.mod/channels.h:1.18	Wed Aug 22 23:06:10 2001
+++ eggdrop1.7/src/mod/channels.mod/channels.h	Wed Oct 10 05:44:05 2001
@@ -1,7 +1,7 @@
 /*
  * channels.h -- part of channels.mod
  *
- * $Id: channels.h,v 1.18 2001/08/23 04:06:10 stdarg Exp $
+ * $Id: channels.h,v 1.19 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -102,8 +102,6 @@
 			      int items, char **item);
 static int tcl_channel_add(Tcl_Interp * irp, char *, char *);
 static char *convert_element(char *src, char *dst);
-static int expmem_udef(struct udef_struct *);
-static int expmem_udef_chans (int, struct udef_chans *);
 static void free_udef(struct udef_struct *);
 static void free_udef_chans(struct udef_chans *, int);
 static int getudef(struct udef_chans *, char *);
@@ -127,7 +125,7 @@
 #define del_chanrec ((void (*)(struct userrec *, char *))channels_funcs[10])
 #define set_handle_chaninfo ((void (*)(struct userrec *, char *, char *, char *))channels_funcs[11])
 /* 12 - 15 */
-#define channel_malloc(x) ((void *(*)(int, char *, int))channels_funcs[12])(x,__FILE__,__LINE__)
+/* 12: channel_malloc -- UNUSED (Tothwolf) */
 #define u_match_mask ((int (*)(maskrec *, char *))channels_funcs[13])
 #define u_equals_mask ((int (*)(maskrec *, char *))channels_funcs[14])
 #define clear_channel ((void (*)(struct chanset_t *, int))channels_funcs[15])
Index: eggdrop1.7/src/mod/channels.mod/cmdschan.c
diff -u eggdrop1.7/src/mod/channels.mod/cmdschan.c:1.52 eggdrop1.7/src/mod/channels.mod/cmdschan.c:1.53
--- eggdrop1.7/src/mod/channels.mod/cmdschan.c:1.52	Mon Aug 27 18:33:43 2001
+++ eggdrop1.7/src/mod/channels.mod/cmdschan.c	Wed Oct 10 05:44:05 2001
@@ -2,7 +2,7 @@
  * cmdschan.c -- part of channels.mod
  *   commands from a user via dcc that cause server interaction
  *
- * $Id: cmdschan.c,v 1.52 2001/08/27 23:33:43 poptix Exp $
+ * $Id: cmdschan.c,v 1.53 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1288,7 +1288,7 @@
 
 static void cmd_chanset(struct userrec *u, int idx, char *par)
 {
-  char *chname = NULL, answers[512], *parcpy;
+  char *chname = NULL, answers[512], *parcpy = NULL;
   char *list[2], *bak, *buf;
   struct chanset_t *chan = NULL;
   int all = 0;
@@ -1334,7 +1334,7 @@
     if (all)
       chan = chanset;
     bak = par;
-    buf = nmalloc(strlen(par) + 1);
+    buf = malloc(strlen(par) + 1);
     while (chan) {
       chname = chan->dname;
       strcpy(buf, bak);
@@ -1360,8 +1360,7 @@
 	  /* Par gets modified in tcl_channel_modify under some
   	   * circumstances, so save it now.
 	   */
-	  parcpy = nmalloc(strlen(par) + 1);
-	  strcpy(parcpy, par);
+	  malloc_strcpy(parcpy, par);
           if (tcl_channel_modify(0, chan, 2, list) == TCL_OK) {
 	    strcat(answers, list[0]);
 	    strcat(answers, " { ");
@@ -1370,7 +1369,7 @@
 	  } else if (!all || !chan->next)
 	    dprintf(idx, "Error trying to set %s for %s, invalid option\n",
 		    list[0], all ? "all channels" : chname);
-          nfree(parcpy);
+          free(parcpy);
 	break;
       }
       if (!all && answers[0]) {
@@ -1389,7 +1388,7 @@
 	      answers);
       putlog(LOG_CMDS, "*", "#%s# chanset * %s", dcc[idx].nick, answers);
     }
-    nfree(buf);
+    free(buf);
   }
 }
 
Index: eggdrop1.7/src/mod/channels.mod/tclchan.c
diff -u eggdrop1.7/src/mod/channels.mod/tclchan.c:1.53 eggdrop1.7/src/mod/channels.mod/tclchan.c:1.54
--- eggdrop1.7/src/mod/channels.mod/tclchan.c:1.53	Wed Aug 29 14:21:12 2001
+++ eggdrop1.7/src/mod/channels.mod/tclchan.c	Wed Oct 10 05:44:05 2001
@@ -1,7 +1,7 @@
 /*
  * tclchan.c -- part of channels.mod
  *
- * $Id: tclchan.c,v 1.53 2001/08/29 19:21:12 stdarg Exp $
+ * $Id: tclchan.c,v 1.54 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -789,10 +789,10 @@
 
 		p = (char *)getudef(ul->values, chan->dname);
 		if (!p) p = "{}";
-		buf = (char *)nmalloc(strlen(ul->name)+strlen(p)+2);
+		buf = malloc(strlen(ul->name) + strlen(p) + 2);
 		simple_sprintf(buf, "%s %s", ul->name, p);
 		Tcl_AppendElement(irp, buf);
-		nfree(buf);
+		free(buf);
       } else
         debug1("UDEF-ERROR: unknown type %d", ul->type);
     }
@@ -1101,11 +1101,11 @@
 			return TCL_ERROR;
 		}
 		val = (char *)getudef(ul->values, chan->dname);
-		if (val) nfree(val);
+		if (val) free(val);
 		/* Get extra room for new braces, etc */
-		val = nmalloc(3 * strlen(item[i])+10);
+		val = malloc(3 * strlen(item[i]) + 10);
 		convert_element(item[i], val);
-		val = nrealloc(val, strlen(val)+1);
+		val = realloc(val, strlen(val)+1);
 		setudef(ul, chan->dname, (int)val);
 		found = 1;
 		break;
@@ -1408,8 +1408,7 @@
 
 static void init_masklist(masklist *m)
 {
-  m->mask = (char *)nmalloc(1);
-  m->mask[0] = 0;
+  malloc_memset(m->mask, 0, 1);
   m->who = NULL;
   m->next = NULL;
 }
@@ -1421,21 +1420,19 @@
   chan->channel.maxmembers = 0;
   chan->channel.mode = 0;
   chan->channel.members = 0;
-  if (!reset) {
-    chan->channel.key = (char *) nmalloc(1);
-    chan->channel.key[0] = 0;
-  }
+  if (!reset)
+    malloc_memset(chan->channel.key, 0, 1);
 
-  chan->channel.ban = (masklist *) nmalloc(sizeof(masklist));
+  chan->channel.ban = (masklist *) malloc(sizeof(masklist));
   init_masklist(chan->channel.ban);
 
-  chan->channel.exempt = (masklist *) nmalloc(sizeof(masklist));
+  chan->channel.exempt = (masklist *) malloc(sizeof(masklist));
   init_masklist(chan->channel.exempt);
 
-  chan->channel.invite = (masklist *) nmalloc(sizeof(masklist));
+  chan->channel.invite = (masklist *) malloc(sizeof(masklist));
   init_masklist(chan->channel.invite);
 
-  chan->channel.member = (memberlist *) nmalloc(sizeof(memberlist));
+  chan->channel.member = (memberlist *) malloc(sizeof(memberlist));
   chan->channel.member->nick[0] = 0;
   chan->channel.member->next = NULL;
   chan->channel.topic = NULL;
@@ -1448,10 +1445,10 @@
   for (; m; m = temp) {
     temp = m->next;
     if (m->mask)
-      nfree(m->mask);
+      free(m->mask);
     if (m->who)
-      nfree(m->who);
-    nfree(m);
+      free(m->who);
+    free(m);
   }
 }
 
@@ -1462,10 +1459,10 @@
   memberlist *m, *m1;
 
   if (chan->channel.topic)
-    nfree(chan->channel.topic);
+    free(chan->channel.topic);
   for (m = chan->channel.member; m; m = m1) {
     m1 = m->next;
-    nfree(m);
+    free(m);
   }
 
   clear_masklist(chan->channel.ban);
@@ -1510,11 +1507,7 @@
     /* Already existing channel, maybe a reload of the channel file */
     chan->status &= ~CHAN_FLAGGED;	/* don't delete me! :) */
   } else {
-    chan = (struct chanset_t *) nmalloc(sizeof(struct chanset_t));
-
-    /* Hells bells, why set *every* variable to 0 when we have bzero? */
-    egg_bzero(chan, sizeof(struct chanset_t));
-
+    malloc_memset(chan, 0, sizeof(struct chanset_t));
     chan->limit_prot = 0;
     chan->limit = 0;
     chan->flood_pub_thr = gfld_chan_thr;
@@ -1603,9 +1596,8 @@
   }
   for (ul = udef; ul; ul = ul->next) {
     if (ul->type == type && !egg_strcasecmp(ul->name, argv[2])) {
-      nfree(ul->name);
-      ul->name = nmalloc(strlen(argv[3]) + 1);
-      strcpy(ul->name, argv[3]);
+      free(ul->name);
+      malloc_strcpy(ul->name, argv[3]);
       found = 1;
     }
   }
@@ -1639,18 +1631,18 @@
       break;
     if (ull->type == type && !egg_strcasecmp(ull->name, argv[2])) {
       ul->next = ull->next;
-      nfree(ull->name);
+      free(ull->name);
       free_udef_chans(ull->values, ull->type);
-      nfree(ull);
+      free(ull);
       found = 1;
     }
   }
   if (udef) {
     if (udef->type == type && !egg_strcasecmp(udef->name, argv[2])) {
       ul = udef->next;
-      nfree(udef->name);
+      free(udef->name);
       free_udef_chans(udef->values, udef->type);
-      nfree(udef);
+      free(udef);
       udef = ul;
       found = 1;
     }
Index: eggdrop1.7/src/mod/channels.mod/udefchan.c
diff -u eggdrop1.7/src/mod/channels.mod/udefchan.c:1.7 eggdrop1.7/src/mod/channels.mod/udefchan.c:1.8
--- eggdrop1.7/src/mod/channels.mod/udefchan.c:1.7	Wed Aug 22 23:06:10 2001
+++ eggdrop1.7/src/mod/channels.mod/udefchan.c	Wed Oct 10 05:44:05 2001
@@ -2,7 +2,7 @@
  * udefchan.c -- part of channels.mod
  *   user definable channel flags/settings
  *
- * $Id: udefchan.c,v 1.7 2001/08/23 04:06:10 stdarg Exp $
+ * $Id: udefchan.c,v 1.8 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -22,30 +22,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-static int expmem_udef(struct udef_struct *ul)
-{
-  int i = 0;
-
-  for (; ul; ul = ul->next) {
-    i += sizeof(struct udef_struct);
-    i += strlen(ul->name) + 1;
-    i += expmem_udef_chans(ul->type, ul->values);
-  }
-  return i;
-}
-
-static int expmem_udef_chans(int type, struct udef_chans *ul)
-{
-  int i = 0;
-
-  for (; ul; ul = ul->next) {
-    i += sizeof(struct udef_chans);
-    i += strlen(ul->chan) + 1;
-	if (type == UDEF_STR && ul->value) i += strlen((char *)ul->value) + 1;
-  }
-  return i;
-}
-
 static int getudef(struct udef_chans *ul, char *name)
 {
   int val = 0;
@@ -83,9 +59,8 @@
       return;
     }
 
-  ul = nmalloc(sizeof(struct udef_chans));
-  ul->chan = nmalloc(strlen(name) + 1);
-  strcpy(ul->chan, name);
+  ul = malloc(sizeof(struct udef_chans));
+  malloc_strcpy(ul->chan, name);
   ul->value = value;
   ul->next = NULL;
   if (ul_last)
@@ -110,9 +85,8 @@
     }
 
   debug2("Creating %s (type %d)", name, type);
-  ul = nmalloc(sizeof(struct udef_struct));
-  ul->name = nmalloc(strlen(name) + 1);
-  strcpy(ul->name, name);
+  ul = malloc(sizeof(struct udef_struct));
+  malloc_strcpy(ul->name, name);
   if (defined)
     ul->defined = 1;
   else
@@ -133,8 +107,8 @@
   for (; ul; ul = ull) {
     ull = ul->next;
     free_udef_chans(ul->values, ul->type);
-    nfree(ul->name);
-    nfree(ul);
+    free(ul->name);
+    free(ul);
   }
 }
 
@@ -145,9 +119,9 @@
   for (; ul; ul = ull) {
     ull = ul->next;
 	if (type == UDEF_STR && ul->value) {
-		nfree((void *)ul->value);
+		free((void *)ul->value);
 	}
-    nfree(ul->chan);
-    nfree(ul);
+    free(ul->chan);
+    free(ul);
   }
 }
Index: eggdrop1.7/src/mod/channels.mod/userchan.c
diff -u eggdrop1.7/src/mod/channels.mod/userchan.c:1.26 eggdrop1.7/src/mod/channels.mod/userchan.c:1.27
--- eggdrop1.7/src/mod/channels.mod/userchan.c:1.26	Sat Aug 18 21:36:23 2001
+++ eggdrop1.7/src/mod/channels.mod/userchan.c	Wed Oct 10 05:44:05 2001
@@ -1,7 +1,7 @@
 /*
  * userchan.c -- part of channels.mod
  *
- * $Id: userchan.c,v 1.26 2001/08/19 02:36:23 drummer Exp $
+ * $Id: userchan.c,v 1.27 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -37,7 +37,7 @@
   struct chanuserrec *ch = NULL;
 
   if (findchan_by_dname(chname)) {
-    ch = user_malloc(sizeof(struct chanuserrec));
+    ch = malloc(sizeof(struct chanuserrec));
 
     ch->next = u->chanrec;
     u->chanrec = ch;
@@ -102,16 +102,14 @@
     add_chanrec_by_handle(bu, handle, chname);
     ch = get_chanrec(u, chname);
   }
-  if (info) {
+  if (info)
     if (strlen(info) > 80)
       info[80] = 0;
-  }
   if (ch->info != NULL)
-    nfree(ch->info);
-  if (info && info[0]) {
-    ch->info = (char *) user_malloc(strlen(info) + 1);
-    strcpy(ch->info, info);
-  } else
+    free(ch->info);
+  if (info && info[0])
+    malloc_strcpy(ch->info, info);
+  else
     ch->info = NULL;
   cst = findchan_by_dname(chname);
   if ((!noshare) && (bu == userlist) &&
@@ -131,8 +129,8 @@
       else
 	lst->next = ch->next;
       if (ch->info != NULL)
-	nfree(ch->info);
-      nfree(ch);
+	free(ch->info);
+      free(ch);
       if (!noshare && !(u->flags & USER_UNSHARED))
 	shareout(findchan_by_dname(chname), "-cr %s %s\n", u->handle, chname);
       return;
@@ -264,19 +262,19 @@
 	  shareout(c, "-bc %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-b %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
     if (!c)
       gban_total--;
-    nfree((*u)->mask);
+    free((*u)->mask);
     if ((*u)->desc)
-      nfree((*u)->desc);
+      free((*u)->desc);
     if ((*u)->user)
-      nfree((*u)->user);
+      free((*u)->user);
     t = *u;
     *u = (*u)->next;
-    nfree(t);
+    free(t);
   }
   return i;
 }
@@ -315,19 +313,19 @@
 	  shareout(c, "-ec %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-e %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
     if (!c)
       gexempt_total--;
-    nfree((*u)->mask);
+    free((*u)->mask);
     if ((*u)->desc)
-      nfree((*u)->desc);
+      free((*u)->desc);
     if ((*u)->user)
-      nfree((*u)->user);
+      free((*u)->user);
     t = *u;
     *u = (*u)->next;
-    nfree(t);
+    free(t);
   }
   return i;
 }
@@ -366,19 +364,19 @@
 	  shareout(c, "-invc %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-inv %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
     if (!c)
       ginvite_total--;
-    nfree((*u)->mask);
+    free((*u)->mask);
     if ((*u)->desc)
-      nfree((*u)->desc);
+      free((*u)->desc);
     if ((*u)->user)
-      nfree((*u)->user);
+      free((*u)->user);
     t = *u;
     *u = (*u)->next;
-    nfree(t);
+    free(t);
   }
   return i;
 }
@@ -429,19 +427,16 @@
     expire_time = 0L;
   }
 
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host) + 1);
-  strcpy(p->mask, host);
-  p->user = user_malloc(strlen(from) + 1);
-  strcpy(p->user, from);
-  p->desc = user_malloc(strlen(note) + 1);
-  strcpy(p->desc, note);
+  malloc_strcpy(p->mask, host);
+  malloc_strcpy(p->user, from);
+  malloc_strcpy(p->desc, note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
 
@@ -454,7 +449,7 @@
 	shareout(chan, "+bc %s %lu %s %s%s %s %s\n", mask, expire_time - now,
 		 chan->dname, (flags & MASKREC_STICKY) ? "s" : "",
 		 (flags & MASKREC_PERM) ? "p" : "-", from, note);
-      nfree(mask);
+      free(mask);
     }
   }
   return 1;
@@ -494,19 +489,16 @@
     expire_time = 0L;
   }
 
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host)+1);
-  strcpy(p->mask,host);
-  p->user = user_malloc(strlen(from)+1);
-  strcpy(p->user,from);
-  p->desc = user_malloc(strlen(note)+1);
-  strcpy(p->desc,note);
+  malloc_strcpy(p->mask, host);
+  malloc_strcpy(p->user, from);
+  malloc_strcpy(p->desc, note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
 
@@ -519,7 +511,7 @@
 	shareout(chan, "+invc %s %lu %s %s%s %s %s\n", mask, expire_time - now,
 		 chan->dname, (flags & MASKREC_STICKY) ? "s" : "",
 		 (flags & MASKREC_PERM) ? "p": "-", from, note);
-      nfree(mask);
+      free(mask);
     }
   }
   return 1;
@@ -559,19 +551,16 @@
     expire_time = 0L;
   }
 
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host)+1);
-  strcpy(p->mask,host);
-  p->user = user_malloc(strlen(from)+1);
-  strcpy(p->user,from);
-  p->desc = user_malloc(strlen(note)+1);
-  strcpy(p->desc,note);
+  malloc_strcpy(p->mask, host);
+  malloc_strcpy(p->user, from);
+  malloc_strcpy(p->desc, note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
 
@@ -584,7 +573,7 @@
 	shareout(chan, "+ec %s %lu %s %s%s %s %s\n", mask, expire_time - now,
 		 chan->dname, (flags & MASKREC_STICKY) ? "s" : "",
 		 (flags & MASKREC_PERM) ? "p": "-", from, note);
-      nfree(mask);
+      free(mask);
     }
   }
   return 1;
@@ -1024,10 +1013,10 @@
 		i->user ? i->user : botnetnick, i->added,
 		i->msg ? i->msg : "") == EOF) {
       if (mask)
-	nfree(mask);
+	free(mask);
       return 0;
     }
-    nfree(mask);
+    free(mask);
   }
   if (global_bans)
     if (fprintf(f, BAN_NAME " - -\n") == EOF)	/* Daemus */
@@ -1041,10 +1030,10 @@
 		b->lastactive, b->user ? b->user : botnetnick,
 		b->desc ? b->desc : "requested") == EOF) {
       if (mask)
-	nfree(mask);
+	free(mask);
       return 0;
     }
-    nfree(mask);
+    free(mask);
   }
   for (chan = chanset; chan; chan = chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
@@ -1066,10 +1055,10 @@
 		      b->lastactive, b->user ? b->user : botnetnick,
 		      b->desc ? b->desc : "requested") == EOF) {
 	    if (mask)
-	      nfree(mask);
+	      free(mask);
 	    return 0;
 	  }
-	  nfree(mask);
+	  free(mask);
 	}
       }
     }
@@ -1096,10 +1085,10 @@
 		e->lastactive, e->user ? e->user : botnetnick,
 		e->desc ? e->desc : "requested") == EOF) {
       if (mask)
-	nfree(mask);
+	free(mask);
       return 0;
     }
-    nfree(mask);
+    free(mask);
   }
   for (chan = chanset;chan;chan=chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
@@ -1121,10 +1110,10 @@
 		      e->lastactive, e->user ? e->user : botnetnick,
 		      e->desc ? e->desc : "requested") == EOF) {
 	    if (mask)
-	      nfree(mask);
+	      free(mask);
 	    return 0;
 	  }
-	  nfree(mask);
+	  free(mask);
 	}
       }
     }
@@ -1151,10 +1140,10 @@
 		ir->lastactive, ir->user ? ir->user : botnetnick,
 		ir->desc ? ir->desc : "requested") == EOF) {
       if (mask)
-	nfree(mask);
+	free(mask);
       return 0;
     }
-    nfree(mask);
+    free(mask);
   }
   for (chan = chanset; chan; chan = chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
@@ -1176,10 +1165,10 @@
 		      ir->lastactive, ir->user ? ir->user : botnetnick,
 		      ir->desc ? ir->desc : "requested") == EOF) {
 	    if (mask)
-	      nfree(mask);
+	      free(mask);
 	    return 0;
 	  }
-	  nfree(mask);
+	  free(mask);
 	}
       }
     }
Index: eggdrop1.7/src/mod/compress.mod/compress.c
diff -u eggdrop1.7/src/mod/compress.mod/compress.c:1.13 eggdrop1.7/src/mod/compress.mod/compress.c:1.14
--- eggdrop1.7/src/mod/compress.mod/compress.c:1.13	Tue Oct  9 20:20:12 2001
+++ eggdrop1.7/src/mod/compress.mod/compress.c	Wed Oct 10 05:44:06 2001
@@ -6,7 +6,7 @@
  * Written by Fabian Knittel <fknittel at gmx.de>. Based on zlib examples
  * by Jean-loup Gailly and Miguel Albrecht.
  *
- * $Id: compress.c,v 1.13 2001/10/10 01:20:12 ite Exp $
+ * $Id: compress.c,v 1.14 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 2000, 2001 Eggheads Development Team
@@ -76,8 +76,8 @@
   FILE		 *fin;
   register int    len1, len2, i;
 
-  egg_memset(buf1, 0, 50);
-  egg_memset(buf2, 0, 50);
+  memset(buf1, 0, 50);
+  memset(buf2, 0, 50);
   if (!is_file(filename))
     return COMPF_FAILED;
 
@@ -292,7 +292,7 @@
   int   ret;
 
   /* Create temporary filename. */
-  temp_fn = nmalloc(strlen(filename) + 5);
+  temp_fn = malloc(strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);
@@ -306,7 +306,7 @@
   if (ret == COMPF_SUCCESS)
     movefile(temp_fn, filename);
 
-  nfree(temp_fn);
+  free(temp_fn);
   return ret;
 }
 
@@ -318,7 +318,7 @@
   int   ret;
 
   /* Create temporary filename. */
-  temp_fn = nmalloc(strlen(filename) + 5);
+  temp_fn = malloc(strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);
@@ -332,7 +332,7 @@
   if (ret == COMPF_SUCCESS)
     movefile(temp_fn, filename);
 
-  nfree(temp_fn);
+  free(temp_fn);
   return ret;
 }
 
@@ -376,11 +376,6 @@
   {NULL,                	NULL}
 };
 
-static int compress_expmem(void)
-{
-  return 0;
-}
-
 static int compress_report(int idx, int details)
 {
   if (details)
@@ -407,7 +402,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) compress_close,
-  (Function) compress_expmem,
+  (Function) 0,
   (Function) compress_report,
   /* 4 - 7 */
   (Function) compress_to_file,
Index: eggdrop1.7/src/mod/console.mod/console.c
diff -u eggdrop1.7/src/mod/console.mod/console.c:1.24 eggdrop1.7/src/mod/console.mod/console.c:1.25
--- eggdrop1.7/src/mod/console.mod/console.c:1.24	Tue Oct  9 20:20:12 2001
+++ eggdrop1.7/src/mod/console.mod/console.c	Wed Oct 10 05:44:06 2001
@@ -3,7 +3,7 @@
  *   saved console settings based on console.tcl
  *   by cmwagner/billyjoe/D. Senso
  *
- * $Id: console.c,v 1.24 2001/10/10 01:20:12 ite Exp $
+ * $Id: console.c,v 1.25 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -50,13 +50,12 @@
 
 static int console_unpack(struct userrec *u, struct user_entry *e)
 {
-  struct console_info *ci = user_malloc(sizeof(struct console_info));
+  struct console_info *ci = malloc(sizeof(struct console_info));
   char *par, *arg;
 
   par = e->u.list->extra;
   arg = newsplit(&par);
-  ci->channel = user_malloc(strlen(arg) + 1);
-  strcpy(ci->channel, arg);
+  malloc_strcpy(ci->channel, arg);
   arg = newsplit(&par);
   ci->conflags = logmodes(arg);
   arg = newsplit(&par);
@@ -76,22 +75,20 @@
 {
   char work[1024];
   struct console_info *ci;
-  int l;
 
   ci = (struct console_info *) e->u.extra;
 
-  l = simple_sprintf(work, "%s %s %s %d %d %d",
+  simple_sprintf(work, "%s %s %s %d %d %d",
 		     ci->channel, masktype(ci->conflags),
 		     stripmasktype(ci->stripflags), ci->echoflags,
 		     ci->page, ci->conchan);
 
-  e->u.list = user_malloc(sizeof(struct list_type));
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc(l + 1);
-  strcpy(e->u.list->extra, work);
+  malloc_strcpy(e->u.list->extra, work);
 
-  nfree(ci->channel);
-  nfree(ci);
+  free(ci->channel);
+  free(ci);
   return 1;
 }
 
@@ -99,9 +96,9 @@
 {
   struct console_info *i = e->u.extra;
 
-  nfree(i->channel);
-  nfree(i);
-  nfree(e);
+  free(i->channel);
+  free(i);
+  free(e);
   return 1;
 }
 
@@ -127,8 +124,8 @@
 
   if (ci != buf) {
     if (ci) {
-      nfree(ci->channel);
-      nfree(ci);
+      free(ci->channel);
+      free(ci);
     }
     ci = e->u.extra = buf;
   }
@@ -158,16 +155,14 @@
   int l;
 
   BADARGS(4, 9, " handle CONSOLE channel flags strip echo page conchan");
-  if (!i) {
-    i = user_malloc(sizeof(struct console_info));
-    egg_bzero(i, sizeof(struct console_info));
-  }
+  if (!i)
+    malloc_memset(i, 0, sizeof(struct console_info));
   if (i->channel)
-    nfree(i->channel);
+    free(i->channel);
   l = strlen(argv[3]);
   if (l > 80)
     l = 80;
-  i->channel = user_malloc(l + 1);
+  i->channel = malloc(l + 1);
   strncpy(i->channel, argv[3], l);
   i->channel[l] = 0;
   if (argc > 4) {
@@ -188,13 +183,6 @@
   return TCL_OK;
 }
 
-static int console_expmem(struct user_entry *e)
-{
-  struct console_info *i = e->u.extra;
-
-  return sizeof(struct console_info) + strlen(i->channel) + 1;
-}
-
 static void console_display(int idx, struct user_entry *e)
 {
   struct console_info *i = e->u.extra;
@@ -217,11 +205,10 @@
 {
   struct console_info *i = e->u.extra, *j;
 
-  j = user_malloc(sizeof(struct console_info));
-  my_memcpy(j, i, sizeof(struct console_info));
+  j = malloc(sizeof(struct console_info));
+  memcpy(j, i, sizeof(struct console_info));
 
-  j->channel = user_malloc(strlen(i->channel) + 1);
-  strcpy(j->channel, i->channel);
+  malloc_strcpy(j->channel, i->channel);
   return set_user(e->type, new, j);
 }
 
@@ -238,7 +225,6 @@
   console_set,
   console_tcl_get,
   console_tcl_set,
-  console_expmem,
   console_display,
   "CONSOLE"
 };
@@ -295,14 +281,11 @@
 {
   struct console_info *i = get_user(&USERENTRY_CONSOLE, u);
 
-  if (!i) {
-    i = user_malloc(sizeof(struct console_info));
-    egg_bzero(i, sizeof(struct console_info));
-  }
+  if (!i)
+    malloc_memset(i, 0, sizeof(struct console_info));
   if (i->channel)
-    nfree(i->channel);
-  i->channel = user_malloc(strlen(dcc[idx].u.chat->con_chan) + 1);
-  strcpy(i->channel, dcc[idx].u.chat->con_chan);
+    free(i->channel);
+  malloc_strcpy(i->channel, dcc[idx].u.chat->con_chan);
   i->conflags = dcc[idx].u.chat->con_flags;
   i->stripflags = dcc[idx].u.chat->strip_flags;
   i->echoflags = (dcc[idx].status & STAT_ECHO) ? 1 : 0;
Index: eggdrop1.7/src/mod/filesys.mod/dbcompat.c
diff -u eggdrop1.7/src/mod/filesys.mod/dbcompat.c:1.11 eggdrop1.7/src/mod/filesys.mod/dbcompat.c:1.12
--- eggdrop1.7/src/mod/filesys.mod/dbcompat.c:1.11	Fri Aug 10 18:51:21 2001
+++ eggdrop1.7/src/mod/filesys.mod/dbcompat.c	Wed Oct 10 05:44:06 2001
@@ -4,7 +4,7 @@
  *
  * Written for filedb3 by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: dbcompat.c,v 1.11 2001/08/10 23:51:21 ite Exp $
+ * $Id: dbcompat.c,v 1.12 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -43,10 +43,10 @@
   int in_file = 0, i;
   struct stat st;
 
-  s = nmalloc(strlen(path) + 8);
+  s = malloc(strlen(path) + 8);
   sprintf(s, "%s/.files", path);
   f = fopen(s, "r");
-  my_free(s);
+  free_null(s);
   if (f == NULL)
     return 0;
 
@@ -63,7 +63,7 @@
   putlog(LOG_FILES, "*", _("Converting filesystem image in %s ..."), path);
   /* Scan contents of .files and painstakingly create .filedb entries */
   while (!feof(f)) {
-    s = nmalloc(121);
+    s = malloc(121);
     s1 = s;
     fgets(s, 120, f);
     if (s[strlen(s) - 1] == '\n')
@@ -78,11 +78,11 @@
 	  if (in_file && fdbe) {
 	    rmspace(s);
 	    if (fdbe->desc) {
-	      fdbe->desc = nrealloc(fdbe->desc,
+	      fdbe->desc = realloc(fdbe->desc,
 				    strlen(fdbe->desc) + strlen(s) + 2);
 	      strcat(fdbe->desc, "\n");
 	    } else
-	      fdbe->desc = nmalloc(strlen(s) + 2);
+	      fdbe->desc = malloc(strlen(s) + 2);
 	    strcat(fdbe->desc, s);
 	  }
 	} else {
@@ -127,7 +127,7 @@
 	}
       }
     }
-    my_free(s);
+    free_null(s);
   }
   if (fdbe) {
     /* File pending. Write to DB */
@@ -244,7 +244,7 @@
     putlog(LOG_MISC, "*", "Converting old filedb %s to newest format.",
 	   filedb);
     /* Create temp DB name */
-    tempdb = nmalloc(strlen(filedb) + 5);
+    tempdb = malloc(strlen(filedb) + 5);
     simple_sprintf(tempdb, "%s-tmp", filedb);
 
     fdb_t = fopen(tempdb, "w+b");		/* Open temp DB		*/
@@ -279,7 +279,7 @@
       } else
         putlog(LOG_MISC, "*", "(!) Reopening db %s failed.", filedb);
     }
-    my_free(tempdb);
+    free_null(tempdb);
   /* Database already at the newest version? */
   } else if (fdbt.version == FILEDB_VERSION3) {
     ret = 1;					/* Always successfull	*/
Index: eggdrop1.7/src/mod/filesys.mod/filedb3.c
diff -u eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.20 eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.21
--- eggdrop1.7/src/mod/filesys.mod/filedb3.c:1.20	Fri Aug 10 18:51:21 2001
+++ eggdrop1.7/src/mod/filesys.mod/filedb3.c	Wed Oct 10 05:44:06 2001
@@ -4,7 +4,7 @@
  *
  * Rewritten by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filedb3.c,v 1.20 2001/08/10 23:51:21 ite Exp $
+ * $Id: filedb3.c,v 1.21 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -81,18 +81,18 @@
   if (!fdbe || !*fdbe)
     return;
   if ((*fdbe)->filename)
-    my_free((*fdbe)->filename);
+    free_null((*fdbe)->filename);
   if ((*fdbe)->desc)
-    my_free((*fdbe)->desc);
+    free_null((*fdbe)->desc);
   if ((*fdbe)->sharelink)
-    my_free((*fdbe)->sharelink);
+    free_null((*fdbe)->sharelink);
   if ((*fdbe)->chan)
-    my_free((*fdbe)->chan);
+    free_null((*fdbe)->chan);
   if ((*fdbe)->uploader)
-    my_free((*fdbe)->uploader);
+    free_null((*fdbe)->uploader);
   if ((*fdbe)->flags_req)
-    my_free((*fdbe)->flags_req);
-  my_free(*fdbe);
+    free_null((*fdbe)->flags_req);
+  free_null(*fdbe);
 }
 
 /* Allocates and initialises a filedb entry
@@ -101,15 +101,7 @@
 {
   filedb_entry *fdbe = NULL;
 
-#ifdef EBUG_MEM
-  /* This is a hack to access the nmalloc function with
-   * special file and line information
-   */
-  fdbe = ((void *) (global[0] (sizeof(filedb_entry), MODULE_NAME, file, line)));
-#else
-  fdbe = nmalloc(sizeof(filedb_entry));
-#endif
-  egg_bzero(fdbe, sizeof(filedb_entry));
+  malloc_memset(fdbe, 0, sizeof(filedb_entry));
 
   /* Mark as new, will be overwritten if necessary. */
   fdbe->_type = TYPE_NEW;
@@ -278,7 +270,7 @@
   int reposition = 0;
   int ndyntot, odyntot, nbuftot, obuftot;
 
-  egg_bzero(&fdh, sizeof(filedb_header));
+  memset(&fdh, 0, sizeof(filedb_header));
   fdh.uploaded = fdbe->uploaded;
   fdh.size = fdbe->size;
   fdh.stat = fdbe->stat;
@@ -414,7 +406,7 @@
 #define filedb_read(fdb, entry, len)	\
 {					\
   if ((len) > 0) {			\
-    (entry) = nmalloc((len));		\
+    (entry) = malloc((len));		\
     fread((entry), 1, (len), (fdb));	\
   }					\
 }
@@ -658,10 +650,10 @@
   while (dd != NULL) {
     malloc_strcpy(name, dd->d_name);
     if (name[0] != '.') {
-      s = nmalloc(strlen(path) + strlen(name) + 2);
+      s = malloc(strlen(path) + strlen(name) + 2);
       sprintf(s, "%s/%s", path, name);
       stat(s, &st);
-      my_free(s);
+      free_null(s);
       filedb_readtop(fdb, NULL);
       fdbe = filedb_matchfile(fdb, ftell(fdb), name);
       if (!fdbe) {
@@ -684,7 +676,7 @@
     dd = readdir(dir);
   }
   if (name)
-    my_free(name);
+    free_null(name);
   closedir(dir);
 
   /*
@@ -696,12 +688,12 @@
     where = ftell(fdb);
     if (!(fdbe->stat & FILE_UNUSED) && !(fdbe->stat & FILE_ISLINK) &&
 	fdbe->filename) {
-      s = nmalloc(strlen(path) + 1 + strlen(fdbe->filename) + 1);
+      s = malloc(strlen(path) + 1 + strlen(fdbe->filename) + 1);
       sprintf(s, "%s/%s", path, fdbe->filename);
       if (stat(s, &st) != 0)
 	/* gone file */
 	filedb_delfile(fdb, fdbe->pos);
-      my_free(s);
+      free_null(s);
     }
     free_fdbe(&fdbe);
     fdbe = filedb_getfile(fdb, where, GET_FILENAME);
@@ -746,18 +738,18 @@
 
   if (count >= 2)
     putlog(LOG_MISC, "*", "(@) warning: %d open filedb's", count);
-  npath = nmalloc(strlen(dccdir) + strlen(path) + 1);
+  npath = malloc(strlen(dccdir) + strlen(path) + 1);
   simple_sprintf(npath, "%s%s", dccdir, path);
   /* Use alternate filename if requested */
   if (filedb_path[0]) {
     char *s2;
 
     s2 = make_point_path(path);
-    s = nmalloc(strlen(filedb_path) + strlen(s2) + 8);
+    s = malloc(strlen(filedb_path) + strlen(s2) + 8);
     simple_sprintf(s, "%sfiledb.%s", filedb_path, s2);
-    my_free(s2);
+    free_null(s2);
   } else {
-    s = nmalloc(strlen(npath) + 10);
+    s = malloc(strlen(npath) + 10);
     simple_sprintf(s, "%s/.filedb", npath);
   }
   fdb = fopen(s, "r+b");
@@ -766,15 +758,15 @@
       fdb = fopen(s, "r+b");
       if (fdb == NULL) {
 	putlog(LOG_MISC, "*", _("(!) Broken convert to filedb in %s"), npath);
-	my_free(s);
-	my_free(npath);
+	free_null(s);
+	free_null(npath);
         return NULL;
       }
       lockfile(fdb);
       filedb_update(npath, fdb, sort);
       count++;
-      my_free(s);
-      my_free(npath);
+      free_null(s);
+      free_null(npath);
       return fdb;
     } else {
       filedb_top fdbt;
@@ -782,8 +774,8 @@
       /* Create new database and fix it up */
       fdb = fopen(s, "w+b");
       if (!fdb) {
-	my_free(s);
-	my_free(npath);
+	free_null(s);
+	free_null(npath);
 	return NULL;
       }
       lockfile(fdb);
@@ -792,8 +784,8 @@
       filedb_writetop(fdb, &fdbt);
       filedb_update(npath, fdb, sort);
       count++;
-      my_free(s);
-      my_free(npath);
+      free_null(s);
+      free_null(npath);
       return fdb;
     }
   }
@@ -808,8 +800,8 @@
        */
       if (fdb)
         unlockfile(fdb);
-      my_free(npath);
-      my_free(s);
+      free_null(npath);
+      free_null(s);
       return NULL;
     }
     filedb_update(npath, fdb, sort);
@@ -829,8 +821,8 @@
     filedb_mergeempty(fdb);
 
   count++;
-  my_free(npath);
-  my_free(s);
+  free_null(npath);
+  free_null(s);
   return fdb;
 }
 
@@ -859,7 +851,7 @@
   fdbe = filedb_matchfile(fdb, ftell(fdb), filename);
   if (!fdbe)
     return;
-  my_free(fdbe->uploader);
+  free_null(fdbe->uploader);
   malloc_strcpy(fdbe->uploader, nick);
   fdbe->uploaded = now;
   filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
@@ -913,21 +905,21 @@
 	/* Too long? */
 	if (strlen(fdbe->filename) > 45) {
 	  /* Display the filename on its own line. */
-	  s2 = nmalloc(strlen(fdbe->filename) + 3);
+	  s2 = malloc(strlen(fdbe->filename) + 3);
 	  sprintf(s2, "%s/\n", fdbe->filename);
 	  filelist_addout(flist, s2);
-	  my_free(s2);
+	  free_null(s2);
 	} else {
-	  s2 = nmalloc(strlen(fdbe->filename) + 2);
+	  s2 = malloc(strlen(fdbe->filename) + 2);
 	  sprintf(s2, "%s/", fdbe->filename);
 	}
-	/* Note: You have to keep the sprintf and the nmalloc statements
+	/* Note: You have to keep the sprintf and the malloc statements
 	 *       in sync, i.e. always check that you allocate enough
 	 *       memory.
 	 */
 	if ((fdbe->flags_req) &&
 	    (user.global &(USER_MASTER | USER_JANITOR))) {
-	  s3 = nmalloc(42 + strlen(s2 ? s2 : "") + 6 +
+	  s3 = malloc(42 + strlen(s2 ? s2 : "") + 6 +
 		       strlen(_("requires")) + strlen(fdbe->flags_req) + 1 +
 		       strlen(fdbe->chan ? fdbe->chan : "") + 1);
 	  sprintf(s3, "%-30s <DIR%s>  (%s %s%s%s)\n", s2,
@@ -935,13 +927,13 @@
 		  " SHARE" : "", _("requires"), fdbe->flags_req,
 		  fdbe->chan ? " " : "", fdbe->chan ? fdbe->chan : "");
 	} else {
-	  s3 = nmalloc(38 + strlen(s2 ? s2 : ""));
+	  s3 = malloc(38 + strlen(s2 ? s2 : ""));
 	  sprintf(s3, "%-30s <DIR>\n", s2 ? s2 : "");
 	}
 	if (s2)
-	  my_free(s2);
+	  free_null(s2);
 	filelist_addout(flist, s3);
-	my_free(s3);
+	free_null(s3);
       } else {
 	char s2[41], t[50], *s3 = NULL, *s4;
 
@@ -961,26 +953,26 @@
 	  strcpy(s1, "     ");
 	/* Too long? */
 	if (strlen(fdbe->filename) > 30) {
-	  s3 = nmalloc(strlen(fdbe->filename) + 2);
+	  s3 = malloc(strlen(fdbe->filename) + 2);
 	  sprintf(s3, "%s\n", fdbe->filename);
 	  filelist_addout(flist, s3);
-	  my_free(s3);
+	  free_null(s3);
 	  /* Causes filename to be displayed on its own line */
 	} else
 	  malloc_strcpy(s3, fdbe->filename);
-	s4 = nmalloc(69 + strlen(s3 ? s3 : "") + strlen(s1) +
+	s4 = malloc(69 + strlen(s3 ? s3 : "") + strlen(s1) +
 		     strlen(fdbe->uploader) + strlen(t) + strlen(s2));
 	sprintf(s4, "%-30s %s  %-9s (%s)  %6d%s\n", s3 ? s3 : "", s1,
 		fdbe->uploader, t, fdbe->gots, s2);
 	if (s3)
-	  my_free(s3);
+	  free_null(s3);
 	filelist_addout(flist, s4);
-	my_free(s4);
+	free_null(s4);
 	if (fdbe->sharelink) {
-	  s4 = nmalloc(9 + strlen(fdbe->sharelink));
+	  s4 = malloc(9 + strlen(fdbe->sharelink));
 	  sprintf(s4, "   --> %s\n", fdbe->sharelink);
 	  filelist_addout(flist, s4);
-	  my_free(s4);
+	  free_null(s4);
 	}
       }
       if (fdbe->desc) {
@@ -990,10 +982,10 @@
 	  if ((fdbe->desc)[0]) {
 	    char *sd;
 
-	    sd = nmalloc(strlen(fdbe->desc) + 5);
+	    sd = malloc(strlen(fdbe->desc) + 5);
 	    sprintf(sd, "   %s\n", fdbe->desc);
 	    filelist_addout(flist, sd);
-	    my_free(sd);
+	    free_null(sd);
 	  }
 	  strcpy(fdbe->desc, p + 1);
 	  p = strchr(fdbe->desc, '\n');
@@ -1001,10 +993,10 @@
 	if ((fdbe->desc)[0]) {
 	  char *sd;
 
-	  sd = nmalloc(strlen(fdbe->desc) + 5);
+	  sd = malloc(strlen(fdbe->desc) + 5);
 	  sprintf(sd, "   %s\n", fdbe->desc);
 	  filelist_addout(flist, sd);
-	  my_free(sd);
+	  free_null(sd);
 	}
       }
       cnt++;
@@ -1055,11 +1047,11 @@
 	  (fdbe->stat & (FILE_HIDDEN | FILE_DIR)))
 	reject = _("File is not shared");
       else {
-	s1 = nmalloc(strlen(dccdir) + strlen(dir) + strlen(what) + 2);
+	s1 = malloc(strlen(dccdir) + strlen(dir) + strlen(what) + 2);
 	/* Copy to /tmp if needed */
 	sprintf(s1, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", what);
 	if (copy_to_tmp) {
-	  s = nmalloc(strlen(tempdir) + strlen(what) + 1);
+	  s = malloc(strlen(tempdir) + strlen(what) + 1);
 	  sprintf(s, "%s%s", tempdir, what);
 	  copyfile(s1, s);
 	} else
@@ -1070,32 +1062,32 @@
 	  reject = _("Error trying to send file");
 	}
 	if (s1 != s)
-	  my_free(s);
-	my_free(s1);
+	  free_null(s);
+	free_null(s1);
       }
       free_fdbe(&fdbe);
     }
   }
-  s1 = nmalloc(strlen(botnetnick) + strlen(dir) + strlen(what) + 3);
+  s1 = malloc(strlen(botnetnick) + strlen(dir) + strlen(what) + 3);
   simple_sprintf(s1, "%s:%s/%s", botnetnick, dir, what);
   if (reject) {
     botnet_send_filereject(idx, s1, from, reject);
-    my_free(s1);
-    my_free(what);
-    my_free(dir);
+    free_null(s1);
+    free_null(what);
+    free_null(dir);
     return;
   }
   /* Grab info from dcc struct and bounce real request across net */
   i = dcc_total - 1;
-  s = nmalloc(40);	/* Enough? */
+  s = malloc(40);	/* Enough? */
   simple_sprintf(s, "%d %u %d", iptolong(getmyip()), dcc[i].port,
 		dcc[i].u.xfer->length);
   botnet_send_filesend(idx, s1, from, s);
   putlog(LOG_FILES, "*", _("Remote request for /%s%s%s (sending)"), dir, dir[0] ? "/" : "", what);
-  my_free(s1);
-  my_free(s);
-  my_free(what);
-  my_free(dir);
+  free_null(s1);
+  free_null(s);
+  free_null(what);
+  free_null(dir);
 }
 
 
@@ -1109,8 +1101,8 @@
 
   fdbe = filedb_getentry(dir, fn);
   if (fdbe) {
-    *desc = nmalloc(strlen(fdbe->desc) + 1);
-    strcpy(*desc, fdbe->desc);
+    *desc = NULL;
+    malloc_strcpy(*desc, fdbe->desc);
     free_fdbe(&fdbe);
   } else
     *desc = NULL;
@@ -1122,8 +1114,8 @@
 
   fdbe = filedb_getentry(dir, fn);
   if (fdbe) {
-    *owner = nmalloc(strlen(fdbe->uploader) + 1);
-    strcpy(*owner, fdbe->uploader);
+    *owner = NULL;
+    malloc_strcpy(*owner, fdbe->uploader);
     free_fdbe(&fdbe);
   } else
     *owner = NULL;
@@ -1153,7 +1145,7 @@
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), fn);
   if (fdbe) {
-    my_free(fdbe->desc);
+    free_null(fdbe->desc);
     malloc_strcpy(fdbe->desc, desc);
     filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
     free_fdbe(&fdbe);
@@ -1172,7 +1164,7 @@
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), fn);
   if (fdbe) {
-    my_free(fdbe->uploader);
+    free_null(fdbe->uploader);
     malloc_strcpy(fdbe->uploader, owner);
     filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
     free_fdbe(&fdbe);
@@ -1197,7 +1189,7 @@
     if (!link || !link[0])
       filedb_delfile(fdb, fdbe->pos);
     else {
-      my_free(fdbe->sharelink);
+      free_null(fdbe->sharelink);
       malloc_strcpy(fdbe->sharelink, link);
       filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
     }
@@ -1221,6 +1213,7 @@
 
   fdbe = filedb_getentry(dir, fn);
   if (fdbe && (!(fdbe->stat & FILE_DIR))) {
+    *link = NULL;
     malloc_strcpy(*link, fdbe->sharelink);
   } else
     *link = NULL;
Index: eggdrop1.7/src/mod/filesys.mod/filedb3.h
diff -u eggdrop1.7/src/mod/filesys.mod/filedb3.h:1.10 eggdrop1.7/src/mod/filesys.mod/filedb3.h:1.11
--- eggdrop1.7/src/mod/filesys.mod/filedb3.h:1.10	Wed Apr 11 21:39:46 2001
+++ eggdrop1.7/src/mod/filesys.mod/filedb3.h	Wed Oct 10 05:44:06 2001
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filedb3.h,v 1.10 2001/04/12 02:39:46 guppy Exp $
+ * $Id: filedb3.h,v 1.11 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -79,27 +79,8 @@
 
 
 /*
- *   Macros
+ * Macros
  */
-
-#define my_free(ptr)							\
-  if (ptr) {								\
-    nfree(ptr);								\
-    ptr = NULL;								\
-  }
-
-/* Copy entry to target -- Uses dynamic memory allocation, which
- * means you'll eventually have to free the memory again. 'target'
- * will be overwritten.
- */
-#define malloc_strcpy(target, entry)					\
-do {									\
-  if (entry) {								\
-    (target) = nrealloc((target), strlen(entry) + 1);			\
-    strcpy((target), (entry));						\
-  } else								\
-    my_free(target);							\
-} while (0)
 
 /* Macro to calculate the total length of dynamic data. */
 #define filedb_tot_dynspace(fdh) ((fdh).filename_len + (fdh).desc_len +	\
Index: eggdrop1.7/src/mod/filesys.mod/filelist.c
diff -u eggdrop1.7/src/mod/filesys.mod/filelist.c:1.9 eggdrop1.7/src/mod/filesys.mod/filelist.c:1.10
--- eggdrop1.7/src/mod/filesys.mod/filelist.c:1.9	Wed Apr 11 21:39:46 2001
+++ eggdrop1.7/src/mod/filesys.mod/filelist.c	Wed Oct 10 05:44:06 2001
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filelist.c,v 1.9 2001/04/12 02:39:46 guppy Exp $
+ * $Id: filelist.c,v 1.10 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -30,7 +30,7 @@
 {
   filelist_t *flist;
 
-  flist = nmalloc(sizeof(filelist_t));
+  flist = malloc(sizeof(filelist_t));
   flist->tot = 0;
   flist->elements = NULL;
   return flist;
@@ -44,12 +44,12 @@
     return;
   for (i = 0; i < flist->tot; i++) {
     if (flist->elements[i].output)
-      my_free(flist->elements[i].output);
-    my_free(flist->elements[i].fn);
+      free_null(flist->elements[i].output);
+    free_null(flist->elements[i].fn);
   }
   if (flist->elements)
-    my_free(flist->elements);
-  my_free(flist);
+    free_null(flist->elements);
+  free_null(flist);
 }
 
 /* Increase number of filelist entries.
@@ -57,9 +57,8 @@
 static void filelist_add(filelist_t *flist, char *filename)
 {
   flist->tot++;
-  flist->elements = nrealloc(flist->elements, flist->tot * sizeof(filelist_t));
-  FILELIST_LE(flist).fn = nmalloc(strlen(filename) + 1);
-  strcpy(FILELIST_LE(flist).fn, filename);
+  flist->elements = realloc(flist->elements, flist->tot * sizeof(filelist_t));
+  malloc_strcpy(FILELIST_LE(flist).fn, filename);
   FILELIST_LE(flist).output = NULL;
 }
 
@@ -68,12 +67,10 @@
 static void filelist_addout(filelist_t *flist, char *desc)
 {
   if (FILELIST_LE(flist).output) {
-    FILELIST_LE(flist).output = nrealloc(FILELIST_LE(flist).output, strlen(FILELIST_LE(flist).output) + strlen(desc) + 1);
+    FILELIST_LE(flist).output = realloc(FILELIST_LE(flist).output, strlen(FILELIST_LE(flist).output) + strlen(desc) + 1);
     strcat(FILELIST_LE(flist).output, desc);
-  } else {
-    FILELIST_LE(flist).output = nmalloc(strlen(desc) + 1);
-    strcpy(FILELIST_LE(flist).output, desc);
-  }
+  } else
+    malloc_strcpy(FILELIST_LE(flist).output, desc);
 }
 
 /* Dump all data to specified idx */
Index: eggdrop1.7/src/mod/filesys.mod/files.c
diff -u eggdrop1.7/src/mod/filesys.mod/files.c:1.29 eggdrop1.7/src/mod/filesys.mod/files.c:1.30
--- eggdrop1.7/src/mod/filesys.mod/files.c:1.29	Fri Aug 10 18:51:21 2001
+++ eggdrop1.7/src/mod/filesys.mod/files.c	Wed Oct 10 05:44:06 2001
@@ -2,7 +2,7 @@
  * files.c - part of filesys.mod
  *   handles all file system commands
  *
- * $Id: files.c,v 1.29 2001/08/10 23:51:21 ite Exp $
+ * $Id: files.c,v 1.30 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -160,7 +160,7 @@
   malloc_strcpy(*real, current);
   if (!change[0])
     return 1;				/* No change? */
-  new = nmalloc(strlen(change) + 2);	/* Add 2, because we add '/' below */
+  new = malloc(strlen(change) + 2);	/* Add 2, because we add '/' below */
   strcpy(new, change);
   if (new[0] == '/') {
     /* EVERYONE has access here */
@@ -182,8 +182,8 @@
       if (p == NULL) {
 	/* Can't go back from here? */
 	if (!(*real)[0]) {
-	  my_free(elem);
-	  my_free(new);
+	  free_null(elem);
+	  free_null(new);
 	  malloc_strcpy(*real, current);
 	  return 0;
 	}
@@ -195,8 +195,8 @@
       fdb = filedb_open(*real, 0);
       if (!fdb) {
 	/* Non-existent starting point! */
-	my_free(elem);
-	my_free(new);
+	free_null(elem);
+	free_null(new);
 	malloc_strcpy(*real, current);
 	return 0;
       }
@@ -205,16 +205,16 @@
       filedb_close(fdb);
       if (!fdbe) {
 	/* Non-existent */
-	my_free(elem);
-	my_free(new);
+	free_null(elem);
+	free_null(new);
 	malloc_strcpy(*real, current);
 	return 0;
       }
       if (!(fdbe->stat & FILE_DIR) || fdbe->sharelink) {
 	/* Not a dir */
 	free_fdbe(&fdbe);
-	my_free(elem);
-	my_free(new);
+	free_null(elem);
+	free_null(new);
 	malloc_strcpy(*real, current);
 	return 0;
       }
@@ -228,8 +228,8 @@
         break_down_flags(fdbe->flags_req, &req, NULL);
         if (!flagrec_ok(&req, &user)) {
 	  free_fdbe(&fdbe);
-	  my_free(elem);
-	  my_free(new);
+	  free_null(elem);
+	  free_null(new);
 	  malloc_strcpy(*real, current);
 	  return 0;
 	}
@@ -239,24 +239,24 @@
       if (s[0])
 	if (s[strlen(s) - 1] != '/')
 	  strcat(s, "/");
-      work = nmalloc(strlen(s) + strlen(elem) + 1);
+      work = malloc(strlen(s) + strlen(elem) + 1);
       sprintf(work, "%s%s", s, elem);
       malloc_strcpy(*real, work);
-      s = nrealloc(s, strlen(dccdir) + strlen(*real) + 1);
+      s = realloc(s, strlen(dccdir) + strlen(*real) + 1);
       sprintf(s, "%s%s", dccdir, *real);
     }
     p = strchr(new, '/');
   }
-  my_free(new);
+  free_null(new);
   if (elem)
-    my_free(elem);
+    free_null(elem);
   if (work)
-    my_free(work);
+    free_null(work);
   /* Sanity check: does this dir exist? */
-  s = nrealloc(s, strlen(dccdir) + strlen(*real) + 1);
+  s = realloc(s, strlen(dccdir) + strlen(*real) + 1);
   sprintf(s, "%s%s", dccdir, *real);
   dir = opendir(s);
-  my_free(s);
+  free_null(s);
   if (!dir)
     return 0;
   closedir(dir);
@@ -287,16 +287,16 @@
   }
   fdb = filedb_open(destdir, 0);
   if (!fdb) {
-    my_free(path);
-    my_free(destdir);
-    my_free(fn);
+    free_null(path);
+    free_null(destdir);
+    free_null(fn);
     return;			/* Not my concern, then */
   }
-  my_free(path);
-  my_free(destdir);
+  free_null(path);
+  free_null(destdir);
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), fn);
-  my_free(fn);
+  free_null(fn);
   if (fdbe) {
     fdbe->gots++;
     filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_HEADER);
@@ -339,11 +339,11 @@
   }
   if (!resolve_dir(dcc[idx].u.file->dir, msg, &s, idx)) {
     dprintf(idx, _("No such directory.\n"));
-    my_free(s);
+    free_null(s);
     return;
   }
   strncpy(dcc[idx].u.file->dir, s, 160);
-  my_free(s);
+  free_null(s);
   dcc[idx].u.file->dir[160] = 0;
   set_user(&USERENTRY_DCCDIR, dcc[idx].user, dcc[idx].u.file->dir);
   putlog(LOG_FILES, "*", "files: #%s# cd /%s", dcc[idx].nick,
@@ -365,12 +365,12 @@
       malloc_strcpy(mask, p + 1);
       if (!resolve_dir(dcc[idx].u.file->dir, s, &destdir, idx)) {
 	dprintf(idx, _("Illegal directory.\n"));
-	my_free(s);
-	my_free(mask);
-	my_free(destdir);
+	free_null(s);
+	free_null(mask);
+	free_null(destdir);
 	return;
       }
-      my_free(s);
+      free_null(s);
     } else {
       malloc_strcpy(destdir, dcc[idx].u.file->dir);
       malloc_strcpy(mask, par);
@@ -381,18 +381,18 @@
       malloc_strcpy(destdir, s);
       malloc_strcpy(mask, "*");
     }
-    my_free(s);
+    free_null(s);
     fdb = filedb_open(destdir, 0);
     if (!fdb) {
       dprintf(idx, _("Illegal directory.\n"));
-      my_free(destdir);
-      my_free(mask);
+      free_null(destdir);
+      free_null(mask);
       return;
     }
     filedb_ls(fdb, idx, mask, showall);
     filedb_close(fdb);
-    my_free(destdir);
-    my_free(mask);
+    free_null(destdir);
+    free_null(mask);
   } else {
     putlog(LOG_FILES, "*", "files: #%s# ls", dcc[idx].nick);
     fdb = filedb_open(dcc[idx].u.file->dir, 0);
@@ -446,12 +446,12 @@
     malloc_strcpy(s, what);
     strcpy(what, p + 1);
     if (!resolve_dir(dcc[idx].u.file->dir, s, &destdir, idx)) {
-      my_free(destdir);
-      my_free(s);
+      free_null(destdir);
+      free_null(s);
       dprintf(idx, _("Illegal directory.\n"));
       return;
     }
-    my_free(s);
+    free_null(s);
   } else
     malloc_strcpy(destdir, dcc[idx].u.file->dir);
   fdb = filedb_open(destdir, 0);
@@ -462,7 +462,7 @@
   if (!fdbe) {
     filedb_close(fdb);
     free_fdbe(&fdbe);
-    my_free(destdir);
+    free_null(destdir);
     dprintf(idx, _("No matching files.\n"));
     return;
   }
@@ -474,7 +474,7 @@
 	char *bot, *whoto = NULL;
 
 	/* This is a link to a file on another bot... */
-	bot = nmalloc(strlen(fdbe->sharelink) + 1);
+	bot = malloc(strlen(fdbe->sharelink) + 1);
 	splitc(bot, fdbe->sharelink, ':');
 	if (!egg_strcasecmp(bot, botnetnick)) {
 	  dprintf(idx, "Can't get that file, it's linked to this bot!\n");
@@ -485,20 +485,20 @@
 	  malloc_strcpy(whoto, par);
 	  if (!whoto[0])
 	    malloc_strcpy(whoto, dcc[idx].nick);
-	  s = nmalloc(strlen(whoto) + strlen(botnetnick) + 13);
+	  s = malloc(strlen(whoto) + strlen(botnetnick) + 13);
 	  simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, whoto, botnetnick);
 	  botnet_send_filereq(i, s, bot, fdbe->sharelink);
 	  dprintf(idx, _("Requested %s from %s ...\n"), fdbe->sharelink, bot);
 	  /* Increase got count now (or never) */
 	  fdbe->gots++;
-	  s = nrealloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
+	  s = realloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
 	  sprintf(s, "%s:%s", bot, fdbe->sharelink);
 	  malloc_strcpy(fdbe->sharelink, s);
 	  filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
-	  my_free(whoto);
-	  my_free(s);
+	  free_null(whoto);
+	  free_null(s);
 	}
-	my_free(bot);
+	free_null(bot);
       } else {
 	do_dcc_send(idx, destdir, fdbe->filename, par, resend);
 	/* Don't increase got count till later */
@@ -508,7 +508,7 @@
     fdbe = filedb_matchfile(fdb, where, what);
   }
   filedb_close(fdb);
-  my_free(destdir);
+  free_null(destdir);
   if (!ok)
     dprintf(idx, _("No matching files.\n"));
   else
@@ -534,11 +534,11 @@
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.file->chat->con_chan);
   if (par[0]) {
     putlog(LOG_FILES, "*", "files: #%s# help %s", dcc[idx].nick, par);
-    s = nmalloc(strlen(par) + 9);
+    s = malloc(strlen(par) + 9);
     sprintf(s, "filesys/%s", par);
     s[256] = 0;
     tellhelp(idx, s, &fr, 0);
-    my_free(s);
+    free_null(s);
   } else {
     putlog(LOG_FILES, "*", "files: #%s# help", dcc[idx].nick);
     tellhelp(idx, "filesys/help", &fr, 0);
@@ -737,8 +737,8 @@
       malloc_strcpy(newfn, p + 1);
       if (!resolve_dir(dcc[idx].u.file->dir, par, &newpath, idx)) {
 	dprintf(idx, _("No such directory.\n"));
-	my_free(newfn);
-	my_free(newpath);
+	free_null(newfn);
+	free_null(newpath);
 	return;
       }
     } else {
@@ -747,8 +747,8 @@
     }
     fdb = filedb_open(newpath, 0);
     if (!fdb) {
-      my_free(newfn);
-      my_free(newpath);
+      free_null(newfn);
+      free_null(newpath);
       return;
     }
     filedb_readtop(fdb, NULL);
@@ -779,8 +779,8 @@
 	     newpath, newpath[0] ? "/" : "", newfn, share);
     }
     free_fdbe(&fdbe);
-    my_free(newpath);
-    my_free(newfn);
+    free_null(newpath);
+    free_null(newfn);
   }
 }
 
@@ -798,7 +798,7 @@
     return;
   }
   /* Fix up desc */
-  desc = nmalloc(strlen(par) + 2);
+  desc = malloc(strlen(par) + 2);
   strcpy(desc, par);
   strcat(desc, "|");
   /* Replace | with linefeeds, limit 5 lines */
@@ -837,7 +837,7 @@
     desc[strlen(desc) - 1] = 0;
   fdb = filedb_open(dcc[idx].u.file->dir, 0);
   if (!fdb) {
-    my_free(desc);
+    free_null(desc);
     return;
   }
   filedb_readtop(fdb, NULL);
@@ -845,7 +845,7 @@
   if (!fdbe) {
     filedb_close(fdb);
     dprintf(idx, _("No matching files.\n"));
-    my_free(desc);
+    free_null(desc);
     return;
   }
   while (fdbe) {
@@ -867,7 +867,7 @@
 	  }
 	  malloc_strcpy(fdbe->desc, desc);
 	} else if (fdbe->desc) {
-	  my_free(fdbe->desc);
+	  free_null(fdbe->desc);
 	}
 	filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
 	if (par[0])
@@ -884,7 +884,7 @@
     dprintf(idx, _("No matching files.\n"));
   else
     putlog(LOG_FILES, "*", "files: #%s# desc %s", dcc[idx].nick, fn);
-  my_free(desc);
+  free_null(desc);
 }
 
 static void cmd_rm(int idx, char *par)
@@ -912,7 +912,7 @@
   while (fdbe) {
     where = ftell(fdb);
     if (!(fdbe->stat & (FILE_HIDDEN | FILE_DIR))) {
-      s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
+      s = malloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
 		  + strlen(fdbe->filename) + 2);
       sprintf(s, "%s%s/%s", dccdir, dcc[idx].u.file->dir, fdbe->filename);
       ok++;
@@ -921,7 +921,7 @@
       if (!(fdbe->sharelink))
 	unlink(s);
       dprintf(idx, "%s: %s\n", _("Erased"), fdbe->filename);
-      my_free(s);
+      free_null(s);
     }
     free_fdbe(&fdbe);
     fdbe = filedb_matchfile(fdb, where, par);
@@ -983,16 +983,16 @@
     filedb_readtop(fdb, NULL);
     fdbe = filedb_matchfile(fdb, ftell(fdb), name);
     if (!fdbe) {
-      s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
+      s = malloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
 		  + strlen(name) + 2);
       sprintf(s, "%s%s/%s", dccdir, dcc[idx].u.file->dir, name);
       if (mkdir(s, 0755) != 0) {
 	dprintf(idx, _("Failed.\n"));
 	filedb_close(fdb);
-	my_free(s);
+	free_null(s);
 	return;
       }
-      my_free(s);
+      free_null(s);
       fdbe = malloc_fdbe();
       fdbe->stat = FILE_DIR;
       malloc_strcpy(fdbe->filename, name);
@@ -1013,14 +1013,14 @@
       malloc_strcpy(fdbe->flags_req, buffer);
       dprintf(idx, _("Changed %s/ to require +%s to access\n"), name, buffer);
     } else if (!chan[0]) {
-      my_free(fdbe->flags_req);
+      free_null(fdbe->flags_req);
       dprintf(idx, _("Changes %s/ to require no flags to access\n"), name);
     }
     if (chan[0]) {
       malloc_strcpy(fdbe->chan, chan);
       dprintf(idx, "Access set to channel: %s\n", chan);
     } else if (!flags[0]) {
-      my_free(fdbe->chan);
+      free_null(fdbe->chan);
       dprintf(idx, "Access set to all channels.\n");
     }
     if (!fdbe->pos)
@@ -1046,7 +1046,7 @@
   else {
     fdb = filedb_open(dcc[idx].u.file->dir, 0);
     if (!fdb) {
-      my_free(name);
+      free_null(name);
       return;
     }
     filedb_readtop(fdb, NULL);
@@ -1054,18 +1054,18 @@
     if (!fdbe) {
       dprintf(idx, _("No such directory.\n"));
       filedb_close(fdb);
-      my_free(name);
+      free_null(name);
       return;
     }
     if (!(fdbe->stat & FILE_DIR)) {
       dprintf(idx, _("No such directory.\n"));
       filedb_close(fdb);
-      my_free(name);
+      free_null(name);
       free_fdbe(&fdbe);
       return;
     }
     /* Erase '.filedb' and '.files' if they exist */
-    s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
+    s = malloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
 		+ strlen(name) + 10);
     sprintf(s, "%s%s/%s/.filedb", dccdir, dcc[idx].u.file->dir, name);
     unlink(s);
@@ -1078,16 +1078,16 @@
       filedb_delfile(fdb, fdbe->pos);
       filedb_close(fdb);
       free_fdbe(&fdbe);
-      my_free(s);
-      my_free(name);
+      free_null(s);
+      free_null(name);
       putlog(LOG_FILES, "*", "files: #%s# rmdir %s", dcc[idx].nick, name);
       return;
     }
     dprintf(idx, _("Failed.\n"));
     filedb_close(fdb);
     free_fdbe(&fdbe);
-    my_free(s);
-    my_free(name);
+    free_null(s);
+    free_null(name);
   }
 }
 
@@ -1113,11 +1113,11 @@
     strcpy(fn, p + 1);
     if (!resolve_dir(dcc[idx].u.file->dir, s, &oldpath, idx)) {
       dprintf(idx, _("Illegal source directory.\n"));
-      my_free(s);
-      my_free(oldpath);
+      free_null(s);
+      free_null(oldpath);
       return;
     }
-    my_free(s);
+    free_null(s);
   } else
     malloc_strcpy(oldpath, dcc[idx].u.file->dir);
   malloc_strcpy(s, par);
@@ -1133,22 +1133,22 @@
     }
     if (!resolve_dir(dcc[idx].u.file->dir, s, &newpath, idx)) {
       dprintf(idx, _("Illegal destination directory.\n"));
-      my_free(newfn);
-      my_free(s);
-      my_free(oldpath);
-      my_free(newpath);
+      free_null(newfn);
+      free_null(s);
+      free_null(oldpath);
+      free_null(newpath);
       return;
     }
   } else
     malloc_strcpy(newfn, "");
-  my_free(s);
+  free_null(s);
   /* Stupidness checks */
   if ((!strcmp(oldpath, newpath)) &&
       ((!newfn[0]) || (!strcmp(newfn, fn)))) {
     dprintf(idx, _("You cant %s files on top of themselves.\n"), copy ? _("copy") : _("move"));
-    my_free(oldpath);
-    my_free(newpath);
-    my_free(newfn);
+    free_null(oldpath);
+    free_null(newpath);
+    free_null(newfn);
     return;
   }
   /* Be aware of 'cp * this.file' possibility: ONLY COPY FIRST ONE */
@@ -1163,9 +1163,9 @@
   else
     fdb_new = filedb_open(newpath, 0);
   if (!fdb_old || !fdb_new) {
-    my_free(oldpath);
-    my_free(newpath);
-    my_free(newfn);
+    free_null(oldpath);
+    free_null(newpath);
+    free_null(newfn);
     return;
   }
 
@@ -1175,18 +1175,18 @@
     if (fdb_new != fdb_old)
       filedb_close(fdb_new);
     filedb_close(fdb_old);
-    my_free(oldpath);
-    my_free(newpath);
-    my_free(newfn);
+    free_null(oldpath);
+    free_null(newpath);
+    free_null(newfn);
     return;
   }
   while (fdbe_old) {
     where = ftell(fdb_old);
     skip_this = 0;
     if (!(fdbe_old->stat & (FILE_HIDDEN | FILE_DIR))) {
-      s = nmalloc(strlen(dccdir) + strlen(oldpath)
+      s = malloc(strlen(dccdir) + strlen(oldpath)
 		  + strlen(fdbe_old->filename) + 2);
-      s1 = nmalloc(strlen(dccdir) + strlen(newpath)
+      s1 = malloc(strlen(dccdir) + strlen(newpath)
 		   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
       sprintf(s, "%s%s%s%s", dccdir, oldpath,
 	      oldpath[0] ? "/" : "", fdbe_old->filename);
@@ -1243,8 +1243,8 @@
 	  free_fdbe(&fdbe_new);
 	}
       }
-      my_free(s);
-      my_free(s1);
+      free_null(s);
+      free_null(s1);
     }
     free_fdbe(&fdbe_old);
     fdbe_old = filedb_matchfile(fdb_old, where, fn);
@@ -1263,9 +1263,9 @@
       dprintf(idx, "%s %d file%s.\n",
 	      copy ? _("Copied") : _("Moved"), ok, ok == 1 ? "" : "s");
   }
-  my_free(oldpath);
-  my_free(newpath);
-  my_free(newfn);
+  free_null(oldpath);
+  free_null(newpath);
+  free_null(newfn);
 }
 
 static void cmd_mv(int idx, char *par)
@@ -1375,34 +1375,34 @@
     malloc_strcpy(s, fn);
     malloc_strcpy(what, p + 1);
     if (!resolve_dir(dcc[idx].u.file->dir, s, &destdir, idx)) {
-      my_free(s);
-      my_free(what);
-      my_free(destdir);
+      free_null(s);
+      free_null(what);
+      free_null(destdir);
       return 0;
     }
-    my_free(s);
+    free_null(s);
   } else {
     malloc_strcpy(destdir, dcc[idx].u.file->dir);
     malloc_strcpy(what, fn);
   }
   fdb = filedb_open(destdir, 0);
   if (!fdb) {
-    my_free(what);
-    my_free(destdir);
+    free_null(what);
+    free_null(destdir);
     return 0;
   }
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), what);
   if (!fdbe) {
     filedb_close(fdb);
-    my_free(what);
-    my_free(destdir);
+    free_null(what);
+    free_null(destdir);
     return 0;
   }
   if (fdbe->stat & (FILE_HIDDEN | FILE_DIR)) {
     filedb_close(fdb);
-    my_free(what);
-    my_free(destdir);
+    free_null(what);
+    free_null(destdir);
     free_fdbe(&fdbe);
     return 0;
   }
@@ -1410,21 +1410,21 @@
     char *bot, *whoto = NULL;
 
     /* This is a link to a file on another bot... */
-    bot = nmalloc(strlen(fdbe->sharelink) + 1);
+    bot = malloc(strlen(fdbe->sharelink) + 1);
     splitc(bot, fdbe->sharelink, ':');
     if (!egg_strcasecmp(bot, botnetnick)) {
       /* Linked to myself *duh* */
       filedb_close(fdb);
-      my_free(what);
-      my_free(destdir);
-      my_free(bot);
+      free_null(what);
+      free_null(destdir);
+      free_null(bot);
       free_fdbe(&fdbe);
       return 0;
     } else if (!in_chain(bot)) {
       filedb_close(fdb);
-      my_free(what);
-      my_free(destdir);
-      my_free(bot);
+      free_null(what);
+      free_null(destdir);
+      free_null(bot);
       free_fdbe(&fdbe);
       return 0;
     } else {
@@ -1434,30 +1434,30 @@
       } else {
 	malloc_strcpy(whoto, dcc[idx].nick);
       }
-      s = nmalloc(strlen(whoto) + strlen(botnetnick) + 13);
+      s = malloc(strlen(whoto) + strlen(botnetnick) + 13);
       simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, whoto, botnetnick);
       botnet_send_filereq(i, s, bot, fdbe->sharelink);
       dprintf(idx, _("Requested %s from %s ...\n"), fdbe->sharelink, bot);
       /* Increase got count now (or never) */
       fdbe->gots++;
-      s = nrealloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
+      s = realloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
       sprintf(s, "%s:%s", bot, fdbe->sharelink);
       malloc_strcpy(fdbe->sharelink, s);
       filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
       filedb_close(fdb);
       free_fdbe(&fdbe);
-      my_free(what);
-      my_free(destdir);
-      my_free(bot);
-      my_free(whoto);
-      my_free(s);
+      free_null(what);
+      free_null(destdir);
+      free_null(bot);
+      free_null(whoto);
+      free_null(s);
       return 1;
     }
   }
   filedb_close(fdb);
   do_dcc_send(idx, destdir, fdbe->filename, nick, resend);
-  my_free(what);
-  my_free(destdir);
+  free_null(what);
+  free_null(destdir);
   free_fdbe(&fdbe);
   /* Don't increase got count till later */
   return 1;
@@ -1472,5 +1472,5 @@
   strcpy(dcc[idx].u.file->dir, s);
   set_user(&USERENTRY_DCCDIR, get_user_by_handle(userlist, dcc[idx].nick),
 	   dcc[idx].u.file->dir);
-  my_free(s);
+  free_null(s);
 }
Index: eggdrop1.7/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.7/src/mod/filesys.mod/filesys.c:1.49 eggdrop1.7/src/mod/filesys.mod/filesys.c:1.50
--- eggdrop1.7/src/mod/filesys.mod/filesys.c:1.49	Tue Oct  9 20:20:12 2001
+++ eggdrop1.7/src/mod/filesys.mod/filesys.c	Wed Oct 10 05:44:06 2001
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.49 2001/10/10 01:20:12 ite Exp $
+ * $Id: filesys.c,v 1.50 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -91,7 +91,6 @@
 static void eof_dcc_files(int idx);
 static void dcc_files(int idx, char *buf, int i);
 static void disp_dcc_files(int idx, char *buf);
-static int expmem_dcc_files(void *x);
 static void kill_dcc_files(int idx, void *x);
 static void out_dcc_files(int idx, char *buf, void *x);
 static char *mktempfile(char *filename);
@@ -105,7 +104,6 @@
   NULL,
   NULL,
   disp_dcc_files,
-  expmem_dcc_files,
   kill_dcc_files,
   out_dcc_files
 };
@@ -124,7 +122,6 @@
   NULL,
   NULL,
   NULL,
-  NULL,
   "DCCDIR"
 };
 
@@ -249,7 +246,7 @@
 
       dprintf(idx, "Returning you to command mode...\n");
       ci = dcc[idx].u.file->chat;
-      my_free(dcc[idx].u.file);
+      free_null(dcc[idx].u.file);
       dcc[idx].u.chat = ci;
       dcc[idx].status &= (~STAT_CHAT);
       dcc[idx].type = &DCC_CHAT;
@@ -326,15 +323,14 @@
 	  botnet_send_part_idx(idx, "file system");
       }
       ci = dcc[idx].u.chat;
-      dcc[idx].u.file = get_data_ptr(sizeof(struct file_info));
-
+      malloc_memset(dcc[idx].u.file, 0, sizeof(struct file_info));
       dcc[idx].u.file->chat = ci;
       dcc[idx].type = &DCC_FILES;
       dcc[idx].status |= STAT_CHAT;
       if (!welcome_to_files(idx)) {
 	struct chat_info *ci = dcc[idx].u.file->chat;
 
-	my_free(dcc[idx].u.file);
+	free_null(dcc[idx].u.file);
 	dcc[idx].u.chat = ci;
 	dcc[idx].type = &DCC_CHAT;
 	putlog(LOG_FILES, "*", "File system broken.");
@@ -414,7 +410,7 @@
     dprintf(DP_HELP, "NOTICE %s :Here is %s file from %s %s...\n", nick,
 	    resend ? "the" : "a", dcc[idx].nick, resend ? "again " : "");
   dprintf(idx, "%sending: %s to %s\n", resend ? "Res" : "S", nfn, nick);
-  my_free(buf);
+  free_null(buf);
   return 1;
 }
 
@@ -439,10 +435,10 @@
     return 0;
   }
   if (dir[0]) {
-    s = nmalloc(strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
+    s = malloc(strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
     sprintf(s, "%s%s/%s", dccdir, dir, fn);
   } else {
-    s = nmalloc(strlen(dccdir) + strlen(fn) + 1);
+    s = malloc(strlen(dccdir) + strlen(fn) + 1);
     sprintf(s, "%s%s", dccdir, fn);
   }
   f = fopen(s, "r");
@@ -450,7 +446,7 @@
     dprintf(idx, "No such file.\n");
     putlog(LOG_FILES, "*", "Refused dcc %sget %s from [%s]", resend ? "re" : "",
 	   fn, dcc[idx].nick);
-    my_free(s);
+    free_null(s);
     return 0;
   }
   fclose(f);
@@ -463,38 +459,38 @@
     sprintf(xxx, "%d*%s%s", strlen(dccdir), dccdir, dir);
     queue_file(xxx, fn, dcc[idx].nick, nick);
     dprintf(idx, "Queued: %s to %s\n", fn, nick);
-    my_free(s);
+    free_null(s);
     return 1;
   }
   if (copy_to_tmp) {
     char *tempfn = mktempfile(fn);
 
     /* Copy this file to /tmp, add a random prefix to the filename. */
-    s = nrealloc(s, strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
+    s = realloc(s, strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
     sprintf(s, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", fn);
-    s1 = nrealloc(s1, strlen(tempdir) + strlen(tempfn) + 1);
+    s1 = realloc(s1, strlen(tempdir) + strlen(tempfn) + 1);
     sprintf(s1, "%s%s", tempdir, tempfn);
-    my_free(tempfn);
+    free_null(tempfn);
     if (copyfile(s, s1) != 0) {
       dprintf(idx, "Can't make temporary copy of file!\n");
       putlog(LOG_FILES | LOG_MISC, "*",
 	     "Refused dcc %sget %s: copy to %s FAILED!",
 	     resend ? "re" : "", fn, tempdir);
-      my_free(s);
-      my_free(s1);
+      free_null(s);
+      free_null(s1);
       return 0;
     }
   } else {
-    s1 = nrealloc(s1, strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
+    s1 = realloc(s1, strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
     sprintf(s1, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", fn);
   }
-  s = nrealloc(s, strlen(dir) + strlen(fn) + 2);
+  s = realloc(s, strlen(dir) + strlen(fn) + 2);
   sprintf(s, "%s%s%s", dir, dir[0] ? "/" : "", fn);
   x = _dcc_send(idx, s1, nick, s, resend);
   if (x != DCCSEND_OK)
     wipe_tmp_filename(s1, -1);
-  my_free(s);
-  my_free(s1);
+  free_null(s);
+  free_null(s1);
   return x;
 }
 
@@ -548,7 +544,7 @@
 
   if (f->chat)
     DCC_CHAT.kill(idx, f->chat);
-  my_free(x);
+  free_null(x);
 }
 
 static void eof_dcc_files(int idx)
@@ -560,16 +556,6 @@
   lostdcc(idx);
 }
 
-static int expmem_dcc_files(void *x)
-{
-  register struct file_info *p = (struct file_info *) x;
-  int tot = sizeof(struct file_info);
-
-  if (p->chat)
-    tot += DCC_CHAT.expmem(p->chat);
-  return tot;
-}
-
 static void out_dcc_files(int idx, char *buf, void *x)
 {
   register struct file_info *p = (struct file_info *) x;
@@ -611,7 +597,6 @@
   NULL,
   tout_dcc_files_pass,
   disp_dcc_files_pass,
-  expmem_dcc_files,
   kill_dcc_files,
   out_dcc_files
 };
@@ -627,7 +612,7 @@
   char *param, *ip, *prt, *buf = NULL, *msg;
   int atr = u ? u->flags : 0, i;
 
-  buf = nmalloc(strlen(text) + 1);
+  buf = malloc(strlen(text) + 1);
   msg = buf;
   strcpy(buf, text);
   param = newsplit(&msg);
@@ -685,11 +670,11 @@
       dcc[i].user = u;
       strcpy(dcc[i].nick, nick);
       strcpy(dcc[i].host, from);
-      dcc[i].u.dns->cbuf = get_data_ptr(strlen(param) + 1);
+      malloc_memset(dcc[i].u.dns->cbuf, 0, strlen(param) + 1);
       strcpy(dcc[i].u.dns->cbuf, param);
       dcc[i].u.dns->ibuf = atoi(msg);
       
-      dcc[i].u.dns->host = get_data_ptr(strlen(dcc[i].addr) + 1);
+      malloc_memset(dcc[i].u.dns->host, 0, strlen(dcc[i].addr) + 1);
       strcpy(dcc[i].u.dns->host, dcc[i].addr);
 
       dcc[i].u.dns->dns_type = RES_HOSTBYIP;
@@ -699,7 +684,7 @@
       dcc_dnshostbyip(dcc[i].addr);
     }
   }
-  my_free(buf);
+  free_null(buf);
 }
 
 /* Create a temporary filename with random elements. Shortens
@@ -721,39 +706,38 @@
   if ((l + MKTEMPFILE_TOT) > NAME_MAX) {
     fn[NAME_MAX - MKTEMPFILE_TOT] = 0;
     l = NAME_MAX - MKTEMPFILE_TOT;
-    fn = nmalloc(l + 1);
+    fn = malloc(l + 1);
     strncpy(fn, filename, l);
     fn[l] = 0;
   }
-  tempname = nmalloc(l + MKTEMPFILE_TOT + 1);
+  tempname = malloc(l + MKTEMPFILE_TOT + 1);
   sprintf(tempname, "%u-%s-%s", getpid(), rands, fn);
   if (fn != filename)
-    my_free(fn);
+    free_null(fn);
   return tempname;
 }
 
 static void filesys_dcc_send_hostresolved(int i)
 {
   FILE *f;
-  char *s1, *param, prt[100], *tempf;
+  char *s1, *param = NULL, prt[100], *tempf;
   int len = dcc[i].u.dns->ibuf, j;
 
   sprintf(prt, "%d", dcc[i].port);
-  param = nmalloc(strlen(dcc[i].u.dns->cbuf) + 1);
-  strcpy(param, dcc[i].u.dns->cbuf);
+  malloc_strcpy(param, dcc[i].u.dns->cbuf);
 
   changeover_dcc(i, &DCC_FORK_SEND, sizeof(struct xfer_info));
   if (param[0] == '.')
     param[0] = '_';
   /* Save the original filename */
-  dcc[i].u.xfer->origname = get_data_ptr(strlen(param) + 1);
+  malloc_memset(dcc[i].u.xfer->origname, 0, strlen(param) + 1);
   strcpy(dcc[i].u.xfer->origname, param);
   tempf = mktempfile(param);
-  dcc[i].u.xfer->filename = get_data_ptr(strlen(tempf) + 1);
+  malloc_memset(dcc[i].u.xfer->filename, 0, strlen(tempf) + 1);
   strcpy(dcc[i].u.xfer->filename, tempf);
   /* We don't need the temporary buffers anymore */
-  my_free(tempf);
-  my_free(param);
+  free_null(tempf);
+  free_null(param);
 
   if (upload_to_cd) {
     char *p = get_user(&USERENTRY_DCCDIR, dcc[i].user);
@@ -765,11 +749,11 @@
   } else
     strcpy(dcc[i].u.xfer->dir, dccin);
   dcc[i].u.xfer->length = len;
-  s1 = nmalloc(strlen(dcc[i].u.xfer->dir) +
+  s1 = malloc(strlen(dcc[i].u.xfer->dir) +
 	       strlen(dcc[i].u.xfer->origname) + 1);
   sprintf(s1, "%s%s", dcc[i].u.xfer->dir, dcc[i].u.xfer->origname);
   f = fopen(s1, "r");
-  my_free(s1);
+  free_null(s1);
   if (f) {
     fclose(f);
     dprintf(DP_HELP, "NOTICE %s :File `%s' already exists.\n",
@@ -790,10 +774,10 @@
 	}
       }
     /* Put uploads in /tmp first */
-    s1 = nmalloc(strlen(tempdir) + strlen(dcc[i].u.xfer->filename) + 1);
+    s1 = malloc(strlen(tempdir) + strlen(dcc[i].u.xfer->filename) + 1);
     sprintf(s1, "%s%s", tempdir, dcc[i].u.xfer->filename);
     dcc[i].u.xfer->f = fopen(s1, "w");
-    my_free(s1);
+    free_null(s1);
     if (dcc[i].u.xfer->f == NULL) {
       dprintf(DP_HELP,
 	      "NOTICE %s :Can't create file `%s' (temp dir error)\n",
@@ -872,9 +856,7 @@
       strcpy(dcc[i].host, from);
       dcc[i].status = STAT_ECHO;
       dcc[i].timeval = now;
-      dcc[i].u.file->chat = get_data_ptr(sizeof(struct chat_info));
-      egg_bzero(dcc[i].u.file->chat, sizeof(struct chat_info));
-
+      malloc_memset(dcc[i].u.file->chat, 0, 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);
@@ -904,11 +886,6 @@
   {NULL,	NULL,	NULL,				NULL}
 };
 
-static int filesys_expmem()
-{
-  return 0;
-}
-
 static void filesys_report(int idx, int details)
 {
   if (dccdir[0]) {
@@ -966,7 +943,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) filesys_close,
-  (Function) filesys_expmem,
+  (Function) 0,
   (Function) filesys_report,
   /* 4 - 7 */
   (Function) remote_filereq,
@@ -999,7 +976,7 @@
   add_builtins(H_load, myload);
   add_help_reference("filesys.help");
   init_server_ctcps(0);
-  my_memcpy(&USERENTRY_DCCDIR, &USERENTRY_INFO,
+  memcpy(&USERENTRY_DCCDIR, &USERENTRY_INFO,
 	    sizeof(struct user_entry_type) - sizeof(char *));
 
   USERENTRY_DCCDIR.got_share = 0;	/* We dont want it shared tho */
Index: eggdrop1.7/src/mod/filesys.mod/tclfiles.c
diff -u eggdrop1.7/src/mod/filesys.mod/tclfiles.c:1.14 eggdrop1.7/src/mod/filesys.mod/tclfiles.c:1.15
--- eggdrop1.7/src/mod/filesys.mod/tclfiles.c:1.14	Sat Jun  9 19:11:51 2001
+++ eggdrop1.7/src/mod/filesys.mod/tclfiles.c	Wed Oct 10 05:44:06 2001
@@ -2,7 +2,7 @@
  * tclfiles.c -- part of filesys.mod
  *   Tcl stubs for file system commands moved here to support modules
  *
- * $Id: tclfiles.c,v 1.14 2001/06/10 00:11:51 poptix Exp $
+ * $Id: tclfiles.c,v 1.15 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,7 +31,7 @@
   filedb_getdesc(argv[1], argv[2], &s);
   if (s) {
     Tcl_AppendResult(irp, s, NULL);
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   } else {
     Tcl_AppendResult(irp, "filedb access failed", NULL);
@@ -54,7 +54,7 @@
   filedb_getowner(argv[1], argv[2], &s);
   if (s) {
     Tcl_AppendResult(irp, s, NULL);
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   } else {
     Tcl_AppendResult(irp, "filedb access failed", NULL);
@@ -200,12 +200,12 @@
   fdb = filedb_open(d, 0);
   if (!fdb) {
     Tcl_AppendResult(irp, "-3", NULL);		/* filedb access failed */
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   }
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), p);
-  my_free(s);
+  free_null(s);
 
   if (!fdbe) {
     Tcl_AppendResult(irp, "-1", NULL);	/* No such dir */
@@ -223,7 +223,7 @@
     build_flags(f, &fr, NULL);
     malloc_strcpy(fdbe->flags_req, f);
   } else {
-    my_free(fdbe->flags_req);
+    free_null(fdbe->flags_req);
   }
   if (argc == 4)
     malloc_strcpy(fdbe->chan, argv[3]);
@@ -260,7 +260,7 @@
       /* Not a directory? */
       !(fdbe->stat & FILE_DIR)) {
     Tcl_AppendResult(irp, "", NULL);
-    my_free(s);
+    free_null(s);
     free_fdbe(&fdbe);
     return TCL_OK;
   }
@@ -272,7 +272,7 @@
     s[0] = 0;
   Tcl_AppendElement(irp, s);
   Tcl_AppendElement(irp, fdbe->chan);
-  my_free(s);
+  free_null(s);
   free_fdbe(&fdbe);
   return TCL_OK;
 }
@@ -301,19 +301,19 @@
   fdb = filedb_open(d, 0);
   if (!fdb) {
     Tcl_AppendResult(irp, "-3", NULL);		/* filedb access failed */
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   }
   filedb_readtop(fdb, NULL);
   fdbe = filedb_matchfile(fdb, ftell(fdb), p);
 
   if (!fdbe) {
-    t = nmalloc(strlen(dccdir) + strlen(d) + strlen(p) + 2);
+    t = malloc(strlen(dccdir) + strlen(d) + strlen(p) + 2);
     sprintf(t, "%s%s/%s", dccdir, d, p);
     if (mkdir(t, 0755) != 0) {
       Tcl_AppendResult(irp, "1", NULL);
-      my_free(t);
-      my_free(s);
+      free_null(t);
+      free_null(s);
       filedb_close(fdb);
       return TCL_OK;
     }
@@ -324,7 +324,7 @@
   } else if (!(fdbe->stat & FILE_DIR)) {
     Tcl_AppendResult(irp, "2", NULL);
     free_fdbe(&fdbe);
-    my_free(s);
+    free_null(s);
     filedb_close(fdb);
     return TCL_OK;
   }
@@ -335,13 +335,13 @@
     build_flags(f, &fr, NULL);
     malloc_strcpy(fdbe->flags_req, f);
   } else if (fdbe->flags_req) {
-    my_free(fdbe->flags_req);
+    free_null(fdbe->flags_req);
   }
   if (argc == 4) {
     malloc_strcpy(fdbe->chan, argv[3]);
   } else
     if (fdbe->chan)
-      my_free(fdbe->chan);
+      free_null(fdbe->chan);
 
   if (fdbe->pos)
       filedb_addfile(fdb, fdbe);
@@ -375,7 +375,7 @@
   fdb = filedb_open(d, 0);
   if (!fdb) {
     Tcl_AppendResult(irp, "1", NULL);
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   }
   filedb_readtop(fdb, NULL);
@@ -384,33 +384,33 @@
   if (!fdbe) {
     Tcl_AppendResult(irp, "1", NULL);
     filedb_close(fdb);
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   }
   if (!(fdbe->stat & FILE_DIR)) {
     Tcl_AppendResult(irp, "1", NULL);
     filedb_close(fdb);
     free_fdbe(&fdbe);
-    my_free(s);
+    free_null(s);
     return TCL_OK;
   }
   /* Erase '.filedb' and '.files' if they exist */
-  t = nmalloc(strlen(dccdir) + strlen(d) + strlen(p) + 11);
+  t = malloc(strlen(dccdir) + strlen(d) + strlen(p) + 11);
   sprintf(t, "%s%s/%s/.filedb", dccdir, d, p);
   unlink(t);
   sprintf(t, "%s%s/%s/.files", dccdir, d, p);
   unlink(t);
   sprintf(t, "%s%s/%s", dccdir, d, p);
-  my_free(s);
+  free_null(s);
   if (rmdir(t) == 0) {
     filedb_delfile(fdb, fdbe->pos);
     filedb_close(fdb);
     free_fdbe(&fdbe);
-    my_free(t);
+    free_null(t);
     Tcl_AppendResult(irp, "0", NULL);
     return TCL_OK;
   }
-  my_free(t);
+  free_null(t);
   free_fdbe(&fdbe);
   filedb_close(fdb);
   Tcl_AppendResult(irp, "1", NULL);
@@ -436,11 +436,11 @@
     if (!resolve_dir("/", s, &oldpath, -1)) {
       /* Tcl can do * anything */
       Tcl_AppendResult(irp, "-1", NULL);	/* Invalid source */
-      my_free(fn);
-      my_free(oldpath);
+      free_null(fn);
+      free_null(oldpath);
       return TCL_OK;
     }
-    my_free(s);
+    free_null(s);
   } else
     malloc_strcpy(oldpath, "/");
   malloc_strcpy(s, argv[2]);
@@ -454,25 +454,25 @@
       *p = 0;
       malloc_strcpy(newfn, p + 1);
     }
-    my_free(newpath);
+    free_null(newpath);
     if (!resolve_dir("/", s, &newpath, -1)) {
       Tcl_AppendResult(irp, "-2", NULL);	/* Invalid desto */
-      my_free(newpath);
-      my_free(s);
-      my_free(newfn);
+      free_null(newpath);
+      free_null(s);
+      free_null(newfn);
       return TCL_OK;
     }
   } else
     malloc_strcpy(newfn, "");
-  my_free(s);
+  free_null(s);
 
   /* Stupidness checks */
   if ((!strcmp(oldpath, newpath)) &&
       (!newfn[0] || !strcmp(newfn, fn))) {
-    my_free(newfn);
-    my_free(fn);
-    my_free(oldpath);
-    my_free(newpath);
+    free_null(newfn);
+    free_null(fn);
+    free_null(oldpath);
+    free_null(newpath);
     Tcl_AppendResult(irp, "-3", NULL);	/* Stupid copy to self */
     return TCL_OK;
   }
@@ -488,10 +488,10 @@
   else
     fdb_new = filedb_open(newpath, 0);
   if (!fdb_old || !fdb_new) {
-    my_free(newfn);
-    my_free(fn);
-    my_free(oldpath);
-    my_free(newpath);
+    free_null(newfn);
+    free_null(fn);
+    free_null(oldpath);
+    free_null(newpath);
     if (fdb_old)
       filedb_close(fdb_old);
     else if (fdb_new)
@@ -503,10 +503,10 @@
   filedb_readtop(fdb_old, NULL);
   fdbe_old = filedb_matchfile(fdb_old, ftell(fdb_old), fn);
   if (!fdbe_old) {
-    my_free(newfn);
-    my_free(fn);
-    my_free(oldpath);
-    my_free(newpath);
+    free_null(newfn);
+    free_null(fn);
+    free_null(oldpath);
+    free_null(newpath);
     if (fdb_new != fdb_old)
       filedb_close(fdb_new);
     filedb_close(fdb_old);
@@ -517,9 +517,9 @@
     where = ftell(fdb_old);
     skip_this = 0;
     if (!(fdbe_old->stat & (FILE_HIDDEN | FILE_DIR))) {
-      s = nmalloc(strlen(dccdir) + strlen(oldpath)
+      s = malloc(strlen(dccdir) + strlen(oldpath)
 		  + strlen(fdbe_old->filename) + 2);
-      s1 = nmalloc(strlen(dccdir) + strlen(newpath)
+      s1 = malloc(strlen(dccdir) + strlen(newpath)
 		   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
       sprintf(s, "%s%s%s%s", dccdir, oldpath,
 	      oldpath[0] ? "/" : "", fdbe_old->filename);
@@ -574,8 +574,8 @@
 	  free_fdbe(&fdbe_new);
 	}
       }
-      my_free(s);
-      my_free(s1);
+      free_null(s);
+      free_null(s1);
     }
     free_fdbe(&fdbe_old);
     fdbe_old = filedb_matchfile(fdb_old, where, fn);
@@ -594,10 +594,10 @@
     sprintf(x, "%d", ok);
     Tcl_AppendResult(irp, x, NULL);
   }
-  my_free(newfn);
-  my_free(fn);
-  my_free(oldpath);
-  my_free(newpath);
+  free_null(newfn);
+  free_null(fn);
+  free_null(oldpath);
+  free_null(newpath);
   return TCL_OK;
 }
 
Index: eggdrop1.7/src/mod/irc.mod/chan.c
diff -u eggdrop1.7/src/mod/irc.mod/chan.c:1.73 eggdrop1.7/src/mod/irc.mod/chan.c:1.74
--- eggdrop1.7/src/mod/irc.mod/chan.c:1.73	Thu Sep 27 22:15:35 2001
+++ eggdrop1.7/src/mod/irc.mod/chan.c	Wed Oct 10 05:44:06 2001
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.73 2001/09/28 03:15:35 stdarg Exp $
+ * $Id: chan.c,v 1.74 2001/10/10 10:44:06 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); 
-  x->next = (memberlist *) channel_malloc(sizeof(memberlist));
+  malloc_memset(x->next, 0, sizeof(memberlist));
   x->next->next = NULL;
   x->next->nick[0] = 0;
   x->next->split = 0L;
@@ -1310,9 +1310,8 @@
   if (chan) {
     putlog(LOG_JOIN, chan->dname, _("Bad key--cant join: %s"), chan->dname);
     if (chan->channel.key[0]) {
-      nfree(chan->channel.key);
-      chan->channel.key = (char *) channel_malloc(1);
-      chan->channel.key[0] = 0;
+      free(chan->channel.key);
+      malloc_memset(chan->channel.key, 0, 1);
       dprintf(DP_MODE, "JOIN %s %s\n", chan->dname, chan->key_prot);
     } else
       check_tcl_need(chan->dname, "key");
@@ -1356,9 +1355,9 @@
 static void set_topic(struct chanset_t *chan, char *k)
 {
   if (chan->channel.topic)
-    nfree(chan->channel.topic);
+    free(chan->channel.topic);
   if (k && k[0]) {
-    chan->channel.topic = (char *) channel_malloc(strlen(k) + 1);
+    malloc_memset(chan->channel.topic, 0, strlen(k) + 1);
     strcpy(chan->channel.topic, k);
   } else
     chan->channel.topic = NULL;
@@ -1477,7 +1476,7 @@
     int	l_chname = strlen(chname);
 
     if (l_chname > (CHANNEL_ID_LEN + 1)) {
-      ch_dname = nmalloc(l_chname + 1);
+      ch_dname = malloc(l_chname + 1);
       if (ch_dname) {
 	egg_snprintf(ch_dname, l_chname + 2, "!%s",
 		     chname + (CHANNEL_ID_LEN + 1));
@@ -1702,7 +1701,7 @@
 
 exit:
   if (ch_dname)
-    nfree(ch_dname);
+    free(ch_dname);
   return 0;
 }
 
Index: eggdrop1.7/src/mod/irc.mod/irc.c
diff -u eggdrop1.7/src/mod/irc.mod/irc.c:1.64 eggdrop1.7/src/mod/irc.mod/irc.c:1.65
--- eggdrop1.7/src/mod/irc.mod/irc.c:1.64	Tue Oct  9 20:20:13 2001
+++ eggdrop1.7/src/mod/irc.mod/irc.c	Wed Oct 10 05:44:06 2001
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.64 2001/10/10 01:20:13 ite Exp $
+ * $Id: irc.c,v 1.65 2001/10/10 10:44:06 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -284,13 +284,12 @@
  */
 static void set_key(struct chanset_t *chan, char *k)
 {
-  nfree(chan->channel.key);
+  free(chan->channel.key);
   if (k == NULL) {
-    chan->channel.key = (char *) channel_malloc(1);
-    chan->channel.key[0] = 0;
+    malloc_memset(chan->channel.key, 0, 1);
     return;
   }
-  chan->channel.key = (char *) channel_malloc(strlen(k) + 1);
+  malloc_memset(chan->channel.key, 0, strlen(k) + 1);
   strcpy(chan->channel.key, k);
 }
 
@@ -316,14 +315,14 @@
   if (m->mask[0])
     return;			/* Already existent mask */
 
-  m->next = (masklist *) channel_malloc(sizeof(masklist));
+  malloc_memset(m->next, 0, sizeof(masklist));
   m->next->next = NULL;
-  m->next->mask = (char *) channel_malloc(1);
+  malloc_memset(m->next->mask, 0, 1);
   m->next->mask[0] = 0;
-  nfree(m->mask);
-  m->mask = (char *) channel_malloc(strlen(s) + 1);
+  free(m->mask);
+  malloc_memset(m->mask, 0, strlen(s) + 1);
   strcpy(m->mask, s);
-  m->who = (char *) channel_malloc(strlen(who) + 1);
+  malloc_memset(m->who, 0, strlen(who) + 1);
   strcpy(m->who, who);
   m->timer = now;
 }
@@ -347,7 +346,7 @@
     old->next = x->next;
   else
     chan->channel.member = x->next;
-  nfree(x);
+  free(x);
   chan->channel.members--;
 
   /* The following two errors should NEVER happen. We will try to correct
@@ -364,7 +363,7 @@
   }
   if (!chan->channel.member) {
     putlog(LOG_MISC, "*", "(!) BUG: memberlist is NULL");
-    chan->channel.member = (memberlist *) channel_malloc(sizeof(memberlist));
+    malloc_memset(chan->channel.member, 0, sizeof(memberlist));
     chan->channel.member->nick[0] = 0;
     chan->channel.member->next = NULL;
   }
@@ -425,9 +424,8 @@
     return;
   }
   if (!channel_pending(chan)) {
-    nfree(chan->channel.key);
-    chan->channel.key = (char *) channel_malloc(1);
-    chan->channel.key[0] = 0;
+    free(chan->channel.key);
+    malloc_memset(chan->channel.key, 0, 1);
     clear_channel(chan, 1);
     chan->status |= CHAN_PEND;
     chan->status &= ~(CHAN_ACTIVE | CHAN_ASKEDMODES);
@@ -926,11 +924,6 @@
   return NULL;
 }
 
-static int irc_expmem()
-{
-  return 0;
-}
-
 static char *irc_close()
 {
   struct chanset_t *chan;
@@ -979,7 +972,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) irc_close,
-  (Function) irc_expmem,
+  (Function) 0,
   (Function) irc_report,
   /* 4 - 7 */
   (Function) recheck_channel,
Index: eggdrop1.7/src/mod/irc.mod/mode.c
diff -u eggdrop1.7/src/mod/irc.mod/mode.c:1.49 eggdrop1.7/src/mod/irc.mod/mode.c:1.50
--- eggdrop1.7/src/mod/irc.mod/mode.c:1.49	Sun Aug 12 22:05:53 2001
+++ eggdrop1.7/src/mod/irc.mod/mode.c	Wed Oct 10 05:44:07 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.49 2001/08/13 03:05:53 guppy Exp $
+ * $Id: mode.c,v 1.50 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -75,7 +75,7 @@
     postsize -= egg_strcatn(post, chan->key, sizeof(post));
     postsize -= egg_strcatn(post, " ", sizeof(post));
 
-    nfree(chan->key), chan->key = NULL;
+    free(chan->key), chan->key = NULL;
   }
 
   /* max +l is signed 2^32 on ircnet at least... so makesure we've got at least
@@ -104,7 +104,7 @@
     postsize -= egg_strcatn(post, chan->rmkey, sizeof(post));
     postsize -= egg_strcatn(post, " ", sizeof(post));
 
-    nfree(chan->rmkey), chan->rmkey = NULL;
+    free(chan->rmkey), chan->rmkey = NULL;
   }
 
   /* Do -{b,e,I} before +{b,e,I} to avoid the server ignoring overlaps */
@@ -122,7 +122,7 @@
       postsize -= egg_strcatn(post, chan->cmode[i].op, sizeof(post));
       postsize -= egg_strcatn(post, " ", sizeof(post));
 
-      nfree(chan->cmode[i].op), chan->cmode[i].op = NULL;
+      free(chan->cmode[i].op), chan->cmode[i].op = NULL;
       chan->cmode[i].type = 0;
     }
   }
@@ -142,7 +142,7 @@
       postsize -= egg_strcatn(post, chan->cmode[i].op, sizeof(post));
       postsize -= egg_strcatn(post, " ", sizeof(post));
 
-      nfree(chan->cmode[i].op), chan->cmode[i].op = NULL;
+      free(chan->cmode[i].op), chan->cmode[i].op = NULL;
       chan->cmode[i].type = 0;
     }
   }
@@ -283,7 +283,7 @@
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == 0) {
 	chan->cmode[i].type = type;
-	chan->cmode[i].op = (char *) channel_malloc(l);
+	malloc_memset(chan->cmode[i].op, 0, l);
 	chan->bytes += l;	/* Add 1 for safety */
 	strcpy(chan->cmode[i].op, op);
 	break;
@@ -293,16 +293,16 @@
   /* +k ? store key */
   else if (plus == '+' && mode == 'k') {
     if (chan->key)
-      nfree(chan->key);
-    chan->key = (char *) channel_malloc(strlen(op) + 1);
+      free(chan->key);
+    malloc_memset(chan->key, 0, strlen(op) + 1);
     if (chan->key)
       strcpy(chan->key, op);
   }
   /* -k ? store removed key */
   else if (plus == '-' && mode == 'k') {
     if (chan->rmkey)
-      nfree(chan->rmkey);
-    chan->rmkey = (char *) channel_malloc(strlen(op) + 1);
+      free(chan->rmkey);
+    malloc_memset(chan->rmkey, 0, strlen(op) + 1);
     if (chan->rmkey)
       strcpy(chan->rmkey, op);
   }
@@ -685,9 +685,9 @@
       old->next = b->next;
     else
       chan->channel.ban = b->next;
-    nfree(b->mask);
-    nfree(b->who);
-    nfree(b);
+    free(b->mask);
+    free(b->who);
+    free(b);
   }
 
   if (channel_pending(chan))
@@ -751,9 +751,9 @@
       old->next = e->next;
     else
       chan->channel.exempt = e->next;
-    nfree(e->mask);
-    nfree(e->who);
-    nfree(e);
+    free(e->mask);
+    free(e->who);
+    free(e);
   }
 
   if (channel_pending(chan))
@@ -827,9 +827,9 @@
       old->next = inv->next;
     else
       chan->channel.invite = inv->next;
-    nfree(inv->mask);
-    nfree(inv->who);
-    nfree(inv);
+    free(inv->mask);
+    free(inv->who);
+    free(inv);
   }
 
   if (channel_pending(chan))
Index: eggdrop1.7/src/mod/irc.mod/msgcmds.c
diff -u eggdrop1.7/src/mod/irc.mod/msgcmds.c:1.28 eggdrop1.7/src/mod/irc.mod/msgcmds.c:1.29
--- eggdrop1.7/src/mod/irc.mod/msgcmds.c:1.28	Thu Sep 27 13:33:21 2001
+++ eggdrop1.7/src/mod/irc.mod/msgcmds.c	Wed Oct 10 05:44:07 2001
@@ -2,7 +2,7 @@
  * msgcmds.c -- part of irc.mod
  *   all commands entered via /MSG
  *
- * $Id: msgcmds.c,v 1.28 2001/09/27 18:33:21 sup Exp $
+ * $Id: msgcmds.c,v 1.29 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -822,8 +822,7 @@
     dprintf(DP_HELP, "NOTICE %s :%s\n", nick, s);
   }
   i = count_users(userlist);
-  dprintf(DP_HELP, "NOTICE %s :%d user%s  (mem: %uk)\n", nick, i,
-	  i == 1 ? "" : "s", (int) (expected_memory() / 1024));
+  dprintf(DP_HELP, "NOTICE %s :%d user%s\n", nick, i, i == 1 ? "" : "s");
   daysdur(now, server_online, s);
   dprintf(DP_HELP, "NOTICE %s :Connected %s\n", nick, s);
   dprintf(DP_HELP, "NOTICE %s :Online as: %s%s%s\n", nick, botname,
@@ -831,30 +830,6 @@
   return 1;
 }
 
-static int msg_memory(char *nick, char *host, struct userrec *u, char *par)
-{
-  char *pass;
-
-  if (match_my_nick(nick))
-    return 1;
-  if (!u_pass_match(u, "-")) {
-    pass = newsplit(&par);
-    if (!u_pass_match(u, pass)) {
-      putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed MEMORY", nick, host,
-	     u->handle);
-      return 1;
-    }
-  } else {
-    putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed MEMORY", nick, host, u->handle);
-    if (!quiet_reject)
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, _("You dont have a password set."));
-    return 1;
-  }
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! MEMORY", nick, host, u->handle);
-  tell_mem_status(nick);
-  return 1;
-}
-
 static int msg_die(char *nick, char *host, struct userrec *u, char *par)
 {
   char s[1024];
@@ -1017,7 +992,6 @@
   {"invite",		"o|o",	(Function) msg_invite,		NULL},
   {"jump",		"m",	(Function) msg_jump,		NULL},
   {"key",		"o|o",	(Function) msg_key,		NULL},
-  {"memory",		"m",	(Function) msg_memory,		NULL},
   {"op",		"",	(Function) msg_op,		NULL},
   {"pass",		"",	(Function) msg_pass,		NULL},
   {"rehash",		"m",	(Function) msg_rehash,		NULL},
Index: eggdrop1.7/src/mod/module.h
diff -u eggdrop1.7/src/mod/module.h:1.59 eggdrop1.7/src/mod/module.h:1.60
--- eggdrop1.7/src/mod/module.h:1.59	Tue Oct  9 20:20:11 2001
+++ eggdrop1.7/src/mod/module.h	Wed Oct 10 05:44:05 2001
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.59 2001/10/10 01:20:11 ite Exp $
+ * $Id: module.h,v 1.60 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -46,15 +46,8 @@
  * held responsible for mental break-downs caused by this file <G>
  */
 
-#undef nmalloc
-#undef nfree
-#undef nrealloc
 #undef feof
-#undef user_malloc
 #undef dprintf
-#undef get_data_ptr
-#undef wild_match
-#undef user_realloc
 #undef Context
 #undef ContextNote
 #undef Assert
@@ -69,9 +62,6 @@
 #ifdef egg_snprintf
 #  undef egg_snprintf
 #endif
-#ifdef egg_memset
-#  undef egg_memset
-#endif
 #ifdef egg_strcasecmp
 #  undef egg_strcasecmp
 #endif
@@ -88,8 +78,8 @@
 /* Redefine for module-relevance */
 
 /* 0 - 3 */
-#define nmalloc(x) ((void *)(global[0]((x),MODULE_NAME,__FILE__,__LINE__)))
-#define nfree(x) (global[1]((x),MODULE_NAME,__FILE__,__LINE__))
+/* 0: nmalloc -- UNUSED (Tothwolf) */
+/* 1: nfree -- UNUSED (Tothwolf) */
 #ifdef DEBUG_CONTEXT
 #  define Context (global[2](__FILE__, __LINE__, MODULE_NAME))
 #else
@@ -138,9 +128,9 @@
 #define nextbot ((int (*)(char *))global[35])
 /* 36 - 39 */
 #define zapfbot ((void (*)(int))global[36])
-#define n_free ((void (*)(void *,char *, int))global[37])
+/* 37: n_free -- UNUSED (Tothwolf) */
 #define u_pass_match ((int (*)(struct userrec *,char *))global[38])
-#define user_malloc(x) ((void *(*)(int,char *,int))global[39])(x,__FILE__,__LINE__)
+/* 39: user_malloc -- UNUSED (Tothwolf) */
 /* 40 - 43 */
 #define get_user ((void *(*)(struct user_entry_type *,struct userrec *))global[40])
 #define set_user ((int(*)(struct user_entry_type *,struct userrec *,void *))global[41])
@@ -199,11 +189,11 @@
 /* 84 - 87 */
 #define open_listen ((int (*) (int *,int))global[84])
 #define open_telnet_dcc ((int (*) (int,char *,char *))global[85])
-#define get_data_ptr(x) ((void *(*)(int,char*,int))global[86])(x,__FILE__,__LINE__)
+/* 86: get_data_ptr -- UNUSED (Tothwolf) */
 #define open_telnet ((int (*) (char *, int))global[87])
 /* 88 - 91 */
 #define check_tcl_event ((void * (*) (const char *))global[88])
-#define my_memcpy ((void * (*) (void *, const void *, size_t))global[89])
+/* 89: my_memcpy / egg_memcpy -- UNUSED (Tothwolf) */
 #define my_atoul ((IP(*)(char *))global[90])
 #define my_strcpy ((int (*)(char *, const char *))global[91])
 /* 92 - 95 */
@@ -302,8 +292,8 @@
 #define detect_dcc_flood ((int (*) (time_t *,struct chat_info *,int))global[166])
 #define flush_lines ((void(*)(int,struct chat_info*))global[167])
 /* 168 - 171 */
-#define expected_memory ((int(*)(void))global[168])
-#define tell_mem_status ((void(*)(char *))global[169])
+/* 168: expected_memory -- UNUSED (Tothwolf) */
+/* 169: tell_mem_status -- UNUSED (Tothwolf) */
 #define do_restart (*(int *)(global[170]))
 #define check_tcl_filt ((const char *(*)(int, const char *))global[171])
 /* 172 - 175 */
@@ -378,8 +368,8 @@
 #define force_expire (*(int *)(global[227]))	/* Rufus */
 /* 228 - 231 */
 /* 228: add_lang_section() -- UNUSED */
-#define user_realloc(x,y) ((void *(*)(void *,int,char *,int))global[229])((x),(y),__FILE__,__LINE__)
-#define nrealloc(x,y) ((void *)(global[230]((x),(y),MODULE_NAME,__FILE__,__LINE__)))
+/* 229: user_realloc -- UNUSED (Tothwolf) */
+/* 230: nrealloc -- UNUSED (Tothwolf) */
 #define xtra_set ((int(*)(struct userrec *,struct user_entry *, void *))global[231])
 /* 232 - 235 */
 #ifdef DEBUG_CONTEXT
@@ -420,7 +410,7 @@
 /* 252 - 255 */
 #define egg_snprintf (global[252])
 #define egg_vsnprintf ((int (*)(char *, size_t, const char *, va_list))global[253])
-#define egg_memset ((void *(*)(void *, int, size_t))global[254])
+/* 254: egg_memset -- UNUSED (Tothwolf) */
 #define egg_strcasecmp ((int (*)(const char *, const char *))global[255])
 /* 256 - 259 */
 #define egg_strncasecmp ((int (*)(const char *, const char *, size_t))global[256])
Index: eggdrop1.7/src/mod/modvals.h
diff -u eggdrop1.7/src/mod/modvals.h:1.22 eggdrop1.7/src/mod/modvals.h:1.23
--- eggdrop1.7/src/mod/modvals.h:1.22	Tue Oct  9 20:20:11 2001
+++ eggdrop1.7/src/mod/modvals.h	Wed Oct 10 05:44:05 2001
@@ -1,7 +1,7 @@
 /*
  * modvals.h
  *
- * $Id: modvals.h,v 1.22 2001/10/10 01:20:11 ite Exp $
+ * $Id: modvals.h,v 1.23 2001/10/10 10:44:05 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -58,7 +58,7 @@
  */
 #define MODCALL_START		  0
 #define MODCALL_CLOSE		  1
-#define MODCALL_EXPMEM		  2
+#define MODCALL_EXPMEM		  2	/* This is no longer used (Tothwolf) */
 #define MODCALL_REPORT		  3
 /* Filesys */
 #define FILESYS_REMOTE_REQ	  4
Index: eggdrop1.7/src/mod/notes.mod/cmdsnote.c
diff -u eggdrop1.7/src/mod/notes.mod/cmdsnote.c:1.13 eggdrop1.7/src/mod/notes.mod/cmdsnote.c:1.14
--- eggdrop1.7/src/mod/notes.mod/cmdsnote.c:1.13	Fri Aug 10 18:51:21 2001
+++ eggdrop1.7/src/mod/notes.mod/cmdsnote.c	Wed Oct 10 05:44:07 2001
@@ -2,7 +2,7 @@
  * cmdsnote.c -- part of notes.mod
  *   handles all notes interaction over the party line
  *
- * $Id: cmdsnote.c,v 1.13 2001/08/10 23:51:21 ite Exp $
+ * $Id: cmdsnote.c,v 1.14 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -33,7 +33,7 @@
   }
   putlog(LOG_CMDS, "*", "#%s# +noteign %s", dcc[idx].nick, par);
 
-  p = buf = nmalloc(strlen(par)+1);
+  p = buf = malloc(strlen(par) + 1);
   strcpy(p, par);
   handle = newsplit(&p);
   mask = newsplit(&p);
@@ -44,13 +44,13 @@
       get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
       if (!(glob_master(fr) || glob_owner(fr))) {
 	dprintf(idx, _("You are not allowed to change note ignores for %s\n"), handle);
-	nfree(buf);
+	free(buf);
         return;
       }
     }
     if (!u2) {
       dprintf(idx, _("User %s does not exist.\n"), handle);
-      nfree(buf);
+      free(buf);
       return;
     }
   } else {
@@ -61,7 +61,7 @@
     dprintf(idx, _("Now ignoring notes from %s\n"), mask);
   else
     dprintf(idx, _("Already ignoring %s\n"), mask);
-  nfree(buf);
+  free(buf);
   return;
 }
 
@@ -74,7 +74,7 @@
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# -noteign %s", dcc[idx].nick, par);
-  p = buf = nmalloc(strlen(par)+1);
+  p = buf = malloc(strlen(par) + 1);
   strcpy(p, par);
   handle = newsplit(&p);
   mask = newsplit(&p);
@@ -85,13 +85,13 @@
       get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
       if (!(glob_master(fr) || glob_owner(fr))) {
 	dprintf(idx, _("You are not allowed to change note ignores for %s\n"), handle);
-	nfree(buf);
+	free(buf);
         return;
       }
     }
     if (!u2) {
       dprintf(idx, _("User %s does not exist.\n"), handle);
-      nfree(buf);
+      free(buf);
       return;
     }
   } else {
@@ -103,7 +103,7 @@
     dprintf(idx, _("No longer ignoring notes from %s\n"), mask);
   else
     dprintf(idx, _("Note ignore %s not found in list.\n"), mask);
-  nfree(buf);
+  free(buf);
   return;
 }
 
@@ -140,8 +140,8 @@
   for (i = 0; i < ignoresn; i++)
     dprintf(idx, " %s", ignores[i]);
   dprintf(idx, "\n");
-  nfree(ignores[0]);		/* Free the string buffer	*/
-  nfree(ignores);		/* Free the ptr array		*/
+  free(ignores[0]);		/* Free the string buffer	*/
+  free(ignores);		/* Free the ptr array		*/
 }
 
 static void cmd_fwd(struct userrec *u, int idx, char *par)
Index: eggdrop1.7/src/mod/notes.mod/notes.c
diff -u eggdrop1.7/src/mod/notes.mod/notes.c:1.35 eggdrop1.7/src/mod/notes.mod/notes.c:1.36
--- eggdrop1.7/src/mod/notes.mod/notes.c:1.35	Tue Oct  9 20:20:13 2001
+++ eggdrop1.7/src/mod/notes.mod/notes.c	Wed Oct 10 05:44:07 2001
@@ -5,7 +5,7 @@
  *   note cmds
  *   note ignores
  *
- * $Id: notes.c,v 1.35 2001/10/10 01:20:13 ite Exp $
+ * $Id: notes.c,v 1.36 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -60,7 +60,6 @@
   NULL,
   NULL,
   NULL,
-  NULL,
   fwd_display,
   "FWD"
 };
@@ -940,7 +939,7 @@
 int get_note_ignores(struct userrec *u, char ***ignores)
 {
   struct xtra_key *xk;
-  char *buf, *p;
+  char *buf = NULL, *p;
   int ignoresn;
 
   /* Hullo? sanity? */
@@ -951,16 +950,15 @@
     return 0;
 
   rmspace(xk->data);
-  buf = user_malloc(strlen(xk->data) + 1);
-  strcpy(buf, xk->data);
+  malloc_strcpy(buf, xk->data);
   p = buf;
 
   /* Split up the string into small parts */
-  *ignores = nmalloc(sizeof(char *) + 100);
+  *ignores = malloc(sizeof(char *) + 100);
   **ignores = p;
   ignoresn = 1;
   while ((p = strchr(p, ' ')) != NULL) {
-    *ignores = nrealloc(*ignores, sizeof(char *) * (ignoresn+1));
+    *ignores = realloc(*ignores, sizeof(char *) * (ignoresn+1));
     (*ignores)[ignoresn] = p + 1;
     ignoresn++;
     *p = 0;
@@ -980,31 +978,29 @@
     /* Search for existing mask */
     for (i = 0; i < ignoresn; i++)
       if (!strcmp(ignores[i], mask)) {
-        nfree(ignores[0]);	/* Free the string buffer	*/
-        nfree(ignores);		/* Free the ptr array		*/
+        free(ignores[0]);	/* Free the string buffer	*/
+        free(ignores);		/* Free the ptr array		*/
 	/* The mask already exists, exit. */
         return 0;
       }
-    nfree(ignores[0]);		/* Free the string buffer	*/
-    nfree(ignores);		/* Free the ptr array		*/
+    free(ignores[0]);		/* Free the string buffer	*/
+    free(ignores);		/* Free the ptr array		*/
   }
 
   xk = getnotesentry(u);
   /* First entry? */
   if (!xk) {
-    struct xtra_key *mxk = user_malloc(sizeof(struct xtra_key));
+    struct xtra_key *mxk = malloc(sizeof(struct xtra_key));
     struct user_entry *ue = find_user_entry(&USERENTRY_XTRA, u);
 
     if (!ue)
       return 0;
     mxk->next = 0;
-    mxk->data = user_malloc(strlen(mask) + 1);
-    strcpy(mxk->data, mask);
-    mxk->key = user_malloc(strlen(NOTES_IGNKEY) + 1);
-    strcpy(mxk->key, NOTES_IGNKEY);
+    malloc_strcpy(mxk->data, mask);
+    malloc_strcpy(mxk->key, NOTES_IGNKEY);
     xtra_set(u, ue, mxk);
   } else { /* ... else, we already have other entries. */
-    xk->data = user_realloc(xk->data, strlen(xk->data) + strlen(mask) + 2);
+    xk->data = realloc(xk->data, strlen(xk->data) + strlen(mask) + 2);
     strcat(xk->data, " ");
     strcat(xk->data, mask);
   }
@@ -1022,36 +1018,36 @@
   if (!ignoresn)
     return 0;
 
-  buf = user_malloc(1);
+  buf = malloc(1);
   buf[0] = 0;
   for (i = 0; i < ignoresn; i++) {
     if (strcmp(ignores[i], mask)) {
       size += strlen(ignores[i]);
       if (buf[0])
 	size++;
-      buf = user_realloc(buf, size+1);
+      buf = realloc(buf, size + 1);
       if (buf[0])
 	strcat(buf, " ");
       strcat(buf, ignores[i]);
     } else
       foundit = 1;
   }
-  nfree(ignores[0]);		/* Free the string buffer	*/
-  nfree(ignores);		/* Free the ptr array		*/
+  free(ignores[0]);		/* Free the string buffer	*/
+  free(ignores);		/* Free the ptr array		*/
   /* Entry not found */
   if (!foundit) {
-    nfree(buf);
+    free(buf);
     return 0;
   }
   ue = find_user_entry(&USERENTRY_XTRA, u);
   /* Delete the entry if the buffer is empty */
 
-  xk = user_malloc(sizeof(struct xtra_key));
-  xk->key = user_malloc(strlen(NOTES_IGNKEY)+1);
+  xk = malloc(sizeof(struct xtra_key));
+  xk->key = malloc(strlen(NOTES_IGNKEY)+1);
   xk->next = 0;
 
   if (!buf[0]) {
-    nfree(buf); /* The allocated byte needs to be free'd too */
+    free(buf); /* The allocated byte needs to be free'd too */
     strcpy(xk->key, NOTES_IGNKEY);
     xk->data = 0;
   } else {
@@ -1075,12 +1071,12 @@
     return 0;
   for (i = 0; i < ignoresn; i++)
     if (wild_match(ignores[i], from)) {
-      nfree(ignores[0]);
-      nfree(ignores);
+      free(ignores[0]);
+      free(ignores);
       return 1;
     }
-  nfree(ignores[0]);		/* Free the string buffer	*/
-  nfree(ignores);		/* Free the ptr array		*/
+  free(ignores[0]);		/* Free the string buffer	*/
+  free(ignores);		/* Free the ptr array		*/
   return 0;
 }
 
@@ -1189,11 +1185,6 @@
   return NULL;
 }
 
-static int notes_expmem()
-{
-  return 0;
-}
-
 static void notes_report(int idx, int details)
 {
   if (details) {
@@ -1210,7 +1201,7 @@
 {
   (Function) start,
   (Function) notes_close,
-  (Function) notes_expmem,
+  (Function) 0,
   (Function) notes_report,
   (Function) cmd_note,
 };
@@ -1239,7 +1230,7 @@
   add_help_reference("notes.help");
   notes_server_setup(0);
   notes_irc_setup(0);
-  my_memcpy(&USERENTRY_FWD, &USERENTRY_INFO, sizeof(void *) * 12);
+  memcpy(&USERENTRY_FWD, &USERENTRY_INFO, sizeof(void *) * 12);
   add_entry_type(&USERENTRY_FWD);
   return NULL;
 }
Index: eggdrop1.7/src/mod/server.mod/server.c
diff -u eggdrop1.7/src/mod/server.mod/server.c:1.82 eggdrop1.7/src/mod/server.mod/server.c:1.83
--- eggdrop1.7/src/mod/server.mod/server.c:1.82	Tue Oct  9 20:20:13 2001
+++ eggdrop1.7/src/mod/server.mod/server.c	Wed Oct 10 05:44:07 2001
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.82 2001/10/10 01:20:13 ite Exp $
+ * $Id: server.c,v 1.83 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -182,8 +182,8 @@
       modeq.tot--;
       last_time += calc_penalty(modeq.head->msg);
       q = modeq.head->next;
-      nfree(modeq.head->msg);
-      nfree(modeq.head);
+      free(modeq.head->msg);
+      free(modeq.head);
       modeq.head = q;
       burst++;
     }
@@ -208,8 +208,8 @@
     mq.tot--;
     last_time += calc_penalty(mq.head->msg);
     q = mq.head->next;
-    nfree(mq.head->msg);
-    nfree(mq.head);
+    free(mq.head->msg);
+    free(mq.head);
     mq.head = q;
     if (!mq.head)
       mq.last = NULL;
@@ -232,8 +232,8 @@
   hq.tot--;
   last_time += calc_penalty(hq.head->msg);
   q = hq.head->next;
-  nfree(hq.head->msg);
-  nfree(hq.head);
+  free(hq.head->msg);
+  free(hq.head);
   hq.head = q;
   if (!hq.head)
     hq.last = NULL;
@@ -471,8 +471,8 @@
       m->next = nm->next;
       if (!nm->next)
         h->last = m;
-      nfree(nm->msg);
-      nfree(nm);
+      free(nm->msg);
+      free(nm);
       h->tot--;
     } else
       m = m->next;
@@ -483,8 +483,8 @@
     tosend[len - 1] = '\n';
     tputs(serv, tosend, len);
     m = h->head->next;
-    nfree(h->head->msg);
-    nfree(h->head);
+    free(h->head->msg);
+    free(h->head);
     h->head = m;
     if (!h->head)
       h->last = 0;
@@ -558,15 +558,15 @@
           q->head = m->next;
         else
           lm->next = m->next;
-        nfree(m->msg);
-        nfree(m);
+        free(m->msg);
+        free(m);
         m = lm;
         q->tot--;
         if (!q->head)
           q->last = 0;
       } else {
-        nfree(m->msg);
-        m->msg = nmalloc(strlen(newmsg) + 1);
+        free(m->msg);
+        m->msg = malloc(strlen(newmsg) + 1);
         m->len = strlen(newmsg);
         strcpy(m->msg, newmsg);
       }
@@ -625,17 +625,17 @@
             q->head = m->next;
           else
             lm->next = m->next;
-          nfree(m->msg);
-          nfree(m);
+          free(m->msg);
+          free(m);
           m = lm;
           q->tot--;
           if (!q->head)
             q->last = 0;
         } else {
-          nfree(m->msg);
+          free(m->msg);
           egg_snprintf(newmsg, sizeof newmsg, "KICK %s %s %s\n", chan,
 		       newnicks + 1, reason);
-          m->msg = nmalloc(strlen(newmsg) + 1);
+          m->msg = malloc(strlen(newmsg) + 1);
           m->len = strlen(newmsg);
           strcpy(m->msg, newmsg);
         }
@@ -723,17 +723,17 @@
             h->head->next = m->next;
           else
             lm->next = m->next;
-          nfree(m->msg);
-          nfree(m);
+          free(m->msg);
+          free(m);
           m = lm;
           h->tot--;
           if (!h->head)
             h->last = 0;
         } else {
-          nfree(m->msg);
+          free(m->msg);
           egg_snprintf(newmsg, sizeof newmsg, "KICK %s %s %s\n", chan2,
 		       newnicks2 + 1, reason);
-          m->msg = nmalloc(strlen(newmsg) + 1);
+          m->msg = malloc(strlen(newmsg) + 1);
           m->len = strlen(newmsg);
           strcpy(m->msg, newmsg);
         }
@@ -766,8 +766,8 @@
   h->tot--;
   last_time += calc_penalty(newmsg);
   m = h->head->next;
-  nfree(h->head->msg);
-  nfree(h->head);
+  free(h->head->msg);
+  free(h->head);
   h->head = m;
   if (!h->head)
     h->last = 0;
@@ -857,7 +857,7 @@
 	}
       }
 
-    q = nmalloc(sizeof(struct msgq));
+    q = malloc(sizeof(struct msgq));
     if (qnext)
       q->next = h->head;
     else
@@ -871,7 +871,7 @@
        h->head = q;
     h->last = q;
     q->len = len;
-    q->msg = nmalloc(len + 1);
+    q->msg = malloc(len + 1);
     strncpyz(q->msg, buf, len + 1);
     h->tot++;
     h->warned = 0;
@@ -943,7 +943,7 @@
     p = strchr(ss, ',');
     if (p)
       *p++ = 0;
-    x = nmalloc(sizeof(struct server_list));
+    x = malloc(sizeof(struct server_list));
 
     x->next = 0;
     x->realname = 0;
@@ -964,20 +964,17 @@
     if (!q) {
       x->port = default_port;
       x->pass = 0;
-      x->name = nmalloc(strlen(ss) + 1);
-      strcpy(x->name, ss);
+      malloc_strcpy(x->name, ss);
     } else {
       *(q++) = 0;
-      x->name = nmalloc(strlen(ss) + 1);
-      strcpy(x->name, ss);
+      malloc_strcpy(x->name, ss);
       ss = q;
       q = strchr(ss, ':');
       if (!q) {
 	x->pass = 0;
       } else {
 	*q++ = 0;
-	x->pass = nmalloc(strlen(q) + 1);
-	strcpy(x->pass, q);
+	malloc_strcpy(x->pass, q);
       }
       x->port = atoi(ss);
     }
@@ -994,12 +991,12 @@
   while (xx) {
     x = xx->next;
     if (xx->name)
-      nfree(xx->name);
+      free(xx->name);
     if (xx->pass)
-      nfree(xx->pass);
+      free(xx->pass);
     if (xx->realname)
-      nfree(xx->realname);
-    nfree(xx);
+      free(xx->realname);
+    free(xx);
     xx = x;
   }
 }
@@ -1031,17 +1028,15 @@
       i++;
     }
     /* Gotta add it: */
-    x = nmalloc(sizeof(struct server_list));
+    x = malloc(sizeof(struct server_list));
 
     x->next = 0;
     x->realname = 0;
-    x->name = nmalloc(strlen(serv) + 1);
-    strcpy(x->name, serv);
+    malloc_strcpy(x->name, serv);
     x->port = *port ? *port : default_port;
-    if (pass && pass[0]) {
-      x->pass = nmalloc(strlen(pass) + 1);
-      strcpy(x->pass, pass);
-    } else
+    if (pass && pass[0])
+      malloc_strcpy(x->pass, pass);
+    else
       x->pass = NULL;
     list_append((struct list_type **) (&serverlist), (struct list_type *) x);
     *ptr = i;
@@ -1462,7 +1457,7 @@
     strcpy(dcc[i].host, from);
     dcc[i].timeval = now;
     dcc[i].user = u;
-    dcc[i].u.dns->host = get_data_ptr(strlen(dcc[i].addr) + 1);
+    malloc_memset(dcc[i].u.dns->host, 0, 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;
@@ -1629,45 +1624,13 @@
 
   for (q = qh->head; q; q = qq) {
     qq = q->next;
-    nfree(q->msg);
-    nfree(q);
+    free(q->msg);
+    free(q);
   }
   qh->head = qh->last = NULL;
   qh->tot = qh->warned = 0;
 }
 
-static int msgq_expmem(struct msgq_head *qh)
-{
-  register int		 tot = 0;
-  register struct msgq	*m;
-
-  for (m = qh->head; m; m = m->next) {
-    tot += m->len + 1;
-    tot += sizeof(struct msgq);
-  }
-  return tot;
-}
-
-static int server_expmem()
-{
-  int			 tot = 0;
-  struct server_list	*s = serverlist;
-
-  for (; s; s = s->next) {
-    if (s->name)
-      tot += strlen(s->name) + 1;
-    if (s->pass)
-      tot += strlen(s->pass) + 1;
-    if (s->realname)
-      tot += strlen(s->realname) + 1;
-    tot += sizeof(struct server_list);
-  }
-
-  tot += msgq_expmem(&mq) + msgq_expmem(&hq) + msgq_expmem(&modeq);
-
-  return tot;
-}
-
 static cmd_t my_ctcps[] =
 {
   {"DCC",	"",	ctcp_DCC_CHAT,		"server:DCC"},
@@ -1733,7 +1696,7 @@
 {
   (Function) start,
   (Function) server_close,
-  (Function) server_expmem,
+  (Function) 0,
   (Function) server_report,
   /* 4 - 7 */
   (Function) NULL,		/* char * (points to botname later on)	*/
Index: eggdrop1.7/src/mod/server.mod/server.h
diff -u eggdrop1.7/src/mod/server.mod/server.h:1.14 eggdrop1.7/src/mod/server.mod/server.h:1.15
--- eggdrop1.7/src/mod/server.mod/server.h:1.14	Sat Oct  6 23:02:55 2001
+++ eggdrop1.7/src/mod/server.mod/server.h	Wed Oct 10 05:44:07 2001
@@ -1,7 +1,7 @@
 /*
  * server.h -- part of server.mod
  *
- * $Id: server.h,v 1.14 2001/10/07 04:02:55 stdarg Exp $
+ * $Id: server.h,v 1.15 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -72,17 +72,6 @@
 #define get_altbotnick ((char *(*)(void))(server_funcs[36]))
 #define nick_len (*(int *)(server_funcs[37]))
 #define check_tcl_notc ((int (*)(char *,char *,struct userrec *,char *,char *))server_funcs[38])
-
-#else		/* MAKING_SERVER */
-
-/* Macros for commonly used commands.
- */
-
-#define free_null(ptr)	do {				\
-	nfree(ptr);					\
-	ptr = NULL;					\
-} while (0)
-
 #endif		/* MAKING_SERVER */
 
 struct server_list {
Index: eggdrop1.7/src/mod/server.mod/servmsg.c
diff -u eggdrop1.7/src/mod/server.mod/servmsg.c:1.67 eggdrop1.7/src/mod/server.mod/servmsg.c:1.68
--- eggdrop1.7/src/mod/server.mod/servmsg.c:1.67	Sat Oct  6 23:02:55 2001
+++ eggdrop1.7/src/mod/server.mod/servmsg.c	Wed Oct 10 05:44:07 2001
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.67 2001/10/07 04:02:55 stdarg Exp $
+ * $Id: servmsg.c,v 1.68 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -211,17 +211,14 @@
       return 0;
     }
     if (x->realname)
-      nfree(x->realname);
+      free(x->realname);
     if (strict_servernames == 1) {
       x->realname = NULL;
       if (x->name)
-	nfree(x->name);
-      x->name = nmalloc(strlen(from) + 1);
-      strcpy(x->name, from);
-    } else {
-      x->realname = nmalloc(strlen(from) + 1);
-      strcpy(x->realname, from);
-    }
+	free(x->name);
+      malloc_strcpy(x->name, from);
+    } else
+      malloc_strcpy(x->realname, from);
   }
   return 0;
 }
@@ -926,7 +923,6 @@
   NULL,
   timeout_server,
   display_server,
-  NULL,
   kill_server,
   NULL
 };
@@ -1120,9 +1116,9 @@
 
     dcc[servidx].timeval = now;
     dcc[servidx].sock = -1;
-    dcc[servidx].u.dns->host = get_data_ptr(strlen(dcc[servidx].host) + 1);
+    malloc_memset(dcc[servidx].u.dns->host, 0, strlen(dcc[servidx].host) + 1);
     strcpy(dcc[servidx].u.dns->host, dcc[servidx].host);
-    dcc[servidx].u.dns->cbuf = get_data_ptr(strlen(pass) + 1);
+    malloc_memset(dcc[servidx].u.dns->cbuf, 0, 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/server.mod/tclserv.c
diff -u eggdrop1.7/src/mod/server.mod/tclserv.c:1.9 eggdrop1.7/src/mod/server.mod/tclserv.c:1.10
--- eggdrop1.7/src/mod/server.mod/tclserv.c:1.9	Sat Jun 30 01:29:57 2001
+++ eggdrop1.7/src/mod/server.mod/tclserv.c	Wed Oct 10 05:44:07 2001
@@ -1,7 +1,7 @@
 /*
  * tclserv.c -- part of server.mod
  *
- * $Id: tclserv.c,v 1.9 2001/06/30 06:29:57 guppy Exp $
+ * $Id: tclserv.c,v 1.10 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -139,18 +139,18 @@
     msgs = (int) (modeq.tot + mq.tot + hq.tot);
     for (q = modeq.head; q; q = qq) { 
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     for (q = mq.head; q; q = qq) {
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     for (q = hq.head; q; q = qq) {
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     modeq.tot = mq.tot = hq.tot = modeq.warned = mq.warned = hq.warned = 0;
     mq.head = hq.head = modeq.head = mq.last = hq.last = modeq.last = 0;
@@ -163,8 +163,8 @@
     msgs = mq.tot;
     for (q = mq.head; q; q = qq) {
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     mq.tot = mq.warned = 0;
     mq.head = mq.last = 0;
@@ -180,8 +180,8 @@
     msgs = modeq.tot;
     for (q = modeq.head; q; q = qq) { 
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     if (mq.tot == 0)
       burst = 0;
@@ -195,8 +195,8 @@
     msgs = hq.tot;
     for (q = hq.head; q; q = qq) {
       qq = q->next;
-      nfree(q->msg);
-      nfree(q);
+      free(q->msg);
+      free(q);
     }
     double_warned = 0;
     hq.tot = hq.warned = 0;
Index: eggdrop1.7/src/mod/share.mod/share.c
diff -u eggdrop1.7/src/mod/share.mod/share.c:1.59 eggdrop1.7/src/mod/share.mod/share.c:1.60
--- eggdrop1.7/src/mod/share.mod/share.c:1.59	Tue Oct  9 20:20:13 2001
+++ eggdrop1.7/src/mod/share.mod/share.c	Wed Oct 10 05:44:07 2001
@@ -1,7 +1,7 @@
 /*
  * share.c -- part of share.mod
  *
- * $Id: share.c,v 1.59 2001/10/10 01:20:13 ite Exp $
+ * $Id: share.c,v 1.60 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -106,15 +106,15 @@
 {
   struct delay_mode *d = NULL;
 
-  d = (struct delay_mode *) nmalloc(sizeof(struct delay_mode));
+  d = (struct delay_mode *) malloc(sizeof(struct delay_mode));
   if (!d)
     return;
   d->chan = chan;
   d->plsmns = plsmns;
   d->mode = mode;
-  d->mask = (char *) nmalloc(strlen(mask) + 1);
+  d->mask = (char *) malloc(strlen(mask) + 1);
   if (!d->mask) {
-    nfree(d);
+    free(d);
     return;
   }
   strncpyz(d->mask, mask, strlen(mask) + 1);
@@ -134,8 +134,8 @@
       else
         start_delay = d->next;
       if (d->mask)
-        nfree(d->mask);
-      nfree(d);
+        free(d->mask);
+      free(d);
       break;
     }
   }
@@ -161,25 +161,12 @@
   for (d = start_delay; d; d = dnext) {
     dnext = d->next;
     if (d->mask)
-      nfree(d->mask);
-    nfree(d);
+      free(d->mask);
+    free(d);
   }
   start_delay = NULL;
 }
 
-static int delay_expmem()
-{
-  int size = 0;
-  struct delay_mode *d = NULL;
-
-  for (d = start_delay; d; d = d->next) {
-    if (d->mask)
-      size += strlen(d->mask) + 1;
-    size += sizeof(struct delay_mode);
-  }
-  return size;
-}
-
 /*
  *   Botnet commands
  */
@@ -615,7 +602,7 @@
 	  return;
 	if (uet->got_share) {
 	  if (!(e = find_user_entry(uet, u))) {
-	    e = user_malloc(sizeof(struct user_entry));
+	    e = malloc(sizeof(struct user_entry));
 
 	    e->type = uet;
 	    e->name = NULL;
@@ -626,7 +613,7 @@
 	  if (!e->u.list) {
 	    list_delete((struct list_type **) &(u->entries),
 			(struct list_type *) e);
-	    nfree(e);
+	    free(e);
 	  }
 	}
 	noshare = 0;
@@ -1149,8 +1136,7 @@
       strcpy(dcc[i].addr, iptostr(htonl(my_atoul(ip))));
       dcc[i].port = atoi(port);
       strcpy(dcc[i].nick, "*users");
-      dcc[i].u.xfer->filename = nmalloc(strlen(s) + 1);
-      strcpy(dcc[i].u.xfer->filename, s);
+      malloc_strcpy(dcc[i].u.xfer->filename, s);
       dcc[i].u.xfer->origname = dcc[i].u.xfer->filename;
       dcc[i].u.xfer->length = atoi(par);
       dcc[i].u.xfer->f = f;
@@ -1397,7 +1383,7 @@
 {
   tandbuf **old = &tbuf, *new;
 
-  new = nmalloc(sizeof(tandbuf));
+  new = malloc(sizeof(tandbuf));
   strcpy(new->bot, bot);
   new->q = NULL;
   new->timer = now;
@@ -1419,10 +1405,10 @@
         tbuf = t->next;
       for (q = t->q; q && q->msg[0]; q = r) {
 	r = q->next;
-	nfree(q->msg);
-	nfree(q);
+	free(q->msg);
+	free(q);
       }
-      nfree(t);
+      free(t);
       break;
     }
   }
@@ -1484,12 +1470,11 @@
   int cnt;
 
   if (!qq) {
-    q = (struct share_msgq *) nmalloc(sizeof(struct share_msgq));
+    q = (struct share_msgq *) malloc(sizeof(struct share_msgq));
 
     q->chan = chan;
     q->next = NULL;
-    q->msg = (char *) nmalloc(strlen(s) + 1);
-    strcpy(q->msg, s);
+    malloc_strcpy(q->msg, s);
     return q;
   }
   cnt = 0;
@@ -1497,13 +1482,12 @@
     cnt++;
   if (cnt > 1000)
     return NULL;		/* Return null: did not alter queue */
-  q->next = (struct share_msgq *) nmalloc(sizeof(struct share_msgq));
+  q->next = (struct share_msgq *) malloc(sizeof(struct share_msgq));
 
   q = q->next;
   q->chan = chan;
   q->next = NULL;
-  q->msg = (char *) nmalloc(strlen(s) + 1);
-  strcpy(q->msg, s);
+  malloc_strcpy(q->msg, s);
   return qq;
 }
 
@@ -1685,8 +1669,8 @@
 	  struct list_type *lt;
 	  struct user_entry *nue;
 
-	  nue = user_malloc(sizeof(struct user_entry));
-	  nue->name = user_malloc(strlen(ue->name) + 1);
+	  nue = malloc(sizeof(struct user_entry));
+	  nue->name = malloc(strlen(ue->name) + 1);
 	  nue->type = NULL;
 	  nue->u.list = NULL;
 	  strcpy(nue->name, ue->name);
@@ -1694,10 +1678,9 @@
 	  for (lt = ue->u.list; lt; lt = lt->next) {
 	    struct list_type *list;
 
-	    list = user_malloc(sizeof(struct list_type));
+	    list = malloc(sizeof(struct list_type));
 	    list->next = NULL;
-	    list->extra = user_malloc(strlen(lt->extra) + 1);
-	    strcpy(list->extra, lt->extra);
+	    malloc_strcpy(list->extra, lt->extra);
 	    list_append((&nue->u.list), list);
 	  }
 	} else {
@@ -1952,7 +1935,7 @@
 	    register char *tmp = str_escape(bi->address, ':', '\\');
 	    egg_snprintf(s2, sizeof s2, "s c BOTADDR %s %s %d %d\n", u->handle,
 			 tmp, bi->telnet_port, bi->relay_port);
-	    nfree(tmp);
+	    free(tmp);
 	  }
 	  q_tbuf(dcc[idx].nick, s2, NULL);
 	  fr.match = FR_GLOBAL;
@@ -2107,30 +2090,12 @@
   return NULL;
 }
 
-static int share_expmem()
-{
-  int tot = 0;
-  struct share_msgq *q;
-  tandbuf *t;
-
-  for (t = tbuf; t && t->bot[0]; t = t->next) {
-    tot += sizeof(tandbuf);
-    for (q = t->q; q; q = q->next) {
-	tot += sizeof(struct share_msgq);
-	tot += strlen(q->msg) + 1;
-      }
-  }
-  tot += uff_expmem();
-  tot += delay_expmem();
-  return tot;
-}
-
 static void share_report(int idx, int details)
 {
   int i, j;
 
   if (details) {
-    dprintf(idx, "    Share module, using %d bytes.\n", share_expmem());
+    dprintf(idx, "    Share module\n");
     dprintf(idx, "    Private owners: %3s   Allow resync: %3s\n",
 	    (private_global || (private_globals_bitmask() & USER_OWNER)) ?
 	    "yes" : "no", allow_resync ? "yes" : "no");
@@ -2186,7 +2151,7 @@
   /* 0 - 3 */
   (Function) start,
   (Function) share_close,
-  (Function) share_expmem,
+  (Function) 0,
   (Function) share_report,
   /* 4 - 7 */
   (Function) finish_share,
Index: eggdrop1.7/src/mod/share.mod/uf_features.c
diff -u eggdrop1.7/src/mod/share.mod/uf_features.c:1.7 eggdrop1.7/src/mod/share.mod/uf_features.c:1.8
--- eggdrop1.7/src/mod/share.mod/uf_features.c:1.7	Wed Apr 11 21:39:47 2001
+++ eggdrop1.7/src/mod/share.mod/uf_features.c	Wed Oct 10 05:44:07 2001
@@ -1,7 +1,7 @@
 /*
  * uf_features.c -- part of share.mod
  *
- * $Id: uf_features.c,v 1.7 2001/04/12 02:39:47 guppy Exp $
+ * $Id: uf_features.c,v 1.8 2001/10/10 10:44:07 tothwolf Exp $
  */
 /*
  * Copyright (C) 2000, 2001 Eggheads Development Team
@@ -82,19 +82,7 @@
 
 static void uff_init(void)
 {
-  egg_bzero(&uff_list, sizeof(uff_head_t));
-}
-
-/* Calculate memory used for list.
- */
-static int uff_expmem(void)
-{
-  uff_list_t *ul;
-  int tot = 0;
-
-  for (ul = uff_list.start; ul; ul = ul->next)
-    tot += sizeof(uff_list_t);
-  return tot;
+  memset(&uff_list, 0, sizeof(uff_head_t));
 }
 
 /* Search for a feature in the uff feature list that matches a supplied
@@ -183,7 +171,7 @@
 	   ut->flag, ut->feature, ul->entry->feature);
     return;
   }
-  ul = nmalloc(sizeof(uff_list_t));
+  ul = malloc(sizeof(uff_list_t));
   ul->entry = ut;
   uff_insert_entry(ul);
 }
@@ -207,7 +195,7 @@
   for (ul = uff_list.start; ul; ul = ul->next)
     if (!strcmp(ul->entry->feature, ut->feature)) {
       uff_remove_entry(ul);
-      nfree(ul);
+      free(ul);
       return 1;
     }
   return 0;
@@ -237,7 +225,7 @@
   uff_list_t *ul;
 
   uff_sbuf[0] = 0;				/* Reset static buffer	*/
-  p = s = buf = nmalloc(strlen(par) + 1);	/* Allocate temp buffer	*/
+  p = s = buf = malloc(strlen(par) + 1);	/* Allocate temp buffer	*/
   strcpy(buf, par);
 
   /* Clear all currently set features. */
@@ -256,7 +244,7 @@
     }
     p = ++s;
   }
-  nfree(buf);
+  free(buf);
 
   /* Send response string						*/
   if (uff_sbuf[0])
@@ -284,7 +272,7 @@
   uff_list_t *ul;
 
   uff_sbuf[0] = 0;				/* Reset static buffer	*/
-  p = s = buf = nmalloc(strlen(par) + 1);	/* Allocate temp buffer	*/
+  p = s = buf = malloc(strlen(par) + 1);	/* Allocate temp buffer	*/
   strcpy(buf, par);
 
   /* Clear all currently set features. */
@@ -310,12 +298,12 @@
       dprintf(idx, "s e Attempt to use an unsupported feature\n");
       zapfbot(idx);
 
-      nfree(buf);
+      free(buf);
       return 0;
     }
     p = ++s;
   }
-  nfree(buf);
+  free(buf);
   return 1;
 }
 
Index: eggdrop1.7/src/mod/transfer.mod/transfer.c
diff -u eggdrop1.7/src/mod/transfer.mod/transfer.c:1.44 eggdrop1.7/src/mod/transfer.mod/transfer.c:1.45
--- eggdrop1.7/src/mod/transfer.mod/transfer.c:1.44	Tue Oct  9 20:20:14 2001
+++ eggdrop1.7/src/mod/transfer.mod/transfer.c	Wed Oct 10 05:44:08 2001
@@ -1,7 +1,7 @@
 /*
  * transfer.c -- part of transfer.mod
  *
- * $Id: transfer.c,v 1.44 2001/10/10 01:20:14 ite Exp $
+ * $Id: transfer.c,v 1.45 2001/10/10 10:44:08 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -187,10 +187,10 @@
  */
 static char *replace_spaces(char *fn)
 {
-  register char *ret, *p;
+  register char *ret = NULL, *p;
 
-  p = ret = nmalloc(strlen(fn) + 1);
-  strcpy(ret, fn);
+  malloc_strcpy(ret, fn);
+  p = ret;
   while ((p = strchr(p, ' ')) != NULL)
     *p = '_';
   return ret;
@@ -259,26 +259,14 @@
  *    File queue functions
  */
 
-static int expmem_fileq()
-{
-  fileq_t *q;
-  int tot = 0;
-
-  for (q = fileq; q; q = q->next) 
-    tot += strlen(q->dir) + strlen(q->file) + 2 + sizeof(fileq_t);
-  return tot;
-}
-
 static void queue_file(char *dir, char *file, char *from, char *to)
 {
   fileq_t *q = fileq;
 
-  fileq = (fileq_t *) nmalloc(sizeof(fileq_t));
+  fileq = (fileq_t *) malloc(sizeof(fileq_t));
   fileq->next = q;
-  fileq->dir = (char *) nmalloc(strlen(dir) + 1);
-  fileq->file = (char *) nmalloc(strlen(file) + 1);
-  strcpy(fileq->dir, dir);
-  strcpy(fileq->file, file);
+  malloc_strcpy(fileq->dir, dir);
+  malloc_strcpy(fileq->file, file);
   strcpy(fileq->nick, from);
   strcpy(fileq->to, to);
 }
@@ -297,9 +285,9 @@
     last->next = q->next;
   else
     fileq = q->next;
-  nfree(q->dir);
-  nfree(q->file);
-  nfree(q);
+  free(q->dir);
+  free(q->file);
+  free(q);
 }
 
 /* Remove all files queued to a certain user.
@@ -327,7 +315,7 @@
 static void send_next_file(char *to)
 {
   fileq_t *q, *this = NULL;
-  char *s, *s1;
+  char *s, *s1 = NULL;
   int x;
 
   for (q = fileq; q; q = q->next)
@@ -337,7 +325,7 @@
     return;			/* None */
   /* Copy this file to /tmp */
   if (this->dir[0] == '*') {	/* Absolute path */
-    s = nmalloc(strlen(&this->dir[1]) + strlen(this->file) + 2);
+    s = malloc(strlen(&this->dir[1]) + strlen(this->file) + 2);
     sprintf(s, "%s/%s", &this->dir[1], this->file);
   } else {
     char *p = strchr(this->dir, '*');
@@ -347,12 +335,12 @@
       return;
     }
     p++;
-    s = nmalloc(strlen(p) + strlen(this->file) + 2);
+    s = malloc(strlen(p) + strlen(this->file) + 2);
     sprintf(s, "%s%s%s", p, p[0] ? "/" : "", this->file);
     strcpy(this->dir, &(p[atoi(this->dir)]));
   }
   if (copy_to_tmp) {
-    s1 = nmalloc(strlen(tempdir) + strlen(this->file) + 1);
+    s1 = malloc(strlen(tempdir) + strlen(this->file) + 1);
     sprintf(s1, "%s%s", tempdir, this->file);
     if (copyfile(s, s1) != 0) {
       putlog(LOG_FILES | LOG_MISC, "*",
@@ -363,19 +351,17 @@
 	      this->to);
       strcpy(s, this->to);
       flush_fileq(s);
-      nfree(s1);
-      nfree(s);
+      free(s1);
+      free(s);
       return;
     }
-  } else {
-    s1 = nmalloc(strlen(s) + 1);
-    strcpy(s1, s);
-  }
+  } else
+    malloc_strcpy(s1, s);
   if (this->dir[0] == '*') {
-    s = nrealloc(s, strlen(&this->dir[1]) + strlen(this->file) + 2);
+    s = realloc(s, strlen(&this->dir[1]) + strlen(this->file) + 2);
     sprintf(s, "%s/%s", &this->dir[1], this->file);
   } else {
-    s = nrealloc(s, strlen(this->dir) + strlen(this->file) + 2);
+    s = realloc(s, strlen(this->dir) + strlen(this->file) + 2);
     sprintf(s, "%s%s%s", this->dir, this->dir[0] ? "/" : "", this->file);
   }
   x = raw_dcc_send(s1, this->to, this->nick, s, 0);
@@ -384,8 +370,8 @@
       dprintf(DP_HELP, "NOTICE %s :Here is a file from %s ...\n", this->to,
 	      this->nick);
     deq_this(this);
-    nfree(s);
-    nfree(s1);
+    free(s);
+    free(s1);
     return;
   }
   wipe_tmp_filename(s1, -1);
@@ -410,8 +396,8 @@
     }
     deq_this(this);
   }
-  nfree(s);
-  nfree(s1);
+  free(s);
+  free(s1);
   return;
 }
 
@@ -486,7 +472,7 @@
     fnd = 0;
     while (q != NULL) {
       if (!egg_strcasecmp(dcc[idx].nick, q->nick)) {
-	s = nrealloc(s, strlen(q->dir) + strlen(q->file) + 3);
+	s = realloc(s, strlen(q->dir) + strlen(q->file) + 3);
 	if (q->dir[0] == '*')
 	  sprintf(s, "%s/%s", &q->dir[1], q->file);
 	else
@@ -511,7 +497,7 @@
     }
   }
   if (s)
-    nfree(s);
+    free(s);
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type == &DCC_GET_PENDING || dcc[i].type == &DCC_GET) &&
 	(!egg_strcasecmp(dcc[i].nick, dcc[idx].nick) ||
@@ -555,7 +541,7 @@
   BADARGS(2, 2, " handle");
   for (q = fileq; q; q = q->next) {
     if (!egg_strcasecmp(q->nick, argv[1])) {
-      s = nrealloc(s, strlen(q->to) + strlen(q->dir) + strlen(q->file) + 4);
+      s = realloc(s, strlen(q->to) + strlen(q->dir) + strlen(q->file) + 4);
       if (q->dir[0] == '*')
 	sprintf(s, "%s %s/%s", q->to, &q->dir[1], q->file);
       else
@@ -564,7 +550,7 @@
     }
   }
   if (s)
-    nfree(s);
+    free(s);
   return TCL_OK;
 }
 
@@ -575,7 +561,7 @@
 
 static int tcl_dccsend STDVAR
 {
-  char s[10], *sys, *nfn;
+  char s[10], *sys = NULL, *nfn;
   int i;
   FILE *f;
 
@@ -600,28 +586,26 @@
       nfn--;
       *nfn = 0;
       nfn++;
-      sys = nmalloc(strlen(argv[1]) + 2);
+      sys = malloc(strlen(argv[1]) + 2);
       sprintf(sys, "*%s", argv[1]);
       queue_file(sys, nfn, "(script)", argv[2]);
-      nfree(sys);
+      free(sys);
     }
     Tcl_AppendResult(irp, "4", NULL);
     return TCL_OK;
   }
   if (copy_to_tmp) {
-    sys = nmalloc(strlen(tempdir) + strlen(nfn) + 1);
+    sys = malloc(strlen(tempdir) + strlen(nfn) + 1);
     sprintf(sys, "%s%s", tempdir, nfn);		/* New filename, in /tmp */
     copyfile(argv[1], sys);
-  } else {
-    sys = nmalloc(strlen(argv[1]) + 1);
-    strcpy(sys, argv[1]);
-  }
+  } else
+    malloc_strcpy(sys, argv[1]);
   i = raw_dcc_send(sys, argv[2], "*", argv[1], 0);
   if (i > 0)
     wipe_tmp_filename(sys, -1);
   egg_snprintf(s, sizeof s, "%d", i);
   Tcl_AppendResult(irp, s, NULL);
-  nfree(sys);
+  free(sys);
   return TCL_OK;
 }
 
@@ -679,7 +663,7 @@
 {
   const unsigned long		 buf_len = pending_data >= PMAX_SIZE ?
 	  					PMAX_SIZE : pending_data;
-  char				*bf = nmalloc(buf_len);
+  char				*bf = malloc(buf_len);
   register unsigned long	 actual_size;
 
   if (bf) {
@@ -689,7 +673,7 @@
       tputs(sock, bf, actual_size);
       pending_data -= actual_size;
     } while (!sock_has_data(SOCK_DATA_OUTGOING, sock) && pending_data != 0);
-    nfree(bf);
+    free(bf);
   }
   return pending_data;
 }
@@ -725,10 +709,10 @@
     putlog(LOG_MISC, "*", "%s: SEND %s (%s!%s)", _("DCC connection failed"),
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host);
     putlog(LOG_MISC, "*", "    (%s)", s1);
-    s2 = nmalloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    s2 = malloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(s2, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(s2);
-    nfree(s2);
+    free(s2);
   }
   killsock(dcc[idx].sock);
   lostdcc(idx);
@@ -778,8 +762,8 @@
       return;
     }
     /* Move the file from /tmp */
-    ofn = nmalloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
-    nfn = nmalloc(strlen(dcc[idx].u.xfer->dir)
+    ofn = malloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    nfn = malloc(strlen(dcc[idx].u.xfer->dir)
 		  + strlen(dcc[idx].u.xfer->origname) + 1);
     sprintf(ofn, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     sprintf(nfn, "%s%s", dcc[idx].u.xfer->dir, dcc[idx].u.xfer->origname);
@@ -798,8 +782,8 @@
       stats_add_upload(u, dcc[idx].u.xfer->length);
       check_tcl_sentrcvd(u, dcc[idx].nick, nfn, H_rcvd);
     }
-    nfree(ofn);
-    nfree(nfn);
+    free(ofn);
+    free(nfn);
     for (j = 0; j < dcc_total; j++)
       if (!ok && (dcc[j].type->flags & (DCT_GETNOTES | DCT_FILES)) &&
 	  !egg_strcasecmp(dcc[j].nick, hand)) {
@@ -844,10 +828,10 @@
     putlog(LOG_FILES, "*", "Lost dcc send %s from %s!%s (%lu/%lu)",
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host,
 	   dcc[idx].status, dcc[idx].u.xfer->length);
-    ofn = nmalloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    ofn = malloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(ofn, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(ofn);
-    nfree(ofn);
+    free(ofn);
     killsock(dcc[idx].sock);
     lostdcc(idx);
   }
@@ -909,7 +893,7 @@
    */
   if (w < 4 ||
       (w < 8 && dcc[idx].u.xfer->type == XFER_RESEND_PEND)) {
-    my_memcpy(&(dcc[idx].u.xfer->buf[dcc[idx].u.xfer->sofar]), buf, len);
+    memcpy(&(dcc[idx].u.xfer->buf[dcc[idx].u.xfer->sofar]), buf, len);
     dcc[idx].u.xfer->sofar += len;
     return;
   /* Waiting for the 8 bit reget packet? */
@@ -918,8 +902,8 @@
     if (w == 8) {
       transfer_reget reget_data;
 
-      my_memcpy(&reget_data, dcc[idx].u.xfer->buf, dcc[idx].u.xfer->sofar);
-      my_memcpy(&reget_data + dcc[idx].u.xfer->sofar, buf, len);
+      memcpy(&reget_data, dcc[idx].u.xfer->buf, dcc[idx].u.xfer->sofar);
+      memcpy(&reget_data + dcc[idx].u.xfer->sofar, buf, len);
       handle_resend_packet(idx, &reget_data);
       cmp = dcc[idx].u.xfer->offset;
     } else
@@ -929,16 +913,16 @@
   } else {
     /* Complete packet? */
     if (w == 4) {
-      my_memcpy(bbuf, dcc[idx].u.xfer->buf, dcc[idx].u.xfer->sofar);
-      my_memcpy(&(bbuf[dcc[idx].u.xfer->sofar]), buf, len);
+      memcpy(bbuf, dcc[idx].u.xfer->buf, dcc[idx].u.xfer->sofar);
+      memcpy(&(bbuf[dcc[idx].u.xfer->sofar]), buf, len);
     } else {
       p = ((w - 1) & ~3) - dcc[idx].u.xfer->sofar;
       w = w - ((w - 1) & ~3);
       if (w < 4) {
-	my_memcpy(dcc[idx].u.xfer->buf, &(buf[p]), w);
+	memcpy(dcc[idx].u.xfer->buf, &(buf[p]), w);
 	return;
       }
-      my_memcpy(bbuf, &(buf[p]), w);
+      memcpy(bbuf, &(buf[p]), w);
     }
     /* This is more compatible than ntohl for machines where an int
      * is more than 4 bytes:
@@ -1116,10 +1100,10 @@
 	   "File too long: dropping dcc send %s from %s!%s",
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host);
     fclose(dcc[idx].u.xfer->f);
-    b = nmalloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    b = malloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(b, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(b);
-    nfree(b);
+    free(b);
     killsock(dcc[idx].sock);
     lostdcc(idx);
   }
@@ -1207,10 +1191,10 @@
     putlog(LOG_FILES, "*", "DCC timeout: SEND %s (%s) at %lu/%lu",
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].status,
 	   dcc[idx].u.xfer->length);
-    buf = nmalloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    buf = malloc(strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(buf, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(buf);
-    nfree(buf);
+    free(buf);
   }
   killsock(dcc[idx].sock);
   lostdcc(idx);
@@ -1243,34 +1227,18 @@
   sprintf(buf, "conn  send");
 }
 
-static int expmem_dcc_xfer(void *x)
-{
-  register struct xfer_info *p = (struct xfer_info *) x;
-  int tot;
-
-  tot = sizeof(struct xfer_info);
-  if (p->filename)
-    tot += strlen(p->filename) + 1;
-  /* We need to check if origname points to filename before
-   * accounting for the memory.
-   */
-  if (p->origname && p->filename != p->origname)
-    tot += strlen(p->origname) + 1;
-  return tot;
-}
-
 static void kill_dcc_xfer(int idx, void *x)
 {
   register struct xfer_info *p = (struct xfer_info *) x;
 
   if (p->filename)
-    nfree(p->filename);
+    free(p->filename);
   /* We need to check if origname points to filename before
    * attempting to free the memory.
    */
   if (p->origname && p->origname != p->filename)
-    nfree(p->origname);
-  nfree(x);
+    free(p->origname);
+  free(x);
 }
 
 static void out_dcc_xfer(int idx, char *buf, void *x)
@@ -1294,7 +1262,6 @@
   &wait_dcc_xfer,
   tout_dcc_send,
   display_dcc_send,
-  expmem_dcc_xfer,
   kill_dcc_xfer,
   out_dcc_xfer
 };
@@ -1310,7 +1277,6 @@
   &wait_dcc_xfer,
   eof_dcc_fork_send,
   display_dcc_fork_send,
-  expmem_dcc_xfer,
   kill_dcc_xfer,
   out_dcc_xfer
 };
@@ -1338,7 +1304,6 @@
   &wait_dcc_xfer,
   transfer_get_timeout,
   display_dcc_get,
-  expmem_dcc_xfer,
   kill_dcc_xfer,
   out_dcc_xfer,
   outdone_dcc_xfer
@@ -1353,7 +1318,6 @@
   &wait_dcc_xfer,
   transfer_get_timeout,
   display_dcc_get_p,
-  expmem_dcc_xfer,
   kill_dcc_xfer,
   out_dcc_xfer
 };
@@ -1482,11 +1446,11 @@
   dcc[i].port = port;
   strcpy(dcc[i].nick, nick);
   strcpy(dcc[i].host, "irc");
-  dcc[i].u.xfer->filename = get_data_ptr(strlen(filename) + 1);
+  malloc_memset(dcc[i].u.xfer->filename, 0, strlen(filename) + 1);
   strcpy(dcc[i].u.xfer->filename, filename);
   if (strchr(nfn, ' '))
     nfn = buf = replace_spaces(nfn);
-  dcc[i].u.xfer->origname = get_data_ptr(strlen(nfn) + 1);
+  malloc_memset(dcc[i].u.xfer->origname, 0, strlen(nfn) + 1);
   strcpy(dcc[i].u.xfer->origname, nfn);
   strcpy(dcc[i].u.xfer->from, from);
   strcpy(dcc[i].u.xfer->dir, dir);
@@ -1502,7 +1466,7 @@
 	   nfn, nick);
   }
   if (buf)
-    nfree(buf);
+    free(buf);
   return DCCSEND_OK;
 }
 
@@ -1541,8 +1505,7 @@
   char *par, *arg;
   struct filesys_stats *fs;
 
-  fs = user_malloc(sizeof(struct filesys_stats));
-  egg_bzero(fs, sizeof(struct filesys_stats));
+  malloc_memset(fs, 0, sizeof(struct filesys_stats));
   par = e->u.list->extra;
   arg = newsplit(&par);
   if (arg[0])
@@ -1565,15 +1528,15 @@
 static int fstat_pack(struct userrec *u, struct user_entry *e)
 {
   register struct filesys_stats *fs;
-  struct list_type *l = user_malloc(sizeof(struct list_type));
+  struct list_type *l = malloc(sizeof(struct list_type));
 
   fs = e->u.extra;
-  l->extra = user_malloc(41);
+  l->extra = malloc(41);
   egg_snprintf(l->extra, 41, "%09u %09u %09u %09u",
           fs->uploads, fs->upload_ks, fs->dnloads, fs->dnload_ks);
   l->next = NULL;
   e->u.list = l;
-  nfree(fs);
+  free(fs);
   return 1;
 }
 
@@ -1596,7 +1559,7 @@
 
   if (e->u.extra != fs) {
     if (e->u.extra)
-      nfree(e->u.extra);
+      free(e->u.extra);
     e->u.extra = fs;
   } else if (!fs) /* e->u.extra == NULL && fs == NULL */
     return 1;
@@ -1608,7 +1571,7 @@
        *  ofs->dnloads != fs->dnloads || ofs->dnload_ks != fs->dnload_ks
        * someone could do:
        *  e->u.extra->uploads = 12345;
-       *  fs = user_malloc(sizeof(struct filesys_stats));
+       *  fs = malloc(sizeof(struct filesys_stats));
        *  memcpy (...e->u.extra...fs...);
        *  set_user(&USERENTRY_FSTAT, u, fs);
        * then we wouldn't detect here that something's changed...
@@ -1650,16 +1613,11 @@
 static int fstat_kill(struct user_entry *e)
 {
   if (e->u.extra)
-    nfree(e->u.extra);
-  nfree(e);
+    free(e->u.extra);
+  free(e);
   return 1;
 }
 
-static int fstat_expmem(struct user_entry *e)
-{
-  return sizeof(struct filesys_stats);
-}
-
 static void fstat_display(int idx, struct user_entry *e)
 {
   struct filesys_stats *fs;
@@ -1692,7 +1650,6 @@
   fstat_set,
   fstat_tcl_get,
   fstat_tcl_set,
-  fstat_expmem,
   fstat_display,
   "FSTAT"
 };
@@ -1713,10 +1670,8 @@
     set_user (&USERENTRY_FSTAT, u, NULL);
     break;
   default:
-    if (!(fs = e->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
-      egg_bzero(fs, sizeof(struct filesys_stats));
-    }
+    if (!(fs = e->u.extra))
+      malloc_memset(fs, 0, sizeof(struct filesys_stats));
     p = newsplit (&par);
     if (p[0])
       fs->uploads = atoi (p);
@@ -1742,8 +1697,8 @@
   struct filesys_stats *fs;
 
   if (e->u.extra) {
-    fs = user_malloc(sizeof(struct filesys_stats));
-    my_memcpy(fs, e->u.extra, sizeof(struct filesys_stats));
+    fs = malloc(sizeof(struct filesys_stats));
+    memcpy(fs, e->u.extra, sizeof(struct filesys_stats));
 
     return set_user(&USERENTRY_FSTAT, u, fs);
   }
@@ -1757,10 +1712,8 @@
 
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
-        !(fs = ue->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
-      egg_bzero(fs, sizeof(struct filesys_stats));
-    }
+        !(fs = ue->u.extra))
+      malloc_memset(fs, 0, sizeof(struct filesys_stats));
     fs->dnloads++;
     fs->dnload_ks += ((bytes + 512) / 1024);
     set_user(&USERENTRY_FSTAT, u, fs);
@@ -1775,10 +1728,8 @@
 
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
-        !(fs = ue->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
-      egg_bzero(fs, sizeof(struct filesys_stats));
-    }
+        !(fs = ue->u.extra))
+      malloc_memset(fs, 0, sizeof(struct filesys_stats));
     fs->uploads++;
     fs->upload_ks += ((bytes + 512) / 1024);
     set_user(&USERENTRY_FSTAT, u, fs);
@@ -1800,10 +1751,8 @@
   switch (argv[3][0]) {
   case 'u':
   case 'd':
-    if (!(fs = e->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
-      egg_bzero(fs, sizeof(struct filesys_stats));
-    }
+    if (!(fs = e->u.extra))
+      malloc_memset(fs, 0, sizeof(struct filesys_stats));
     switch (argv[3][0]) {
     case 'u':
       fs->uploads = f;
@@ -1926,18 +1875,11 @@
   return NULL;
 }
 
-static int transfer_expmem()
-{
-  return expmem_fileq();
-}
-
 static void transfer_report(int idx, int details)
 {
-  if (details) {
+  if (details)
     dprintf(idx, "    DCC block is %d%s, max concurrent d/ls is %d\n",
 	    dcc_block, (dcc_block == 0) ? " (turbo dcc)" : "", dcc_limit);
-    dprintf(idx, "    Using %d bytes of memory\n", transfer_expmem());
-  }
 }
 
 EXPORT_SCOPE char *start();
@@ -1946,7 +1888,7 @@
 {
   (Function) start,
   (Function) transfer_close,
-  (Function) transfer_expmem,
+  (Function) 0,
   (Function) transfer_report,
   /* 4- 7 */
   (Function) & DCC_FORK_SEND,		/* struct dcc_table		*/
Index: eggdrop1.7/src/mod/uptime.mod/uptime.c
diff -u eggdrop1.7/src/mod/uptime.mod/uptime.c:1.13 eggdrop1.7/src/mod/uptime.mod/uptime.c:1.14
--- eggdrop1.7/src/mod/uptime.mod/uptime.c:1.13	Tue Oct  9 20:20:14 2001
+++ eggdrop1.7/src/mod/uptime.mod/uptime.c	Wed Oct 10 05:44:08 2001
@@ -1,6 +1,6 @@
 /* Original Copyright (c) 2000-2001 proton
  * 
- * $Id: uptime.c,v 1.13 2001/10/10 01:20:14 ite Exp $
+ * $Id: uptime.c,v 1.14 2001/10/10 10:44:08 tothwolf Exp $
  * Borrowed from Emech, reports to http://uptime.energymech.net, feel free to opt out if you
  * dont like it by not loading the module.
  * 
@@ -60,7 +60,7 @@
 
 static Function *global = NULL, *server_funcs = NULL;
 
-char *uptime_host;
+char *uptime_host = NULL;
 int uptimeport = 9969;
 int hours=0;
 int uptimesock;
@@ -70,19 +70,9 @@
 time_t uptimelast;
 char uptime_version[50]="";
 
-static int uptime_expmem() {
-	int size = 256;
-	return size;
-}
-
 static void uptime_report(int idx, int details)
 {
-  int size;
-
   Context;
-  size = uptime_expmem();
-  if (details)
-    dprintf(idx, "   using %d bytes\n", size);
 }
 	
 
@@ -163,7 +153,7 @@
 			return -2;
 	}
 	len = sizeof(upPack) + strlen(botnetnick) + strlen(s) + strlen(uptime_version);
-	mem = (PackUp*)nmalloc(len);
+	mem = (PackUp*)malloc(len);
 	memcpy(mem,&upPack,sizeof(upPack));
 	sprintf(mem->string,"%s %s %s",botnetnick,s,uptime_version);
 	memset(&sai,0,sizeof(sai));
@@ -172,7 +162,7 @@
 	sai.sin_port = htons(uptimeport);
 	len = sendto(uptimesock,(void*)mem,len,0,(struct sockaddr*)&sai,sizeof(sai));
 	putlog(LOG_DEBUG, "*", "len = %d",len);
-	nfree(mem);
+	free(mem);
 	return len;
 }
 
@@ -213,7 +203,7 @@
 	rem_tcl_strings(mystrings);
 	rem_tcl_ints(myints);
 	rem_builtins(H_dcc, mydcc);
-	nfree(uptime_host);
+	free(uptime_host);
 	close(uptimesock);
 	del_hook(HOOK_HOURLY, (Function) check_hourly);
 	module_undepend(MODULE_NAME);
@@ -226,7 +216,7 @@
     {
         (Function) start,
         (Function) uptime_close,
-        (Function) uptime_expmem,
+        (Function) 0,
         (Function) uptime_report,
     };
 
@@ -246,8 +236,7 @@
 	add_tcl_ints(myints);
 	add_builtins(H_dcc, mydcc);
 	add_hook(HOOK_HOURLY, (Function) check_hourly);
-	uptime_host=nmalloc(256);
-	strcpy(uptime_host, UPTIME_HOST);
+	malloc_strcpy(uptime_host, UPTIME_HOST);
 	init_uptime();
 	return NULL;
 }
Index: eggdrop1.7/src/mod/woobie.mod/woobie.c
diff -u eggdrop1.7/src/mod/woobie.mod/woobie.c:1.17 eggdrop1.7/src/mod/woobie.mod/woobie.c:1.18
--- eggdrop1.7/src/mod/woobie.mod/woobie.c:1.17	Tue Oct  9 20:20:14 2001
+++ eggdrop1.7/src/mod/woobie.mod/woobie.c	Wed Oct 10 05:44:08 2001
@@ -5,7 +5,7 @@
  * Originally written by ButchBub	  15 July     1997
  * Comments by Fabian Knittel		  29 December 1999
  *
- * $Id: woobie.c,v 1.17 2001/10/10 01:20:14 ite Exp $
+ * $Id: woobie.c,v 1.18 2001/10/10 10:44:08 tothwolf Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001 Eggheads Development Team
@@ -38,16 +38,6 @@
  */
 static Function *global = NULL;
 
-/* Calculate the memory we keep allocated.
- */
-static int woobie_expmem()
-{
-  int size = 0;
-
-  Context;
-  return size;
-}
-
 static int cmd_woobie(struct userrec *u, int idx, char *par)
 {
   /* Define a context.
@@ -72,12 +62,7 @@
  */
 static void woobie_report(int idx, int details)
 {
-  int size;
-
   Context;
-  size = woobie_expmem();
-  if (details)
-    dprintf(idx, "    0 woobies using %d bytes\n", size);
 }
 
 /* Note: The tcl-name is automatically created if you set it to NULL. In
@@ -119,7 +104,7 @@
 {
   (Function) woobie_start,
   (Function) woobie_close,
-  (Function) woobie_expmem,
+  (Function) 0,
   (Function) woobie_report,
 };
 
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.62 eggdrop1.7/src/modules.c:1.63
--- eggdrop1.7/src/modules.c:1.62	Tue Oct  9 20:20:10 2001
+++ eggdrop1.7/src/modules.c	Wed Oct 10 05:44:04 2001
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.62 2001/10/10 01:20:10 ite Exp $
+ * $Id: modules.c,v 1.63 2001/10/10 10:44:04 tothwolf Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -77,10 +77,9 @@
 
 void check_static(char *name, char *(*func) ())
 {
-  struct static_list *p = nmalloc(sizeof(struct static_list));
+  struct static_list *p = malloc(sizeof(struct static_list));
 
-  p->name = nmalloc(strlen(name) + 1);
-  strcpy(p->name, name);
+  malloc_strcpy(p->name, name);
   p->func = func;
   p->next = static_modules;
   static_modules = p;
@@ -153,8 +152,8 @@
 Function global_table[] =
 {
   /* 0 - 3 */
-  (Function) mod_malloc,
-  (Function) mod_free,
+  (Function) 0,
+  (Function) 0,
 #ifdef DEBUG_CONTEXT
   (Function) eggContext,
 #else
@@ -203,9 +202,9 @@
   (Function) nextbot,
   /* 36 - 39 */
   (Function) zapfbot,
-  (Function) n_free,
+  (Function) 0,
   (Function) u_pass_match,
-  (Function) _user_malloc,
+  (Function) 0,
   /* 40 - 43 */
   (Function) get_user,
   (Function) set_user,
@@ -264,11 +263,11 @@
   /* 84 - 87 */
   (Function) open_listen,
   (Function) open_telnet_dcc,
-  (Function) _get_data_ptr,
+  (Function) 0,
   (Function) open_telnet,
   /* 88 - 91 */
   (Function) check_tcl_event,
-  (Function) egg_memcpy,
+  (Function) 0,
   (Function) my_atoul,
   (Function) my_strcpy,
   /* 92 - 95 */
@@ -348,7 +347,7 @@
   (Function) def_get,
   /* 152 - 155 */
   (Function) makepass,
-  (Function) _wild_match,
+  (Function) wild_match,
   (Function) maskhost,
   (Function) show_motd,
   /* 156 - 159 */
@@ -367,8 +366,8 @@
   (Function) detect_dcc_flood,
   (Function) flush_lines,
   /* 168 - 171 */
-  (Function) expected_memory,
-  (Function) tell_mem_status,
+  (Function) 0,
+  (Function) 0,
   (Function) & do_restart,	/* int					*/
   (Function) check_tcl_filt,
   /* 172 - 175 */
@@ -443,8 +442,8 @@
   (Function) & force_expire,	/* int					*/
   /* 228 - 231 */
   (Function) 0,
-  (Function) _user_realloc,
-  (Function) mod_realloc,
+  (Function) 0,
+  (Function) 0,
   (Function) xtra_set,
   /* 232 - 235 */
 #ifdef DEBUG_CONTEXT
@@ -482,7 +481,7 @@
   /* 252 - 255 */
   (Function) egg_snprintf,
   (Function) egg_vsnprintf,
-  (Function) egg_memset,
+  (Function) 0,
   (Function) egg_strcasecmp,
   /* 256 - 259 */
   (Function) egg_strncasecmp,
@@ -530,9 +529,8 @@
   int i;
   char wbuf[1024];
 
-  module_list = nmalloc(sizeof(module_entry));
-  module_list->name = nmalloc(8);
-  strcpy(module_list->name, "eggdrop");
+  module_list = malloc(sizeof(module_entry));
+  malloc_strcpy(module_list->name, "eggdrop");
   module_list->major = (egg_numver) / 10000;
   module_list->minor = ((egg_numver) / 100) % 100;
 #ifndef STATIC
@@ -552,40 +550,6 @@
     hook_list[i] = NULL;
 }
 
-int expmem_modules(int y)
-{
-  int c = 0;
-  int i;
-  module_entry *p;
-  dependancy *d;
-  struct hook_entry *q;
-#ifdef STATIC
-  struct static_list *s;
-#endif
-  Function *f;
-
-#ifdef STATIC
-  for (s = static_modules; s; s = s->next)
-    c += sizeof(struct static_list) + strlen(s->name) + 1;
-#endif
-
-  for (i = 0; i < REAL_HOOKS; i++)
-    for (q = hook_list[i]; q; q = q->next)
-      c += sizeof(struct hook_entry);
-
-  for (d = dependancy_list; d; d = d->next)
-    c += sizeof(dependancy);
-
-  for (p = module_list; p; p = p->next) {
-    c += sizeof(module_entry);
-    c += strlen(p->name) + 1;
-    f = p->funcs;
-    if (f && f[MODCALL_EXPMEM] && !y)
-      c += (int) (f[MODCALL_EXPMEM] ());
-  }
-  return c;
-}
-
 int module_register(char *name, Function * funcs,
 		    int major, int minor)
 {
@@ -637,11 +601,10 @@
     return "Unknown module.";
   f = (Function) sl->func;
 #endif
-  p = nmalloc(sizeof(module_entry));
+  p = malloc(sizeof(module_entry));
   if (p == NULL)
     return "Malloc error";
-  p->name = nmalloc(strlen(name) + 1);
-  strcpy(p->name, name);
+  malloc_strcpy(p->name, name);
   p->major = 0;
   p->minor = 0;
 #ifndef STATIC
@@ -653,8 +616,8 @@
   e = (((char *(*)()) f) (global_table));
   if (e) {
     module_list = module_list->next;
-    nfree(p->name);
-    nfree(p);
+    free(p->name);
+    free(p);
     return e;
   }
   check_tcl_load(name);
@@ -688,13 +651,13 @@
 	lt_dlclose(p->hand);
 #endif				/* STATIC */
       }
-      nfree(p->name);
+      free(p->name);
       if (o == NULL) {
 	module_list = p->next;
       } else {
 	o->next = p->next;
       }
-      nfree(p);
+      free(p);
       putlog(LOG_MISC, "*", "%s %s", _("Module unloaded:"), name);
       return NULL;
     }
@@ -725,9 +688,8 @@
 
   for (p = module_list; p && p->name; p = p->next)
     if (!egg_strcasecmp(name, p->name)) {
-      nfree(p->name);
-      p->name = nmalloc(strlen(newname) + 1);
-      strcpy(p->name, newname);
+      free(p->name);
+      malloc_strcpy(p->name, newname);
       return 1;
     }
   return 0;
@@ -746,7 +708,7 @@
   }
   if (!p || !o)
     return 0;
-  d = nmalloc(sizeof(dependancy));
+  d = malloc(sizeof(dependancy));
 
   d->needed = p;
   d->needing = o;
@@ -772,7 +734,7 @@
       } else {
 	o->next = d->next;
       }
-      nfree(d);
+      free(d);
       if (o == NULL)
 	d = dependancy_list;
       else
@@ -786,45 +748,6 @@
   return ok;
 }
 
-void *mod_malloc(int size, const char *modname, const char *filename, int line)
-{
-#ifdef DEBUG_MEM
-  char x[100], *p;
-
-  p = strrchr(filename, '/');
-  egg_snprintf(x, sizeof x, "%s:%s", modname, p ? p + 1 : filename);
-  x[19] = 0;
-  return n_malloc(size, x, line);
-#else
-  return nmalloc(size);
-#endif
-}
-
-void *mod_realloc(void *ptr, int size, const char *modname,
-		  const char *filename, int line)
-{
-#ifdef DEBUG_MEM
-  char x[100], *p;
-
-  p = strrchr(filename, '/');
-  egg_snprintf(x, sizeof x, "%s:%s", modname, p ? p + 1 : filename);
-  x[19] = 0;
-  return n_realloc(ptr, size, x, line);
-#else
-  return nrealloc(ptr, size);
-#endif
-}
-
-void mod_free(void *ptr, const char *modname, const char *filename, int line)
-{
-  char x[100], *p;
-
-  p = strrchr(filename, '/');
-  egg_snprintf(x, sizeof x, "%s:%s", modname, p ? p + 1 : filename);
-  x[19] = 0;
-  n_free(ptr, x, line);
-}
-
 /* Hooks, various tables of functions to call on ceratin events
  */
 void add_hook(int hook_num, Function func)
@@ -835,7 +758,7 @@
     for (p = hook_list[hook_num]; p; p = p->next)
       if (p->func == func)
 	return;			/* Don't add it if it's already there */
-    p = nmalloc(sizeof(struct hook_entry));
+    p = malloc(sizeof(struct hook_entry));
 
     p->next = hook_list[hook_num];
     hook_list[hook_num] = p;
@@ -897,7 +820,7 @@
 	  hook_list[hook_num] = p->next;
 	else
 	  o->next = p->next;
-	nfree(p);
+	free(p);
 	break;
       }
       o = p;
Index: eggdrop1.7/src/modules.h
diff -u eggdrop1.7/src/modules.h:1.9 eggdrop1.7/src/modules.h:1.10
--- eggdrop1.7/src/modules.h:1.9	Wed Apr 11 21:39:43 2001
+++ eggdrop1.7/src/modules.h	Wed Oct 10 05:44:04 2001
@@ -4,7 +4,7 @@
  *
  * by Darrin Smith (beldin at light.iinet.net.au)
  *
- * $Id: modules.h,v 1.9 2001/04/12 02:39:43 guppy Exp $
+ * $Id: modules.h,v 1.10 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -46,10 +46,6 @@
 module_entry *module_find(char *name, int, int);
 Function *module_depend(char *, char *, int major, int minor);
 int module_undepend(char *);
-void *mod_malloc(int size, const char *modname, const char *filename, int line);
-void *mod_realloc(void *ptr, int size, const char *modname,
-		  const char *filename, int line);
-void mod_free(void *ptr, const char *modname, const char *filename, int line);
 void add_hook(int hook_num, Function func);
 void del_hook(int hook_num, Function func);
 void *get_next_hook(int hook_num, void *func);
Index: eggdrop1.7/src/net.c
diff -u eggdrop1.7/src/net.c:1.41 eggdrop1.7/src/net.c:1.42
--- eggdrop1.7/src/net.c:1.41	Sat Aug 18 21:49:40 2001
+++ eggdrop1.7/src/net.c	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * net.c -- handles:
  *   all raw network i/o
  * 
- * $Id: net.c,v 1.41 2001/08/19 02:49:40 drummer Exp $
+ * $Id: net.c,v 1.42 2001/10/10 10:44:04 tothwolf Exp $
  */
 /* 
  * This is hereby released into the public domain.
@@ -103,21 +103,6 @@
       fatal(adns_strerror(i), 0);
 }
 
-int expmem_net()
-{
-  int i, tot = 0;
-
-  for (i = 0; i < MAXSOCKS; i++) {
-    if (!(socklist[i].flags & SOCK_UNUSED)) {
-      if (socklist[i].inbuf != NULL)
-	tot += strlen(socklist[i].inbuf) + 1;
-      if (socklist[i].outbuf != NULL)
-	tot += socklist[i].outbuflen;
-    }
-  }
-  return tot;
-}
-
 /* Get my ip number
  */
 IP getmyip()
@@ -330,13 +315,10 @@
   for (i = 0; i < MAXSOCKS; i++) {
     if ((socklist[i].sock == sock) && !(socklist[i].flags & SOCK_UNUSED)) {
       close(socklist[i].sock);
-      if (socklist[i].inbuf != NULL) {
-	nfree(socklist[i].inbuf);
-	socklist[i].inbuf = NULL;
-      }
+      if (socklist[i].inbuf != NULL)
+	free_null(socklist[i].inbuf);
       if (socklist[i].outbuf != NULL) {
-	nfree(socklist[i].outbuf);
-	socklist[i].outbuf = NULL;
+	free_null(socklist[i].outbuf);
 	socklist[i].outbuflen = 0;
       }
       socklist[i].flags = SOCK_UNUSED;
@@ -360,7 +342,7 @@
     /* numeric IP? */
     if (host[strlen(host) - 1] >= '0' && host[strlen(host) - 1] <= '9') {
       IP ip = ((IP) inet_addr(host)); /* drummer */      
-      egg_memcpy(x, &ip, 4);	/* Beige at Efnet */
+      memcpy(x, &ip, 4);	/* Beige at Efnet */
     } else {
       /* no, must be host.domain */
       if (!setjmp(alarmret)) {
@@ -374,7 +356,7 @@
 	killsock(sock);
 	return -2;
       }
-      egg_memcpy(x, hp->h_addr, hp->h_length);
+      memcpy(x, hp->h_addr, hp->h_length);
     }
     for (i = 0; i < MAXSOCKS; i++)
       if (!(socklist[i].flags & SOCK_UNUSED) && socklist[i].sock == sock)
@@ -429,7 +411,7 @@
     port = sport;
   }
 
-  egg_bzero((char *) &name, sizeof name);
+  memset((char *) &name, 0, sizeof name);
 #ifdef IPV6
   name.sin6_family = AF_INET6;
   name.sin6_port = htons(port);
@@ -472,11 +454,11 @@
       return -2;
       
 #ifndef IPV6      
-  egg_memcpy(&name.sin_addr, hp->h_addr, hp->h_length);
+  memcpy(&name.sin_addr, hp->h_addr, hp->h_length);
   name.sin_family = hp->h_addrtype;
 #else
   if (hp->h_addrtype == AF_INET6)
-    egg_memcpy(&name.sin6_addr, hp->h_addr, hp->h_length);
+    memcpy(&name.sin6_addr, hp->h_addr, hp->h_length);
   else if (hp->h_addrtype == AF_INET)
     name.sin6_addr = ipv4to6(*((unsigned int*) hp->h_addr));
   else
@@ -484,7 +466,7 @@
   name.sin6_family = AF_INET6;
 #endif
 
-  egg_bzero((char *) &vname, sizeof vname);
+  memset((char *) &vname, 0, sizeof vname);
 #ifndef IPV6
   vname.sin_family = AF_INET;
   vname.sin_addr.s_addr = (myip[0] ? getmyip() : INADDR_ANY);
@@ -554,7 +536,7 @@
     
 debug2("|NET| open_address_listen(\"%s\", %d)", addr, *port);
 
-  egg_bzero((char *) &name, sizeof name);
+  memset((char *) &name, 0, sizeof name);
 #ifdef IPV6
   name.sin6_family = AF_INET6;
   name.sin6_port = htons(*port);	/* 0 = just assign us a port */
@@ -726,6 +708,9 @@
 void egg_dns_gotanswer(int status, adns_answer *aw, char *origname)
 {
     char name[UHOSTLEN];
+#ifdef IPV6
+    char *orign2 = NULL;
+#endif
 
     if (!aw) {
 debug0("|DNS| egg_dns_gotanswer: ANSWER IS NULL!");
@@ -759,8 +744,7 @@
 		    egg_strncasecmp(origname, "ipv6%", 5) &&
 		    egg_strncasecmp(origname, "ipv4%", 5)) {
 	    adns_query q6;
-	    char *orign2 = (char*) nmalloc(strlen(origname) + 1);
-	    strcpy(orign2, origname);
+	    malloc_strcpy(orign2, origname);
 	    /* ...it may be AAAA */
 debug1("|DNS| egg_dns_gotanswer: A failed, checking for AAAA (%s)", origname);
 	    adns_submit(ads, origname, adns_r_addr6, 0, orign2, &q6);
@@ -790,7 +774,7 @@
 	call_hostbyip(origname, name, status);
     } else
 	debug0("|DNS| egg_dns_gotanswer: got unknow type of answer ?!");
-    nfree(origname);
+    free(origname);
 }
 
 void egg_dns_checkall()
@@ -982,13 +966,14 @@
 	  if (strlen(socklist[i].inbuf) > 510)
 	    socklist[i].inbuf[510] = 0;
 	  strcpy(s, socklist[i].inbuf);
-	  px = (char *) nmalloc(strlen(p + 1) + 1);
+	  /* Uhm... very strange way to code this... */
+	  px = (char *) malloc(strlen(p + 1) + 1);
 	  strcpy(px, p + 1);
-	  nfree(socklist[i].inbuf);
+	  free(socklist[i].inbuf);
 	  if (px[0])
 	    socklist[i].inbuf = px;
 	  else {
-	    nfree(px);
+	    free(px);
 	    socklist[i].inbuf = NULL;
 	  }
 	  /* Strip CR if this was CR/LF combo */
@@ -1001,17 +986,16 @@
 	/* Handling buffered binary data (must have been SOCK_BUFFER before). */
 	if (socklist[i].inbuflen <= 510) {
 	  *len = socklist[i].inbuflen;
-	  egg_memcpy(s, socklist[i].inbuf, socklist[i].inbuflen);
-	  nfree(socklist[i].inbuf);
-          socklist[i].inbuf = NULL;
+	  memcpy(s, socklist[i].inbuf, socklist[i].inbuflen);
+	  free_null(socklist[i].inbuf);
 	  socklist[i].inbuflen = 0;
 	} else {
 	  /* Split up into chunks of 510 bytes. */
 	  *len = 510;
-	  egg_memcpy(s, socklist[i].inbuf, *len);
-	  egg_memcpy(socklist[i].inbuf, socklist[i].inbuf + *len, *len);
+	  memcpy(s, socklist[i].inbuf, *len);
+	  memcpy(socklist[i].inbuf, socklist[i].inbuf + *len, *len);
 	  socklist[i].inbuflen -= *len;
-	  socklist[i].inbuf = nrealloc(socklist[i].inbuf,
+	  socklist[i].inbuf = realloc(socklist[i].inbuf,
 				       socklist[i].inbuflen);
 	}
 	return socklist[i].sock;
@@ -1038,9 +1022,9 @@
       socklist[ret].flags &= ~SOCK_STRONGCONN;
       /* Buffer any data that came in, for future read. */
       socklist[ret].inbuflen = *len;
-      socklist[ret].inbuf = (char *) nmalloc(*len + 1);
+      socklist[ret].inbuf = (char *) malloc(*len + 1);
       /* It might be binary data. You never know. */
-      egg_memcpy(socklist[ret].inbuf, xx, *len);
+      memcpy(socklist[ret].inbuf, xx, *len);
       socklist[ret].inbuf[*len] = 0;
     }
     socklist[ret].flags &= ~SOCK_CONNECT;
@@ -1048,16 +1032,16 @@
     return socklist[ret].sock;
   }
   if (socklist[ret].flags & SOCK_BINARY) {
-    egg_memcpy(s, xx, *len);
+    memcpy(s, xx, *len);
     return socklist[ret].sock;
   }
   if ((socklist[ret].flags & SOCK_LISTEN) ||
       (socklist[ret].flags & SOCK_PASS))
     return socklist[ret].sock;
   if (socklist[ret].flags & SOCK_BUFFER) {
-    socklist[ret].inbuf = (char *) nrealloc(socklist[ret].inbuf,
+    socklist[ret].inbuf = (char *) realloc(socklist[ret].inbuf,
 		    			    socklist[ret].inbuflen + *len + 1);
-    egg_memcpy(socklist[ret].inbuf + socklist[ret].inbuflen, xx, *len);
+    memcpy(socklist[ret].inbuf + socklist[ret].inbuflen, xx, *len);
     socklist[ret].inbuflen += *len;
     /* We don't know whether it's binary data. Make sure normal strings
        will be handled properly later on too. */
@@ -1067,23 +1051,22 @@
   /* Might be necessary to prepend stored-up data! */
   if (socklist[ret].inbuf != NULL) {
     p = socklist[ret].inbuf;
-    socklist[ret].inbuf = (char *) nmalloc(strlen(p) + strlen(xx) + 1);
+    socklist[ret].inbuf = (char *) malloc(strlen(p) + strlen(xx) + 1);
     strcpy(socklist[ret].inbuf, p);
     strcat(socklist[ret].inbuf, xx);
-    nfree(p);
+    free(p);
     if (strlen(socklist[ret].inbuf) < 512) {
       strcpy(xx, socklist[ret].inbuf);
-      nfree(socklist[ret].inbuf);
-      socklist[ret].inbuf = NULL;
+      free_null(socklist[ret].inbuf);
       socklist[ret].inbuflen = 0;
     } else {
       p = socklist[ret].inbuf;
       socklist[ret].inbuflen = strlen(p) - 510;
-      socklist[ret].inbuf = (char *) nmalloc(socklist[ret].inbuflen + 1);
+      socklist[ret].inbuf = (char *) malloc(socklist[ret].inbuflen + 1);
       strcpy(socklist[ret].inbuf, p + 510);
       *(p + 510) = 0;
       strcpy(xx, p);
-      nfree(p);
+      free(p);
       /* (leave the rest to be post-pended later) */
     }
   }
@@ -1122,13 +1105,13 @@
   if (socklist[ret].inbuf != NULL) {
     p = socklist[ret].inbuf;
     socklist[ret].inbuflen = strlen(p) + strlen(xx);
-    socklist[ret].inbuf = (char *) nmalloc(socklist[ret].inbuflen + 1);
+    socklist[ret].inbuf = (char *) malloc(socklist[ret].inbuflen + 1);
     strcpy(socklist[ret].inbuf, xx);
     strcat(socklist[ret].inbuf, p);
-    nfree(p);
+    free(p);
   } else {
     socklist[ret].inbuflen = strlen(xx);
-    socklist[ret].inbuf = (char *) nmalloc(socklist[ret].inbuflen + 1);
+    socklist[ret].inbuf = (char *) malloc(socklist[ret].inbuflen + 1);
     strcpy(socklist[ret].inbuf, xx);
   }
   if (data) {
@@ -1189,8 +1172,8 @@
       
       if (socklist[i].outbuf != NULL) {
 	/* Already queueing: just add it */
-	p = (char *) nrealloc(socklist[i].outbuf, socklist[i].outbuflen + len);
-	egg_memcpy(p + socklist[i].outbuflen, s, len);
+	p = (char *) realloc(socklist[i].outbuf, socklist[i].outbuflen + len);
+	memcpy(p + socklist[i].outbuflen, s, len);
 	socklist[i].outbuf = p;
 	socklist[i].outbuflen += len;
 	return;
@@ -1201,8 +1184,8 @@
 	x = 0;
       if (x < len) {
 	/* Socket is full, queue it */
-	socklist[i].outbuf = (char *) nmalloc(len - x);
-	egg_memcpy(socklist[i].outbuf, &s[x], len - x);
+	socklist[i].outbuf = (char *) malloc(len - x);
+	memcpy(socklist[i].outbuf, &s[x], len - x);
 	socklist[i].outbuflen = len - x;
       }
       return;
@@ -1247,17 +1230,16 @@
 	socklist[i].flags |= SOCK_EOFD;
       } else if (x == socklist[i].outbuflen) {
 	/* If the whole buffer was sent, nuke it */
-	nfree(socklist[i].outbuf);
-	socklist[i].outbuf = NULL;
+	free_null(socklist[i].outbuf);
 	socklist[i].outbuflen = 0;
       } else if (x > 0) {
 	char *p = socklist[i].outbuf;
 
 	/* This removes any sent bytes from the beginning of the buffer */
-	socklist[i].outbuf = (char *) nmalloc(socklist[i].outbuflen - x);
-	egg_memcpy(socklist[i].outbuf, p + x, socklist[i].outbuflen - x);
+	socklist[i].outbuf = (char *) malloc(socklist[i].outbuflen - x);
+	memcpy(socklist[i].outbuf, p + x, socklist[i].outbuflen - x);
 	socklist[i].outbuflen -= x;
-	nfree(p);
+	free(p);
       }
      
       /* All queued data was sent. Call handler if one exists and the
@@ -1361,7 +1343,7 @@
           inbuf = socklist[i].inbuf;
           socklist[i].inbuf = NULL;
           dcc[idx].type->activity(idx, inbuf, len);
-          nfree(inbuf);
+          free(inbuf);
           return len;
         } else
           return -2;
Index: eggdrop1.7/src/proto.h
diff -u eggdrop1.7/src/proto.h:1.51 eggdrop1.7/src/proto.h:1.52
--- eggdrop1.7/src/proto.h:1.51	Sat Aug 18 21:49:40 2001
+++ eggdrop1.7/src/proto.h	Wed Oct 10 05:44:04 2001
@@ -7,7 +7,7 @@
  * because they use structures in those
  * (saves including those .h files EVERY time) - Beldin
  *
- * $Id: proto.h,v 1.51 2001/08/19 02:49:40 drummer Exp $
+ * $Id: proto.h,v 1.52 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -139,10 +139,8 @@
 void tell_dcc(int);
 void not_away(int);
 void set_away(int, char *);
-void *_get_data_ptr(int, char *, int);
 void dcc_remove_lost(void);
 
-#define get_data_ptr(x) _get_data_ptr(x,__FILE__,__LINE__)
 void flush_lines(int, struct chat_info *);
 struct dcc_t *find_idx(int);
 int new_dcc(struct dcc_table *, int);
@@ -165,7 +163,6 @@
 
 /* main.c */
 void fatal(const char *, int);
-int expected_memory(void);
 void patch(const char *);
 void eggContext(const char *, int, const char *);
 void eggContextNote(const char *, int, const char *, const char *);
@@ -173,16 +170,8 @@
 void backup_userfile(void);
 
 /* match.c */
-int _wild_match(register unsigned char *, register unsigned char *);
-#define wild_match(a,b) _wild_match((unsigned char *)(a),(unsigned char *)(b))
-
-/* mem.c */
-void *n_malloc(int, const char *, int);
-void *n_realloc(void *, int, const char *, int);
-void n_free(void *, const char *, int);
-void tell_mem_status(char *);
-void tell_mem_status_dcc(int);
-void debug_mem_to_dcc(int);
+int wild_match(register unsigned char *, register unsigned char *);
+int wild_match_per(register unsigned char *, register unsigned char *);
 
 /* misc.c */
 int egg_strcatn(char *dst, const char *src, size_t max);
@@ -262,7 +251,6 @@
 
 /* userent.c */
 void list_type_kill(struct list_type *);
-int list_type_expmem(struct list_type *);
 int xtra_set();
 
 /* userrec.c */
Index: eggdrop1.7/src/tcl.c
diff -u eggdrop1.7/src/tcl.c:1.42 eggdrop1.7/src/tcl.c:1.43
--- eggdrop1.7/src/tcl.c:1.42	Thu Sep 20 14:50:19 2001
+++ eggdrop1.7/src/tcl.c	Wed Oct 10 05:44:04 2001
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.42 2001/09/20 19:50:19 stdarg Exp $
+ * $Id: tcl.c,v 1.43 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -82,24 +82,10 @@
 int	    par_telnet_flood = 1;       /* trigger telnet flood for +f
 					   ppl? - dw			      */
 int	    quiet_save = 0;             /* quiet-save patch by Lucas	      */
-int	    strtot = 0;
-
 
 /* Prototypes for tcl */
 Tcl_Interp *Tcl_CreateInterp();
 
-int expmem_tcl()
-{
-  int i, tot = 0;
-
-  for (i = 0; i < max_logs; i++)
-    if (logs[i].filename != NULL) {
-      tot += strlen(logs[i].filename) + 1;
-      tot += strlen(logs[i].chname) + 1;
-    }
-  return tot + strtot;
-}
-
 
 /*
  *      Logging
@@ -130,21 +116,17 @@
     if ((logs[i].filename != NULL) && (!strcmp(logs[i].filename, argv[3]))) {
       logs[i].flags &= ~LF_EXPIRING;
       logs[i].mask = logmodes(argv[1]);
-      nfree(logs[i].chname);
-      logs[i].chname = NULL;
+      free_null(logs[i].chname);
       if (!logs[i].mask) {
 	/* ending logfile */
-	nfree(logs[i].filename);
-	logs[i].filename = NULL;
+	free_null(logs[i].filename);
 	if (logs[i].f != NULL) {
 	  fclose(logs[i].f);
 	  logs[i].f = NULL;
 	}
         logs[i].flags = 0;
-      } else {
-	logs[i].chname = (char *) nmalloc(strlen(argv[2]) + 1);
-	strcpy(logs[i].chname, argv[2]);
-      }
+      } else
+	malloc_strcpy(logs[i].chname, argv[2]);
       Tcl_AppendResult(interp, argv[3], NULL);
       return TCL_OK;
     }
@@ -158,10 +140,8 @@
     if (logs[i].filename == NULL) {
       logs[i].flags = 0;
       logs[i].mask = logmodes(argv[1]);
-      logs[i].filename = (char *) nmalloc(strlen(argv[3]) + 1);
-      strcpy(logs[i].filename, argv[3]);
-      logs[i].chname = (char *) nmalloc(strlen(argv[2]) + 1);
-      strcpy(logs[i].chname, argv[2]);
+      malloc_strcpy(logs[i].filename, argv[3]);
+      malloc_strcpy(logs[i].chname, argv[2]);
       Tcl_AppendResult(interp, argv[3], NULL);
       return TCL_OK;
     }
@@ -523,7 +503,7 @@
   /* Initialize the interpreter */
   interp = Tcl_CreateInterp();
 
-#ifdef DEBUG_MEM
+#ifdef DEBUG_TCL
   /* Initialize Tcl's memory debugging if we want it */
   Tcl_InitMemory(interp);
 #endif
@@ -673,8 +653,7 @@
   int tmp;
 
   for (i = 0; list[i].name; i++) {
-    st = (strinfo *) nmalloc(sizeof(strinfo));
-    strtot += sizeof(strinfo);
+    st = (strinfo *) malloc(sizeof(strinfo));
     st->max = list[i].length - (list[i].flags & STR_DIR);
     if (list[i].flags & STR_PROTECT)
       st->max = -st->max;
@@ -703,10 +682,8 @@
     Tcl_UntraceVar(interp, list[i].name,
 		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
 		   tcl_eggstr, st);
-    if (st != NULL) {
-      strtot -= sizeof(strinfo);
-      nfree(st);
-    }
+    if (st != NULL)
+      free(st);
   }
 }
 
@@ -716,8 +693,7 @@
   intinfo *ii;
 
   for (i = 0; list[i].name; i++) {
-    ii = nmalloc(sizeof(intinfo));
-    strtot += sizeof(intinfo);
+    ii = malloc(sizeof(intinfo));
     ii->var = list[i].val;
     ii->ro = list[i].readonly;
     tmp = protect_readonly;
@@ -746,10 +722,8 @@
     Tcl_UntraceVar(interp, list[i].name,
 		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
 		   tcl_eggint, (ClientData) ii);
-    if (ii) {
-      strtot -= sizeof(intinfo);
-      nfree(ii);
-    }
+    if (ii)
+      free(ii);
   }
 }
 
@@ -761,8 +735,7 @@
   int i;
 
   for (i = 0; list[i].name; i++) {
-    cp = (coupletinfo *) nmalloc(sizeof(coupletinfo));
-    strtot += sizeof(coupletinfo);
+    cp = (coupletinfo *) malloc(sizeof(coupletinfo));
     cp->left = list[i].lptr;
     cp->right = list[i].rptr;
     tcl_eggcouplet((ClientData) cp, interp, list[i].name, NULL,
@@ -786,10 +759,9 @@
 					  TCL_TRACE_WRITES |
 					  TCL_TRACE_UNSETS,
 					  tcl_eggcouplet, NULL);
-    strtot -= sizeof(coupletinfo);
     Tcl_UntraceVar(interp, list[i].name,
 		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
 		   tcl_eggcouplet, (ClientData) cp);
-    nfree(cp);
+    free(cp);
   }
 }
Index: eggdrop1.7/src/tcldcc.c
diff -u eggdrop1.7/src/tcldcc.c:1.32 eggdrop1.7/src/tcldcc.c:1.33
--- eggdrop1.7/src/tcldcc.c:1.32	Thu Oct  4 16:37:44 2001
+++ eggdrop1.7/src/tcldcc.c	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * tcldcc.c -- handles:
  *   Tcl stubs for the dcc commands
  *
- * $Id: tcldcc.c,v 1.32 2001/10/04 21:37:44 stdarg Exp $
+ * $Id: tcldcc.c,v 1.33 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -43,17 +43,6 @@
 static struct portmap	*root = NULL;
 
 
-int expmem_tcldcc(void)
-{
-  int tot = 0;
-  struct portmap *pmap;
-
-  for (pmap = root; pmap; pmap = pmap->next)
-    tot += sizeof(struct portmap);
-
-  return tot;
-}
-
 /***********************************************************************/
 
 static int tcl_putdcc STDVAR
@@ -441,7 +430,7 @@
     check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
   }
   hold = dcc[idx].u.other;
-  dcc[idx].u.script = get_data_ptr(sizeof(struct script_info));
+  malloc_memset(dcc[idx].u.script, 0, sizeof(struct script_info));
   dcc[idx].u.script->u.other = hold;
   dcc[idx].u.script->type = dcc[idx].type;
   dcc[idx].type = &DCC_SCRIPT;
@@ -876,7 +865,7 @@
 	pold->next = pmap->next;
       else
 	root = pmap->next;
-      nfree(pmap);
+      free(pmap);
     }
     /* Remove */
     if (idx < 0) {
@@ -961,7 +950,7 @@
   egg_snprintf(s, sizeof s, "%d", port);
   Tcl_AppendResult(irp, s, NULL);
   if (!pmap) {
-    pmap = nmalloc(sizeof(struct portmap));
+    pmap = malloc(sizeof(struct portmap));
     pmap->next = root;
     root = pmap;
   }
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.39 eggdrop1.7/src/tclhash.c:1.40
--- eggdrop1.7/src/tclhash.c:1.39	Sat Oct  6 23:02:54 2001
+++ eggdrop1.7/src/tclhash.c	Wed Oct 10 05:44:04 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.39 2001/10/07 04:02:54 stdarg Exp $
+ * $Id: tclhash.c,v 1.40 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,7 +31,6 @@
 #include "main.h"
 #include "chan.h"
 #include "users.h"
-#include "match.c"
 
 extern Tcl_Interp	*interp;
 extern struct dcc_t	*dcc;
@@ -64,38 +63,12 @@
 static int builtin_chat();
 static int builtin_dcc();
 
-static char *my_strdup(const char *s)
-{
-	char *t;
-
-	t = (char *)nmalloc(strlen(s)+1);
-	strcpy(t, s);
-	return(t);
-}
-
-/* Allocate and initialise a chunk of memory.
- */
-static inline void *n_malloc_null(int size, const char *file, int line)
-{
-#ifdef DEBUG_MEM
-# define	nmalloc_null(size)	n_malloc_null(size, __FILE__, __LINE__)
-  void	*ptr = n_malloc(size, file, line);
-#else
-# define	nmalloc_null(size)	n_malloc_null(size, NULL, 0)
-  void	*ptr = nmalloc(size);
-#endif
-
-  egg_memset(ptr, 0, size);
-  return ptr;
-}
-
-
 /* Delete trigger/command.
  */
 static inline void tcl_cmd_delete(tcl_cmd_t *tc)
 {
-  nfree(tc->func_name);
-  nfree(tc);
+  free(tc->func_name);
+  free(tc);
 }
 
 /* Delete bind and its elements.
@@ -108,8 +81,8 @@
     tc_next = tc->next;
     tcl_cmd_delete(tc);
   }
-  nfree(tm->mask);
-  nfree(tm);
+  free(tm->mask);
+  free(tm);
 }
 
 /* Delete bind list and its elements.
@@ -122,7 +95,7 @@
     tm_next = tm->next;
     tcl_bind_mask_delete(tm);
   }
-  nfree(tl);
+  free(tl);
 }
 
 inline void garbage_collect_tclhash(void)
@@ -175,50 +148,6 @@
   }
 }
 
-static inline int tcl_cmd_expmem(tcl_cmd_t *tc)
-{
-  int			tot;
-
-  tot = sizeof(*tc);
-  if (tc->func_name)
-    tot += strlen(tc->func_name) + 1;
-  return tot;
-}
-
-static inline int tcl_bind_mask_expmem(tcl_bind_mask_t *tm)
-{
-  int			 tot = 0;
-  tcl_cmd_t		*tc;
-
-  for (tc = tm->first; tc; tc = tc->next)
-    tot += tcl_cmd_expmem(tc);
-  if (tm->mask)
-    tot += strlen(tm->mask) + 1;
-  tot += sizeof(*tm);
-  return tot;
-}
-
-static inline int tcl_bind_list_expmem(tcl_bind_list_t *tl)
-{
-  int			 tot = 0;
-  tcl_bind_mask_t	*tm;
-
-  for (tm = tl->first; tm; tm = tm->next)
-    tot += tcl_bind_mask_expmem(tm);
-  tot += sizeof(*tl);
-  return tot;
-}
-
-int expmem_tclhash(void)
-{
-  int			 tot = 0;
-  tcl_bind_list_t	*tl;
-
-  for (tl = bind_table_list; tl; tl = tl->next)
-    tot += tcl_bind_list_expmem(tl);
-  return tot;
-}
-
 
 extern cmd_t C_dcc[];
 static int tcl_bind();
@@ -298,11 +227,11 @@
 		if (!strcmp(table->name, name)) return(table);
 	}
 	/* Nope, we have to create a new one. */
-	table = (bind_table_t *)nmalloc(sizeof(*table));
+	table = (bind_table_t *)malloc(sizeof(*table));
 	table->chains = NULL;
-	table->name = my_strdup(name);
+	malloc_strcpy(table->name, name);
 	table->nargs = nargs;
-	table->syntax = my_strdup(syntax);
+	malloc_strcpy(table->syntax, syntax);
 	table->match_type = match_type;
 	table->flags = flags;
 	table->next = bind_table_list_head;
@@ -329,7 +258,7 @@
       break;		/* New. Insert at start of list.	*/
   }
 
-  tl = nmalloc_null(sizeof(tcl_bind_list_t));
+  malloc_memset(tl, 0, sizeof(tcl_bind_list_t));
   strcpy(tl->name, nme);
   tl->flags = flg;
   tl->func = func;
@@ -363,15 +292,15 @@
 	}
 
 	/* Now delete it. */
-	nfree(table->name);
+	free(table->name);
 	for (chain = table->chains; chain; chain = next_chain) {
 		next_chain = chain->next;
 		for (entry = chain->entries; entry; entry = next_entry) {
 			next_entry = entry->next;
-			nfree(entry->function_name);
-			nfree(entry);
+			free(entry->function_name);
+			free(entry);
 		}
-		nfree(chain);
+		free(chain);
 	}
 }
 
@@ -438,8 +367,8 @@
 	/* Delete it. */
 	if (prev) prev->next = entry->next;
 	else if (entry->next) chain->entries = entry->next;
-	nfree(entry->function_name);
-	nfree(entry);
+	free(entry->function_name);
+	free(entry);
 
 	return(0);
 }
@@ -505,9 +434,9 @@
 
 	/* Create if it doesn't exist. */
 	if (!chain) {
-		chain = (bind_chain_t *)nmalloc(sizeof(*chain));
+		chain = (bind_chain_t *)malloc(sizeof(*chain));
 		chain->entries = NULL;
-		chain->mask = my_strdup(mask);
+		malloc_strcpy(chain->mask, mask);
 		chain->next = table->chains;
 		table->chains = chain;
 	}
@@ -525,15 +454,15 @@
 	}
 
 	/* If we have an old entry, re-use it. */
-	if (entry) nfree(entry->function_name);
+	if (entry) free(entry->function_name);
 	else {
 		/* Otherwise, create a new entry. */
-		entry = (bind_entry_t *)nmalloc(sizeof(*entry));
+		entry = (bind_entry_t *)malloc(sizeof(*entry));
 		entry->next = chain->entries;
 		chain->entries = entry;
 	}
 
-	entry->function_name = my_strdup(function_name);
+	malloc_strcpy(entry->function_name, function_name);
 	entry->callback = callback;
 	entry->client_data = client_data;
 	entry->hits = 0;
@@ -563,9 +492,8 @@
 
   /* Create bind if it doesn't exist yet. */
   if (!tm) {
-    tm = nmalloc_null(sizeof(tcl_bind_mask_t));
-    tm->mask = nmalloc(strlen(cmd) + 1);
-    strcpy(tm->mask, cmd);
+    malloc_memset(tm, 0, sizeof(tcl_bind_mask_t));
+    malloc_strcpy(tm->mask, cmd);
 
 #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION >= 9)
     str_nutf8tounicode(tm->mask, strlen(tm->mask) + 1);
@@ -600,11 +528,10 @@
     }
   }
 
-  tc = nmalloc_null(sizeof(tcl_cmd_t));
+  malloc_memset(tc, 0, sizeof(tcl_cmd_t));
   tc->flags.match = FR_GLOBAL | FR_CHAN;
   break_down_flags(flags, &(tc->flags), NULL);
-  tc->func_name = nmalloc(strlen(proc) + 1);
-  strcpy(tc->func_name, proc);
+  malloc_strcpy(tc->func_name, proc);
 
   /* Link into linked list of the bind's command list. */
   tc->next = tm->first;
@@ -690,10 +617,10 @@
 		return(TCL_ERROR);
 	}
 
-	cdata = (tcl_cmd_cdata *)nmalloc(sizeof(*cdata));
+	cdata = (tcl_cmd_cdata *)malloc(sizeof(*cdata));
 	cdata->irp = irp;
-	cdata->syntax = my_strdup(table->syntax);
-	cdata->cmd = my_strdup(argv[4]);
+	malloc_strcpy(cdata->syntax, table->syntax);
+	malloc_strcpy(cdata->cmd, argv[4]);
 	add_bind_entry(table, argv[2], argv[3], argv[4], BIND_WANTS_CD, (Function) my_tcl_bind_callback, cdata);
 	Tcl_AppendResult(irp, "moooo", NULL);
 	return(TCL_OK);
@@ -712,9 +639,9 @@
 	}
 	cdata = get_bind_cdata(table, argv[2], argv[3], argv[4]);
 	if (cdata) {
-		nfree(cdata->cmd);
-		nfree(cdata->syntax);
-		nfree(cdata);
+		free(cdata->cmd);
+		free(cdata->syntax);
+		free(cdata);
 		del_bind_entry(table, argv[2], argv[3], argv[4]);
 	}
 	Tcl_AppendResult(irp, "mooooo", NULL);
@@ -942,11 +869,11 @@
     char *buf;
 
     Context;
-    buf = nmalloc(strlen(msg) + (proc ? strlen(proc) : 6)
+    buf = malloc(strlen(msg) + (proc ? strlen(proc) : 6)
 		  + (param ? strlen(param) : 6) + 1);
     sprintf(buf, msg, proc ? proc : "<null>", param ? param : "<null>");
     ContextNote(buf);
-    nfree(buf);
+    free(buf);
   }
   x = Tcl_VarEval(interp, proc, param, NULL);
   Context;
@@ -1511,11 +1438,11 @@
   for (i = 0; cc[i].name; i++) {
     egg_snprintf(p, sizeof p, "*%s:%s", tl->name,
 		   cc[i].funcname ? cc[i].funcname : cc[i].name);
-    l = (char *) nmalloc(Tcl_ScanElement(p, &k));
+    l = (char *) malloc(Tcl_ScanElement(p, &k));
     Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
     Tcl_CreateCommand(interp, p, tl->func, (ClientData) cc[i].func, NULL);
     bind_bind_entry(tl, cc[i].flags, cc[i].name, l);
-    nfree(l);
+    free(l);
   }
 }
 
@@ -1538,10 +1465,10 @@
   for (i = 0; cc[i].name; i++) {
     egg_snprintf(p, sizeof p, "*%s:%s", table->name,
 		   cc[i].funcname ? cc[i].funcname : cc[i].name);
-    l = (char *) nmalloc(Tcl_ScanElement(p, &k));
+    l = (char *) malloc(Tcl_ScanElement(p, &k));
     Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
     Tcl_DeleteCommand(interp, p);
     unbind_bind_entry(table, cc[i].flags, cc[i].name, l);
-    nfree(l);
+    free(l);
   }
 }
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.17 eggdrop1.7/src/tclhash.h:1.18
--- eggdrop1.7/src/tclhash.h:1.17	Tue Oct  9 07:42:13 2001
+++ eggdrop1.7/src/tclhash.h	Wed Oct 10 05:44:04 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.17 2001/10/09 12:42:13 tothwolf Exp $
+ * $Id: tclhash.h,v 1.18 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -134,7 +134,6 @@
 void init_bind2(void);
 void kill_bind(void);
 void kill_bind2(void);
-int expmem_tclhash(void);
 
 tcl_bind_list_t *add_bind_table(const char *nme, int flg, Function func);
 void del_bind_table(tcl_bind_list_t *tl_which);
Index: eggdrop1.7/src/tcluser.c
diff -u eggdrop1.7/src/tcluser.c:1.24 eggdrop1.7/src/tcluser.c:1.25
--- eggdrop1.7/src/tcluser.c:1.24	Mon Aug 13 14:22:30 2001
+++ eggdrop1.7/src/tcluser.c	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * tcluser.c -- handles:
  *   Tcl stubs for the user-record-oriented commands
  *
- * $Id: tcluser.c,v 1.24 2001/08/13 19:22:30 guppy Exp $
+ * $Id: tcluser.c,v 1.25 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -278,7 +278,7 @@
      Tcl_AppendResult(irp, "0", NULL);
   else {
     userlist = adduser(userlist, argv[1], "none", "-", USER_BOT);
-    bi = user_malloc(sizeof(struct bot_addr));
+    bi = malloc(sizeof(struct bot_addr));
     addr = argv[2];
     if (*addr == '[') {
 	addr++;
@@ -296,12 +296,11 @@
 	  addrlen = strlen(addr);
     }
     if (!q) {
-      bi->address = user_malloc(addrlen + 1);
-      strcpy(bi->address, addr);
+      malloc_strcpy(bi->address, addr);
       bi->telnet_port = 3333;
       bi->relay_port = 3333;
     } else {
-      bi->address = user_malloc(q - argv[2] + 1);
+      bi->address = malloc(q - argv[2] + 1);
       strncpyz(bi->address, addr, addrlen + 1);
       p = q + 1;
       bi->telnet_port = atoi(p);
@@ -536,7 +535,7 @@
       return TCL_OK;		/* Silently ignore user * */
   }
   if (!(e = find_user_entry(et, u))) {
-    e = user_malloc(sizeof(struct user_entry));
+    e = malloc(sizeof(struct user_entry));
     e->type = et;
     e->name = NULL;
     e->u.list = NULL;
@@ -547,7 +546,7 @@
   if (!e->u.list) {
     if (list_delete((struct list_type **) &(u->entries),
 		    (struct list_type *) e))
-      nfree(e);
+      free(e);
     /* else maybe already freed... (entry_type==HOSTS) <drummer> */
   }
   return r;
Index: eggdrop1.7/src/userent.c
diff -u eggdrop1.7/src/userent.c:1.21 eggdrop1.7/src/userent.c:1.22
--- eggdrop1.7/src/userent.c:1.21	Thu Jul 26 12:04:33 2001
+++ eggdrop1.7/src/userent.c	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * userent.c -- handles:
  *   user-entry handling, new stylem more versatile.
  *
- * $Id: userent.c,v 1.21 2001/07/26 17:04:33 drummer Exp $
+ * $Id: userent.c,v 1.22 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -57,22 +57,12 @@
   while (t) {
     u = t->next;
     if (t->extra)
-      nfree(t->extra);
-    nfree(t);
+      free(t->extra);
+    free(t);
     t = u;
   }
 }
 
-int list_type_expmem(struct list_type *t)
-{
-  int tot = 0;
-
-  for (; t; t = t->next)
-    tot += sizeof(struct list_type) + strlen(t->extra) + 1;
-
-  return tot;
-}
-
 int def_unpack(struct userrec *u, struct user_entry *e)
 {
   char *tmp;
@@ -89,7 +79,7 @@
   char *tmp;
 
   tmp = e->u.string;
-  e->u.list = user_malloc(sizeof(struct list_type));
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
   e->u.list->extra = tmp;
   return 1;
@@ -97,8 +87,8 @@
 
 int def_kill(struct user_entry *e)
 {
-  nfree(e->u.string);
-  nfree(e);
+  free(e->u.string);
+  free(e);
   return 1;
 }
 
@@ -129,8 +119,7 @@
     if (l > 160)
       l = 160;
 
-
-    e->u.string = user_realloc (e->u.string, l + 1);
+    e->u.string = realloc(e->u.string, l + 1);
 
     strncpyz (e->u.string, string, l + 1);
 
@@ -141,8 +130,7 @@
      if ((unsigned int) *i < 32 && !strchr ("\002\003\026\037", *i))
         *i = '?';
   } else { /* string == NULL && e->u.string != NULL */
-    nfree(e->u.string);
-    e->u.string = NULL;
+    free_null(e->u.string);
   }
   if (!noshare && !(u->flags & (USER_BOT | USER_UNSHARED))) {
     if (e->type != &USERENTRY_INFO || share_greet)
@@ -175,11 +163,6 @@
   return TCL_OK;
 }
 
-int def_expmem(struct user_entry *e)
-{
-  return strlen(e->u.string) + 1;
-}
-
 void def_display(int idx, struct user_entry *e)
 {
   dprintf(idx, "  %s: %s\n", e->type->name, e->u.string);
@@ -210,7 +193,6 @@
   def_set,
   def_tcl_get,
   def_tcl_set,
-  def_expmem,
   comment_display,
   "COMMENT"
 };
@@ -228,7 +210,6 @@
   def_set,
   def_tcl_get,
   def_tcl_set,
-  def_expmem,
   def_display,
   "INFO"
 };
@@ -239,7 +220,7 @@
   register char *pass = buf;
 
   if (e->u.extra)
-    nfree(e->u.extra);
+    free(e->u.extra);
   if (!pass || !pass[0] || (pass[0] == '-'))
     e->u.extra = NULL;
   else {
@@ -256,8 +237,7 @@
       strcpy(new, pass);
     else
       encrypt_pass(pass, new);
-    e->u.extra = user_malloc(strlen(new) + 1);
-    strcpy(e->u.extra, new);
+    malloc_strcpy(e->u.extra, new);
   }
   if (!noshare && !(u->flags & (USER_BOT | USER_UNSHARED)))
     shareout(NULL, "c PASS %s %s\n", u->handle, pass ? pass : "");
@@ -285,7 +265,6 @@
   pass_set,
   def_tcl_get,
   pass_tcl_set,
-  def_expmem,
   0,
   "PASS"
 };
@@ -299,8 +278,8 @@
   arg = newsplit (&par);
   if (!par[0])
     par = "???";
-  li = user_malloc(sizeof(struct laston_info));
-  li->lastonplace = user_malloc(strlen(par) + 1);
+  li = malloc(sizeof(struct laston_info));
+  li->lastonplace = malloc(strlen(par) + 1);
   li->laston = atoi(arg);
   strcpy(li->lastonplace, par);
   list_type_kill(e->u.list);
@@ -312,16 +291,14 @@
 {
   char work[1024];
   struct laston_info *li;
-  int l;
 
   li = (struct laston_info *) e->u.extra;
-  l = sprintf(work, "%lu %s", li->laston, li->lastonplace);
-  e->u.list = user_malloc(sizeof(struct list_type));
+  sprintf(work, "%lu %s", li->laston, li->lastonplace);
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc(l + 1);
-  strcpy(e->u.list->extra, work);
-  nfree(li->lastonplace);
-  nfree(li);
+  malloc_strcpy(e->u.list->extra, work);
+  free(li->lastonplace);
+  free(li);
   return 1;
 }
 
@@ -340,9 +317,9 @@
 static int laston_kill(struct user_entry *e)
 {
   if (((struct laston_info *) (e->u.extra))->lastonplace)
-    nfree(((struct laston_info *) (e->u.extra))->lastonplace);
-  nfree(e->u.extra);
-  nfree(e);
+    free(((struct laston_info *) (e->u.extra))->lastonplace);
+  free(e->u.extra);
+  free(e);
   return 1;
 }
 
@@ -352,8 +329,8 @@
 
   if (li != buf) {
     if (li) {
-      nfree(li->lastonplace);
-      nfree(li);
+      free(li->lastonplace);
+      free(li);
     }
 
     li = e->u.extra = buf;
@@ -402,37 +379,28 @@
       }
   }
   /* Save globally */
-  li = user_malloc(sizeof(struct laston_info));
+  li = malloc(sizeof(struct laston_info));
+
+  if (argc == 5)
+    malloc_strcpy(li->lastonplace, argv[4]);
+  else
+    malloc_memset(li->lastonplace, 0, 1);
 
-  if (argc == 5) {
-    li->lastonplace = user_malloc(strlen(argv[4]) + 1);
-    strcpy(li->lastonplace, argv[4]);
-  } else {
-    li->lastonplace = user_malloc(1);
-    li->lastonplace[0] = 0;
-  }
   li->laston = atoi(argv[3]);
   set_user(&USERENTRY_LASTON, u, li);
   return TCL_OK;
 }
 
-static int laston_expmem(struct user_entry *e)
-{
-  return sizeof(struct laston_info) +
-    strlen(((struct laston_info *) (e->u.extra))->lastonplace) + 1;
-}
-
 static int laston_dupuser(struct userrec *new, struct userrec *old,
 			  struct user_entry *e)
 {
   struct laston_info *li = e->u.extra, *li2;
 
   if (li) {
-    li2 = user_malloc(sizeof(struct laston_info));
+    li2 = malloc(sizeof(struct laston_info));
 
     li2->laston = li->laston;
-    li2->lastonplace = user_malloc(strlen(li->lastonplace) + 1);
-    strcpy(li2->lastonplace, li->lastonplace);
+    malloc_strcpy(li2->lastonplace, li->lastonplace);
     return set_user(&USERENTRY_LASTON, new, li2);
   }
   return 0;
@@ -451,31 +419,27 @@
   laston_set,
   laston_tcl_get,
   laston_tcl_set,
-  laston_expmem,
   0,
   "LASTON"
 };
 
 static int botaddr_unpack(struct userrec *u, struct user_entry *e)
 {
-  char *p, *q;
-  struct bot_addr *bi = user_malloc(sizeof(struct bot_addr));
-
-  egg_bzero(bi, sizeof(struct bot_addr));
+  char *p = NULL, *q;
+  struct bot_addr *bi;
 
-  p = nmalloc(strlen(q = (e->u.list->extra)) + 1);
-  strcpy(p, q);
-  if (!(q = strchr_unescape(p, ':', '\\'))) {
-    bi->address = user_malloc(strlen (p) + 1);
-    strcpy (bi->address, p);
-  } else {
-    bi->address = user_malloc(strlen(p) + 1);
-    strcpy(bi->address, p);
+  malloc_memset(bi, 0, sizeof(struct bot_addr));
+  q = (e->u.list->extra);
+  malloc_strcpy(p, q);
+  if (!(q = strchr_unescape(p, ':', '\\')))
+    malloc_strcpy(bi->address, p);
+  else {
+    malloc_strcpy(bi->address, p);
     bi->telnet_port = atoi(q);
     if ((q = strchr(q, '/')))
       bi->relay_port = atoi(q + 1);
   }
-  nfree(p);
+  free(p);
   if (!bi->telnet_port)
     bi->telnet_port = 3333;
   if (!bi->relay_port)
@@ -490,27 +454,25 @@
   char work[1024];
   struct bot_addr *bi;
   char *tmp;
-  int l;
 
   bi = (struct bot_addr *) e->u.extra;
-  l = simple_sprintf(work, "%s:%u/%u",
+  simple_sprintf(work, "%s:%u/%u",
               (tmp = str_escape(bi->address, ':', '\\')),
               bi->telnet_port, bi->relay_port);
-  nfree(tmp);
-  e->u.list = user_malloc(sizeof(struct list_type));
+  free(tmp);
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc(l + 1);
-  strcpy(e->u.list->extra, work);
-  nfree(bi->address);
-  nfree(bi);
+  malloc_strcpy(e->u.list->extra, work);
+  free(bi->address);
+  free(bi);
   return 1;
 }
 
 static int botaddr_kill(struct user_entry *e)
 {
-  nfree(((struct bot_addr *) (e->u.extra))->address);
-  nfree(e->u.extra);
-  nfree(e);
+  free(((struct bot_addr *) (e->u.extra))->address);
+  free(e->u.extra);
+  free(e);
   return 1;
 }
 
@@ -524,7 +486,7 @@
   res = (fprintf(f, "--%s %s:%u/%u\n", e->type->name,
               (tmp = str_escape(bi->address, ':', '\\')),
 	      bi->telnet_port, bi->relay_port) != EOF);
-  nfree(tmp);
+  free(tmp);
   return res;
 }
 
@@ -536,8 +498,8 @@
     return 1;
   if (bi != buf) {
     if (bi) {
-      nfree(bi->address);
-      nfree(bi);
+      free(bi->address);
+      free(bi);
     }
     bi = e->u.extra = buf;
   }
@@ -546,7 +508,7 @@
     shareout(NULL, "c BOTADDR %s %s %d %d\n", u->handle,
              (tmp = str_escape(bi->address, ':', '\\')),
 	     bi->telnet_port, bi->relay_port);
-    nfree(tmp);
+    free(tmp);
   }
   return 1;
 }
@@ -573,13 +535,11 @@
   if (u->flags & USER_BOT) {
     /* Silently ignore for users */
     if (!bi) {
-      bi = user_malloc(sizeof(struct bot_addr));
-      egg_bzero(bi, sizeof (struct bot_addr));
+      malloc_memset(bi, 0, sizeof(struct bot_addr));
     } else {
-      nfree(bi->address);
+      free(bi->address);
     }
-    bi->address = user_malloc(strlen(argv[3]) + 1);
-    strcpy(bi->address, argv[3]);
+    malloc_strcpy(bi->address, argv[3]);
     if (argc > 4)
       bi->telnet_port = atoi(argv[4]);
     if (argc > 5)
@@ -593,13 +553,6 @@
   return TCL_OK;
 }
 
-static int botaddr_expmem(struct user_entry *e)
-{
-  register struct bot_addr *bi = (struct bot_addr *) e->u.extra;
-
-  return strlen(bi->address) + 1 + sizeof(struct bot_addr);
-}
-
 static void botaddr_display(int idx, struct user_entry *e)
 {
   register struct bot_addr *bi = (struct bot_addr *) e->u.extra;
@@ -611,14 +564,13 @@
 static int botaddr_gotshare(struct userrec *u, struct user_entry *e,
 			    char *buf, int idx)
 {
-  struct bot_addr *bi = user_malloc(sizeof(struct bot_addr));
   char *arg;
+  struct bot_addr *bi;
 
-  egg_bzero(bi, sizeof(struct bot_addr));
+  malloc_memset(bi, 0, sizeof(struct bot_addr));
   arg = newsplit(&buf);
   str_unescape(arg, '\\');
-  bi->address = user_malloc(strlen(arg) + 1);
-  strcpy(bi->address, arg);
+  malloc_strcpy(bi->address, arg);
   arg = newsplit(&buf);
   bi->telnet_port = atoi(arg);
   bi->relay_port = atoi(buf);
@@ -639,12 +591,11 @@
     struct bot_addr *bi = e->u.extra, *bi2;
 
     if (bi) {
-      bi2 = user_malloc(sizeof(struct bot_addr));
+      bi2 = malloc(sizeof(struct bot_addr));
 
       bi2->telnet_port = bi->telnet_port;
       bi2->relay_port = bi->relay_port;
-      bi2->address = user_malloc(strlen(bi->address) + 1);
-      strcpy(bi2->address, bi->address);
+      malloc_strcpy(bi2->address, bi->address);
       return set_user(&USERENTRY_BOTADDR, new, bi2);
     }
   }
@@ -664,7 +615,6 @@
   botaddr_set,
   botaddr_tcl_get,
   botaddr_tcl_set,
-  botaddr_expmem,
   botaddr_display,
   "BOTADDR"
 };
@@ -681,10 +631,10 @@
   }
   if (!old && (!new->data || !new->data[0])) {
     /* Delete non-existant entry -- doh ++rtc */
-    nfree(new->key);
+    free(new->key);
     if (new->data)
-      nfree(new->data);
-    nfree(new);
+      free(new->data);
+    free(new);
     return TCL_OK;
   }
 
@@ -697,18 +647,18 @@
   if ((old && old != new) || !new->data || !new->data[0]) {
     list_delete((struct list_type **) (&e->u.extra),
 		(struct list_type *) old);
-    nfree(old->key);
-    nfree(old->data);
-    nfree(old);
+    free(old->key);
+    free(old->data);
+    free(old);
   }
   if (old != new && new->data) {
     if (new->data[0])
       list_insert((&e->u.extra), new) /* do not add a ';' here */
   } else {
     if (new->data)
-      nfree(new->data);
-    nfree(new->key);
-    nfree(new);
+      free(new->data);
+    free(new->key);
+    free(new);
   }
   return TCL_OK;
 }
@@ -720,12 +670,11 @@
   int l;
 
   BADARGS(4, 5, " handle type key ?value?");
-  xk = user_malloc(sizeof(struct xtra_key));
+  malloc_memset(xk, 0, sizeof(struct xtra_key));
   l = strlen(argv[3]);
-  egg_bzero(xk, sizeof (struct xtra_key));
   if (l > 500)
     l = 500;
-  xk->key = user_malloc(l + 1);
+  xk->key = malloc(l + 1);
   strncpyz(xk->key, argv[3], l + 1);
 
   if (argc == 5) {
@@ -733,7 +682,7 @@
 
     if (k > 500 - l)
       k = 500 - l;
-    xk->data = user_malloc(k + 1);
+    xk->data = malloc(k + 1);
     strncpyz(xk->data, argv[4], k + 1);
   }
   xtra_set(u, e, xk);
@@ -749,15 +698,13 @@
   head = curr = e->u.list;
   e->u.extra = NULL;
   while (curr) {
-    t = user_malloc(sizeof(struct xtra_key));
+    t = malloc(sizeof(struct xtra_key));
 
     data = curr->extra;
     key = newsplit(&data);
     if (data[0]) {
-      t->key = user_malloc(strlen(key) + 1);
-      strcpy(t->key, key);
-      t->data = user_malloc(strlen(data) + 1);
-      strcpy(t->data, data);
+      malloc_strcpy(t->key, key);
+      malloc_strcpy(t->data, data);
       list_insert((&e->u.extra), t);
     }
     curr = curr->next;
@@ -774,14 +721,14 @@
   curr = e->u.extra;
   e->u.list = NULL;
   while (curr) {
-    t = user_malloc(sizeof(struct list_type));
-    t->extra = user_malloc(strlen(curr->key) + strlen(curr->data) + 4);
+    t = malloc(sizeof(struct list_type));
+    t->extra = malloc(strlen(curr->key) + strlen(curr->data) + 4);
     sprintf(t->extra, "%s %s", curr->key, curr->data);
     list_insert((&e->u.list), t);
     next = curr->next;
-    nfree(curr->key);
-    nfree(curr->data);
-    nfree(curr);
+    free(curr->key);
+    free(curr->data);
+    free(curr);
     curr = next;
   }
   return 1;
@@ -818,12 +765,11 @@
   if (!arg[0])
     return 1;
 
-  xk = user_malloc (sizeof(struct xtra_key));
-  egg_bzero(xk, sizeof(struct xtra_key));
+  malloc_memset(xk, 0, sizeof(struct xtra_key));
   l = strlen(arg);
   if (l > 500)
     l = 500;
-  xk->key = user_malloc(l + 1);
+  xk->key = malloc(l + 1);
   strncpyz(xk->key, arg, l + 1);
 
   if (buf[0]) {
@@ -831,7 +777,7 @@
 
     if (k > 500 - l)
       k = 500 - l;
-    xk->data = user_malloc(k + 1);
+    xk->data = malloc(k + 1);
     strncpyz(xk->data, buf, k + 1);
   }
   xtra_set(u, e, xk);
@@ -844,12 +790,10 @@
   struct xtra_key *x1, *x2;
 
   for (x1 = e->u.extra; x1; x1 = x1->next) {
-    x2 = user_malloc(sizeof(struct xtra_key));
+    x2 = malloc(sizeof(struct xtra_key));
 
-    x2->key = user_malloc(strlen(x1->key) + 1);
-    strcpy(x2->key, x1->key);
-    x2->data = user_malloc(strlen(x1->data) + 1);
-    strcpy(x2->data, x1->data);
+    malloc_strcpy(x2->key, x1->key);
+    malloc_strcpy(x2->data, x1->data);
     set_user(&USERENTRY_XTRA, new, x2);
   }
   return 1;
@@ -871,11 +815,11 @@
 
   for (x = e->u.extra; x; x = y) {
     y = x->next;
-    nfree(x->key);
-    nfree(x->data);
-    nfree(x);
+    free(x->key);
+    free(x->data);
+    free(x);
   }
-  nfree(e);
+  free(e);
   return 1;
 }
 
@@ -905,20 +849,6 @@
   return TCL_OK;
 }
 
-static int xtra_expmem(struct user_entry *e)
-{
-  struct xtra_key *x;
-  int tot = 0;
-
-  for (x = e->u.extra; x; x = x->next) {
-    tot += sizeof(struct xtra_key);
-
-    tot += strlen(x->key) + 1;
-    tot += strlen(x->data) + 1;
-  }
-  return tot;
-}
-
 struct user_entry_type USERENTRY_XTRA =
 {
   0,
@@ -932,7 +862,6 @@
   xtra_set,
   xtra_tcl_get,
   xtra_tcl_set,
-  xtra_expmem,
   xtra_display,
   "XTRA"
 };
@@ -965,15 +894,10 @@
 static int hosts_kill(struct user_entry *e)
 {
   list_type_kill(e->u.list);
-  nfree(e);
+  free(e);
   return 1;
 }
 
-static int hosts_expmem(struct user_entry *e)
-{
-  return list_type_expmem(e->u.list);
-}
-
 static void hosts_display(int idx, struct user_entry *e)
 {
   char s[1024];
@@ -1026,16 +950,15 @@
 	u = *t;
 	*t = (*t)->next;
 	if (u->extra)
-	  nfree(u->extra);
-	nfree(u);
+	  free(u->extra);
+	free(u);
       } else
 	t = &((*t)->next);
     }
-    *t = user_malloc(sizeof(struct list_type));
+    *t = malloc(sizeof(struct list_type));
 
     (*t)->next = NULL;
-    (*t)->extra = user_malloc(strlen(host) + 1);
-    strcpy((*t)->extra, host);
+    malloc_strcpy((*t)->extra, host);
   }
   return 1;
 }
@@ -1082,7 +1005,6 @@
   hosts_set,
   hosts_tcl_get,
   hosts_tcl_set,
-  hosts_expmem,
   hosts_display,
   "HOSTS"
 };
@@ -1124,8 +1046,7 @@
     if (e && e->name) {
       e->type = type;
       e->type->unpack(u, e);
-      nfree(e->name);
-      e->name = NULL;
+      free_null(e->name);
     }
   }
   return 1;
@@ -1140,8 +1061,7 @@
 
     if (e && !e->name) {
       e->type->pack(u, e);
-      e->name = user_malloc(strlen(e->type->name) + 1);
-      strcpy(e->name, e->type->name);
+      malloc_strcpy(e->name, e->type->name);
       e->type = NULL;
     }
   }
@@ -1196,7 +1116,7 @@
     return 0;
 
   if (!(e = find_user_entry(et, u))) {
-    e = user_malloc(sizeof(struct user_entry));
+    e = malloc(sizeof(struct user_entry));
 
     e->type = et;
     e->name = NULL;
@@ -1206,7 +1126,7 @@
   r = et->set(u, e, d);
   if (!e->u.list) {
     list_delete((struct list_type **) &(u->entries), (struct list_type *) e);
-    nfree(e);
+    free(e);
   }
   return r;
 }
Index: eggdrop1.7/src/userrec.c
diff -u eggdrop1.7/src/userrec.c:1.33 eggdrop1.7/src/userrec.c:1.34
--- eggdrop1.7/src/userrec.c:1.33	Fri Aug 10 18:51:20 2001
+++ eggdrop1.7/src/userrec.c	Wed Oct 10 05:44:04 2001
@@ -4,7 +4,7 @@
  *   a bunch of functions to find and change user records
  *   change and check user (and channel-specific) flags
  *
- * $Id: userrec.c,v 1.33 2001/08/10 23:51:20 ite Exp $
+ * $Id: userrec.c,v 1.34 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -53,112 +53,6 @@
 int		userfile_perm = 0600;	/* Userfile permissions,
 					   default rw-------		    */
 
-
-void *_user_malloc(int size, const char *file, int line)
-{
-#ifdef DEBUG_MEM
-  char		 x[1024];
-  const char	*p;
-
-  p = strrchr(file, '/');
-  simple_sprintf(x, "userrec.c:%s", p ? p + 1 : file);
-  return n_malloc(size, x, line);
-#else
-  return nmalloc(size);
-#endif
-}
-
-void *_user_realloc(void *ptr, int size, const char *file, int line)
-{
-#ifdef DEBUG_MEM
-  char		 x[1024];
-  const char	*p;
-
-  p = strrchr(file, '/');
-  simple_sprintf(x, "userrec.c:%s", p ? p + 1 : file);
-  return n_realloc(ptr, size, x, line);
-#else
-  return nrealloc(ptr, size);
-#endif
-}
-
-inline int expmem_mask(struct maskrec *m)
-{
-  int result = 0;
-
-  for (; m; m = m->next) {
-    result += sizeof(struct maskrec);
-    result += strlen(m->mask) + 1;
-    if (m->user)
-      result += strlen(m->user) + 1;
-    if (m->desc)
-      result += strlen(m->desc) + 1;
-  }
-
-  return result;
-}
-
-/* Memory we should be using
- */
-int expmem_users()
-{
-  int tot;
-  struct userrec *u;
-  struct chanuserrec *ch;
-  struct chanset_t *chan;
-  struct user_entry *ue;
-  struct igrec *i;
-
-  tot = 0;
-  for (u = userlist; u; u = u->next) { 
-    for (ch = u->chanrec; ch; ch = ch->next) {
-      tot += sizeof(struct chanuserrec);
-
-      if (ch->info != NULL)
-	tot += strlen(ch->info) + 1;
-    }
-    tot += sizeof(struct userrec);
-
-    for (ue = u->entries; ue; ue = ue->next) {
-      tot += sizeof(struct user_entry);
-
-      if (ue->name) {
-	tot += strlen(ue->name) + 1;
-	tot += list_type_expmem(ue->u.list);
-      } else {
-	tot += ue->type->expmem(ue);
-      }
-    }
-  }
-  /* Account for each channel's masks */
-  for (chan = chanset; chan; chan = chan->next) {
-
-    /* Account for each channel's ban-list user */
-    tot += expmem_mask(chan->bans);
-
-    /* Account for each channel's exempt-list user */
-    tot += expmem_mask(chan->exempts);
-
-    /* Account for each channel's invite-list user */
-    tot += expmem_mask(chan->invites);
-  }
-
-  tot += expmem_mask(global_bans);
-  tot += expmem_mask(global_exempts);
-  tot += expmem_mask(global_invites);
-
-  for (i = global_ign; i; i = i->next) {
-    tot += sizeof(struct igrec);
-
-    tot += strlen(i->igmask) + 1;
-    if (i->user)
-      tot += strlen(i->user) + 1;
-    if (i->msg)
-      tot += strlen(i->msg) + 1;
-  }
-  return tot;
-}
-
 int count_users(struct userrec *bu)
 {
   int tot = 0;
@@ -262,12 +156,12 @@
   for (; m; m = temp) {
     temp = m->next;
     if (m->mask)
-      nfree(m->mask);
+      free(m->mask);
     if (m->user)
-      nfree(m->user);
+      free(m->user);
     if (m->desc)
-      nfree(m->desc);
-    nfree(m);
+      free(m->desc);
+    free(m);
   }
 }
 
@@ -525,14 +419,14 @@
   if (userlist == NULL)
     return;			/* No point in saving userfile */
 
-  new_userfile = nmalloc(strlen(userfile) + 5);
+  new_userfile = malloc(strlen(userfile) + 5);
   sprintf(new_userfile, "%s~new", userfile);
 
   f = fopen(new_userfile, "w");
   chmod(new_userfile, userfile_perm);
   if (f == NULL) {
     putlog(LOG_MISC, "*", _("ERROR writing user file."));
-    nfree(new_userfile);
+    free(new_userfile);
     return;
   }
   if (!quiet_save)
@@ -548,13 +442,13 @@
   if (!ok || fflush(f)) {
     putlog(LOG_MISC, "*", "%s (%s)", _("ERROR writing user file."), strerror(ferror(f)));
     fclose(f);
-    nfree(new_userfile);
+    free(new_userfile);
     return;
   }
   fclose(f);
   call_hook(HOOK_USERFILE);
   movefile(new_userfile, userfile);
-  nfree(new_userfile);
+  free(new_userfile);
 }
 
 int change_handle(struct userrec *u, char *newh)
@@ -596,7 +490,7 @@
   int oldshare = noshare;
 
   noshare = 1;
-  u = (struct userrec *) nmalloc(sizeof(struct userrec));
+  u = (struct userrec *) malloc(sizeof(struct userrec));
 
   /* u->next=bu; bu=u; */
   strncpyz(u->handle, handle, sizeof u->handle);
@@ -612,11 +506,10 @@
   }
   set_user(&USERENTRY_PASS, u, pass);
   if (!noxtra) {
-    xk = nmalloc(sizeof(struct xtra_key));
-    xk->key = nmalloc(8);
-    strcpy(xk->key, "created");
-    xk->data = nmalloc(10);
-    sprintf(xk->data, "%09lu", now);
+    xk = malloc(sizeof(struct xtra_key));
+    malloc_strcpy(xk->key, "created");
+    xk->data = malloc(sizeof(time_t));
+    sprintf(xk->data, "%lu", now);
     set_user(&USERENTRY_XTRA, u, xk);
   }
   /* Strip out commas -- they're illegal */
@@ -680,8 +573,8 @@
     z = ch;
     ch = ch->next;
     if (z->info != NULL)
-      nfree(z->info);
-    nfree(z);
+      free(z->info);
+    free(z);
   }
   u->chanrec = NULL;
   for (ue = u->entries; ue; ue = ut) {
@@ -691,16 +584,16 @@
 
       for (lt = ue->u.list; lt; lt = ltt) {
 	ltt = lt->next;
-	nfree(lt->extra);
-	nfree(lt);
+	free(lt->extra);
+	free(lt);
       }
-      nfree(ue->name);
-      nfree(ue);
+      free(ue->name);
+      free(ue);
     } else {
       ue->type->kill(ue);
     }
   }
-  nfree(u);
+  free(u);
 }
 
 int deluser(char *handle)
@@ -750,8 +643,8 @@
     if (!rfc_casecmp(q->extra, host)) {
       e = find_user_entry(&USERENTRY_HOSTS, u);
       e->u.extra = q->next;
-      nfree(q->extra);
-      nfree(q);
+      free(q->extra);
+      free(q);
       i++;
       qprev = NULL;
       q = e->u.extra;
@@ -766,8 +659,8 @@
 	  e->u.extra = q->next;
 	  qprev = NULL;
 	}
-	nfree(q->extra);
-	nfree(q);
+	free(q->extra);
+	free(q);
 	i++;
       } else
         qprev = q;
@@ -806,15 +699,14 @@
     (struct laston_info *) get_user(&USERENTRY_LASTON, u);
 
     if (!li)
-      li = nmalloc(sizeof(struct laston_info));
+      li = malloc(sizeof(struct laston_info));
 
     else if (li->lastonplace)
-      nfree(li->lastonplace);
+      free(li->lastonplace);
     li->laston = timeval;
-    if (where) {
-      li->lastonplace = nmalloc(strlen(where) + 1);
-      strcpy(li->lastonplace, where);
-    } else
+    if (where)
+      malloc_strcpy(li->lastonplace, where);
+    else
       li->lastonplace = NULL;
     set_user(&USERENTRY_LASTON, u, li);
   } else if (timeval == 1) {
@@ -864,8 +756,8 @@
 	  u->chanrec = ch->next;
 
 	if (ch->info)
-	  nfree(ch->info);
-	nfree(ch);
+	  free(ch->info);
+	free(ch);
 	break;
       }
       och = ch;
Index: eggdrop1.7/src/users.c
diff -u eggdrop1.7/src/users.c:1.28 eggdrop1.7/src/users.c:1.29
--- eggdrop1.7/src/users.c:1.28	Fri Aug 10 18:51:20 2001
+++ eggdrop1.7/src/users.c	Wed Oct 10 05:44:04 2001
@@ -10,7 +10,7 @@
  *
  * dprintf'ized, 9nov1995
  *
- * $Id: users.c,v 1.28 2001/08/10 23:51:20 ite Exp $
+ * $Id: users.c,v 1.29 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -109,17 +109,17 @@
 
       if (mask) {
 	shareout(NULL, "-i %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
-    nfree((*u)->igmask);
+    free((*u)->igmask);
     if ((*u)->msg)
-      nfree((*u)->msg);
+      free((*u)->msg);
     if ((*u)->user)
-      nfree((*u)->user);
+      free((*u)->user);
     t = *u;
     *u = (*u)->next;
-    nfree(t);
+    free(t);
   }
   return i;
 }
@@ -130,26 +130,23 @@
 
   if (equals_ignore(ign))
     delignore(ign);		/* remove old ignore */
-  p = user_malloc(sizeof(struct igrec));
+  p = malloc(sizeof(struct igrec));
 
   p->next = global_ign;
   global_ign = p;
   p->expire = expire_time;
   p->added = now;
   p->flags = expire_time ? 0 : IGREC_PERM;
-  p->igmask = user_malloc(strlen(ign) + 1);
-  strcpy(p->igmask, ign);
-  p->user = user_malloc(strlen(from) + 1);
-  strcpy(p->user, from);
-  p->msg = user_malloc(strlen(mnote) + 1);
-  strcpy(p->msg, mnote);
+  malloc_strcpy(p->igmask, ign);
+  malloc_strcpy(p->user, from);
+  malloc_strcpy(p->msg, mnote);
   if (!noshare) {
     char *mask = str_escape(ign, ':', '\\');
 
     if (mask) {
       shareout(NULL, "+i %s %lu %c %s %s\n", mask, expire_time - now,
 	       (p->flags & IGREC_PERM) ? 'p' : '-', from, mnote);
-      nfree(mask);
+      free(mask);
     }
   }
 }
@@ -233,7 +230,7 @@
 			 char *note, time_t expire_time, int flags,
 			 time_t added, time_t last)
 {
-  maskrec *p = user_malloc(sizeof(maskrec));
+  maskrec *p = malloc(sizeof(maskrec));
   maskrec **u = (chan) ? m : global;
 
   p->next = *u;
@@ -242,12 +239,9 @@
   p->added = added;
   p->lastactive = last;
   p->flags = flags;
-  p->mask = user_malloc(strlen(mask) + 1);
-  strcpy(p->mask, mask);
-  p->user = user_malloc(strlen(from) + 1);
-  strcpy(p->user, from);
-  p->desc = user_malloc(strlen(note) + 1);
-  strcpy(p->desc, note);
+  malloc_strcpy(p->mask, mask);
+  malloc_strcpy(p->user, from);
+  malloc_strcpy(p->desc, note);
 }
 
 static void restore_chanban(struct chanset_t *chan, char *host)
@@ -442,21 +436,18 @@
 	added = "0";
 	desc = NULL;
       }
-      p = user_malloc(sizeof(struct igrec));
+      p = malloc(sizeof(struct igrec));
 
       p->next = global_ign;
       global_ign = p;
       p->expire = atoi(expi);
       p->added = atoi(added);
       p->flags = flags;
-      p->igmask = user_malloc(strlen(host) + 1);
-      strcpy(p->igmask, host);
-      p->user = user_malloc(strlen(user) + 1);
-      strcpy(p->user, user);
-      if (desc) {
-	p->msg = user_malloc(strlen(desc) + 1);
-	strcpy(p->msg, desc);
-      } else
+      malloc_strcpy(p->igmask, host);
+      malloc_strcpy(p->user, user);
+      if (desc)
+	malloc_strcpy(p->msg, desc);
+      else
 	p->msg = NULL;
       return;
     }
@@ -762,7 +753,7 @@
 		  break;
 	      if (!cr) {
 		cr = (struct chanuserrec *)
-		  user_malloc(sizeof(struct chanuserrec));
+		  malloc(sizeof(struct chanuserrec));
 
 		cr->next = u->chanrec;
 		u->chanrec = cr;
@@ -770,10 +761,9 @@
 		cr->laston = atoi(st);
 		cr->flags = fr.chan;
 		cr->flags_udef = fr.udef_chan;
-		if (s[0]) {
-		  cr->info = (char *) user_malloc(strlen(s) + 1);
-		  strcpy(cr->info, s);
-		} else
+		if (s[0])
+		  malloc_strcpy(cr->info, s);
+		else
 		  cr->info = NULL;
 	      }
 	    }
@@ -866,25 +856,23 @@
 	      if (ue->name && !egg_strcasecmp(code + 2, ue->name)) {
 		struct list_type *list;
 
-		list = user_malloc(sizeof(struct list_type));
+		list = malloc(sizeof(struct list_type));
 
 		list->next = NULL;
-		list->extra = user_malloc(strlen(s) + 1);
-		strcpy(list->extra, s);
+		malloc_strcpy(list->extra, s);
 		list_append((&ue->u.list), list);
 		ok = 1;
 	      }
 	    if (!ok) {
-	      ue = user_malloc(sizeof(struct user_entry));
+	      ue = malloc(sizeof(struct user_entry));
 
-	      ue->name = user_malloc(strlen(code + 1));
+	      ue->name = malloc(strlen(code + 1));
 	      ue->type = NULL;
 	      strcpy(ue->name, code + 2);
-	      ue->u.list = user_malloc(sizeof(struct list_type));
+	      ue->u.list = malloc(sizeof(struct list_type));
 
 	      ue->u.list->next = NULL;
-	      ue->u.list->extra = user_malloc(strlen(s) + 1);
-	      strcpy(ue->u.list->extra, s);
+	      malloc_strcpy(ue->u.list->extra, s);
 	      list_insert((&u->entries), ue);
 	    }
 	  }
@@ -966,8 +954,7 @@
 	if (uet) {
 	  e->type = uet;
 	  uet->unpack(u, e);
-	  nfree(e->name);
-	  e->name = NULL;
+	  free_null(e->name);
 	}
       }
   }
Index: eggdrop1.7/src/users.h
diff -u eggdrop1.7/src/users.h:1.8 eggdrop1.7/src/users.h:1.9
--- eggdrop1.7/src/users.h:1.8	Wed Apr 11 21:39:44 2001
+++ eggdrop1.7/src/users.h	Wed Oct 10 05:44:04 2001
@@ -2,7 +2,7 @@
  * users.h
  *   structures and definitions used by users.c and userrec.c
  *
- * $Id: users.h,v 1.8 2001/04/12 02:39:44 guppy Exp $
+ * $Id: users.h,v 1.9 2001/10/10 10:44:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -60,7 +60,6 @@
 		  int, char **);
   int (*tcl_set) (Tcl_Interp *, struct userrec *, struct user_entry *,
 		  int, char **);
-  int (*expmem) (struct user_entry *);
   void (*display) (int idx, struct user_entry *);
   char *name;
 };
@@ -109,14 +108,6 @@
   int dnload_ks;
 };
 
-void *_user_malloc(int size, const char *file, int line);
-void *_user_realloc(void *ptr, int size, const char *file, int line);
-
-#ifndef MAKING_MODS
-#  define user_malloc(x)	_user_malloc(x, __FILE__, __LINE__)
-#  define user_realloc(x, y)	_user_realloc(x, y, __FILE__, __LINE__)
-#endif
-
 int add_entry_type(struct user_entry_type *);
 int del_entry_type(struct user_entry_type *);
 struct user_entry_type *find_entry_type(char *);
@@ -196,7 +187,6 @@
 		struct user_entry *e, int argc, char **argv);
 int def_tcl_set(Tcl_Interp *irp, struct userrec *u,
 		struct user_entry *e, int argc, char **argv);
-int def_expmem(struct user_entry *e);
 void def_display(int idx, struct user_entry *e);
 int def_dupuser(struct userrec *new, struct userrec *old,
 		struct user_entry *e);
----------------------- End of diff -----------------------



More information about the Changes mailing list