Quellcode durchsuchen

* Removed nmalloc() nrealloc() nfree()
They were pointless as well, didn't reveal much in the expmem() system...
Valgrind reveals much more..
* Also added misc/sedall


svn: 589

Bryan Drewery vor 22 Jahren
Ursprung
Commit
13bf4ea9b0
52 geänderte Dateien mit 881 neuen und 1412 gelöschten Zeilen
  1. 4 4
      src/auth.c
  2. 2 2
      src/botmsg.c
  3. 20 20
      src/botnet.c
  4. 14 15
      src/chanprog.c
  5. 44 46
      src/cmds.c
  6. 14 14
      src/config.c
  7. 10 10
      src/crypt.c
  8. 17 17
      src/dcc.c
  9. 20 27
      src/dccutil.c
  10. 3 3
      src/debug.c
  11. 13 13
      src/dns.c
  12. 4 4
      src/egg_timer.c
  13. 0 12
      src/eggdrop.h
  14. 4 4
      src/flags.c
  15. 9 10
      src/main.c
  16. 1 1
      src/main.h
  17. 1 384
      src/mem.c
  18. 31 31
      src/misc.c
  19. 6 19
      src/mod/channels.mod/channels.c
  20. 1 1
      src/mod/channels.mod/channels.h
  21. 8 8
      src/mod/channels.mod/cmdschan.c
  22. 18 18
      src/mod/channels.mod/tclchan.c
  23. 6 6
      src/mod/channels.mod/udefchan.c
  24. 60 60
      src/mod/channels.mod/userchan.c
  25. 4 4
      src/mod/compress.mod/compress.c
  26. 23 23
      src/mod/console.mod/console.c
  27. 10 10
      src/mod/ctcp.mod/ctcp.c
  28. 5 5
      src/mod/dns.mod/coredns.c
  29. 26 26
      src/mod/irc.mod/cmdsirc.c
  30. 31 31
      src/mod/irc.mod/irc.c
  31. 38 38
      src/mod/irc.mod/mode.c
  32. 9 16
      src/mod/module.h
  33. 10 10
      src/mod/notes.mod/cmdsnote.c
  34. 23 23
      src/mod/notes.mod/notes.c
  35. 43 43
      src/mod/server.mod/server.c
  36. 1 1
      src/mod/server.mod/server.h
  37. 4 4
      src/mod/server.mod/servmsg.c
  38. 20 20
      src/mod/share.mod/share.c
  39. 7 7
      src/mod/share.mod/uf_features.c
  40. 52 52
      src/mod/transfer.mod/transfer.c
  41. 4 4
      src/mod/update.mod/update.c
  42. 23 63
      src/modules.c
  43. 0 4
      src/modules.h
  44. 34 34
      src/net.c
  45. 4 12
      src/proto.h
  46. 12 13
      src/tcl.c
  47. 11 27
      src/tclhash.c
  48. 2 2
      src/tcluser.c
  49. 116 116
      src/userent.c
  50. 25 53
      src/userrec.c
  51. 34 34
      src/users.c
  52. 0 8
      src/users.h

+ 4 - 4
src/auth.c

@@ -42,9 +42,9 @@ void init_auth_max()
   if (max_auth < 1)
     max_auth = 1;
   if (auth)
-    auth = nrealloc(auth, sizeof(struct auth_t) * max_auth);
+    auth = realloc(auth, sizeof(struct auth_t) * max_auth);
   else
-    auth = nmalloc(sizeof(struct auth_t) * max_auth);
+    auth = malloc(sizeof(struct auth_t) * max_auth);
 }
 
 static void expire_auths()
@@ -75,13 +75,13 @@ char *makehash(struct userrec *u, char *rand)
 {
   char hash[256], *secpass = NULL;
   if (get_user(&USERENTRY_SECPASS, u)) {
-    secpass = nmalloc(strlen(get_user(&USERENTRY_SECPASS, u)) + 1);
+    secpass = malloc(strlen(get_user(&USERENTRY_SECPASS, u)) + 1);
     strcpy(secpass, (char *) get_user(&USERENTRY_SECPASS, u));
     secpass[strlen(secpass)] = 0;
   }
   sprintf(hash, "%s%s%s", rand, (secpass && secpass[0]) ? secpass : "" , (authkey && authkey[0]) ? authkey : "");
   if (secpass)
-    nfree(secpass);
+    free(secpass);
 
   return md5(hash);
 }

+ 2 - 2
src/botmsg.c

@@ -168,10 +168,10 @@ void botnet_send_cmdpass(int idx, char *cmd, char *pass)
   char *buf;
 
   if (tands > 0) {
-    buf = nmalloc(strlen(cmd) + strlen(pass) + 5 + 1);
+    buf = malloc(strlen(cmd) + strlen(pass) + 5 + 1);
     sprintf(buf, "cp %s %s\n", cmd, pass);
     send_tand_but(idx, buf, strlen(buf));
-    nfree(buf);
+    free(buf);
   }
 }
 #endif /* S_DCCPASS */

+ 20 - 20
src/botnet.c

@@ -37,7 +37,7 @@ void init_bots()
   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)
@@ -61,7 +61,7 @@ void addbot(char *who, char *from, char *next, char flag, int vernum)
       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;
@@ -141,8 +141,8 @@ int addparty(char *bot, char *nick, int chan, char flag, int sock,
 	  flag = '-';
 	party[i].flag = flag;
 	if (party[i].from)
-	  nfree(party[i].from);
-	party[i].from = nmalloc(strlen(from) + 1);
+	  free(party[i].from);
+	party[i].from = malloc(strlen(from) + 1);
 	strcpy(party[i].from, from);
       }
       *idx = i;
@@ -152,7 +152,7 @@ int addparty(char *bot, char *nick, int chan, char flag, int sock,
   /* 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;
@@ -167,11 +167,11 @@ int addparty(char *bot, char *nick, int chan, char flag, int sock,
     if (flag == ' ')
       flag = '-';
     party[parties].flag = flag;
-    party[parties].from = nmalloc(strlen(from) + 1);
+    party[parties].from = malloc(strlen(from) + 1);
     strcpy(party[parties].from, from);
   } else {
     party[parties].flag = ' ';
-    party[parties].from = nmalloc(10);
+    party[parties].from = malloc(10);
     strcpy(party[parties].from, "(unknown)");
   }
   *idx = parties;
@@ -268,9 +268,9 @@ void partyaway(char *bot, int sock, char *msg)
     if ((!egg_strcasecmp(party[i].bot, bot)) &&
 	(party[i].sock == sock)) {
       if (party[i].away)
-	nfree(party[i].away);
+	free(party[i].away);
       if (msg[0]) {
-	party[i].away = nmalloc(strlen(msg) + 1);
+	party[i].away = malloc(strlen(msg) + 1);
 	strcpy(party[i].away, msg);
       } else
 	party[i].away = 0;
@@ -301,7 +301,7 @@ void rembot(char *who)
 
   ptr2 = *ptr;
   *ptr = ptr2->next;
-  nfree(ptr2);
+  free(ptr2);
   tands--;
 
   dupwait_notify(who);
@@ -316,9 +316,9 @@ void remparty(char *bot, int sock)
 	(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);
@@ -1018,7 +1018,7 @@ int botlink(char *linker, int idx, char *nick)
 
 static void botlink_resolve_failure(int i)
 {
-  nfree(dcc[i].u.dns->cptr);
+  free(dcc[i].u.dns->cptr);
   lostdcc(i);
 }
 
@@ -1040,7 +1040,7 @@ static void botlink_resolve_success(int i)
 #else
   dcc[i].sock = getsock(SOCK_STRONGCONN);
 #endif /* USE_IPV6 */
-  nfree(linker);
+  free(linker);
 
   if (dcc[i].sock < 0 ||
 #ifdef USE_IPV6
@@ -1084,7 +1084,7 @@ static void failed_tandem_relay(int idx)
 
     dprintf(uidx, "%s %s.\n", BOT_CANTLINKTO, 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);
@@ -1213,7 +1213,7 @@ static void tandem_relay_resolve_failure(int idx)
   ci = dcc[uidx].u.relay->chat;
   dprintf(uidx, "%s %s.\n", BOT_CANTLINKTO, 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);
@@ -1284,7 +1284,7 @@ static void pre_relay(int idx, char *buf, register int i)
     putlog(LOG_MISC, "*", "%s %s -> %s", BOT_ABORTRELAY3, 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);
@@ -1400,7 +1400,7 @@ static void eof_dcc_relay(int idx)
 	 dcc[idx].nick);
   dprintf(j, "\n\n*** %s %s\n", BOT_ENDRELAY2, 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) {
@@ -1501,7 +1501,7 @@ static void dcc_relaying(int idx, char *buf, int j)
       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_chon(dcc[idx].nick, idx);
@@ -1538,7 +1538,7 @@ static void kill_relay(int idx, void *x)
 
   if (p->chat)
     DCC_CHAT.kill(idx, p->chat);
-  nfree(p);
+  free(p);
 }
 
 struct dcc_table DCC_RELAY =

+ 14 - 15
src/chanprog.c

@@ -290,9 +290,8 @@ void tell_verbose_status(int idx)
 
 #ifdef HUB
   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");
   if (localhub)
     dprintf(idx, "I am a localhub.\n");
   if (isupdatehub())
@@ -454,8 +453,8 @@ void load_internal_users()
         hublevel++;		/* We must increment this even if it is already added */
 	if (!get_user_by_handle(userlist, hand)) {
 	  userlist = adduser(userlist, hand, "none", "-", USER_BOT | USER_OP);
-	  bi = user_malloc(sizeof(struct bot_addr));
-	  bi->address = user_malloc(strlen(ip) + 1);
+	  bi = malloc(sizeof(struct bot_addr));
+	  bi->address = malloc(strlen(ip) + 1);
 	  strcpy(bi->address, ip);
 	  bi->telnet_port = atoi(port) ? atoi(port) : 0;
 	  bi->relay_port = bi->telnet_port;
@@ -464,7 +463,7 @@ void load_internal_users()
 	  if ((!bi->hublevel) && (!strcmp(hand, botnetnick)))
 	    bi->hublevel = 99;
 #endif /* HUB */
-          bi->uplink = user_malloc(1);
+          bi->uplink = malloc(1);
           bi->uplink[0] = 0;
 	  set_user(&USERENTRY_BOTADDR, get_user_by_handle(userlist, hand), bi);
 	  /* set_user(&USERENTRY_PASS, get_user_by_handle(userlist, hand), SALT2); */
@@ -583,9 +582,9 @@ void chanprog()
     /* I need to be on the userlist... doh. */
     userlist = adduser(userlist, botnetnick, STR("none"), "-", USER_BOT | USER_OP );
     u = get_user_by_handle(userlist, botnetnick);
-    bi = user_malloc(sizeof(struct bot_addr));
+    bi = malloc(sizeof(struct bot_addr));
 
-    bi->address = user_malloc(strlen(myip) + 1);
+    bi->address = malloc(strlen(myip) + 1);
     strcpy(bi->address, myip);
     bi->telnet_port = atoi(buf) ? atoi(buf) : 3333;
     bi->relay_port = bi->telnet_port;
@@ -594,7 +593,7 @@ void chanprog()
 #else
     bi->hublevel = 0;
 #endif /* HUB */
-    bi->uplink = user_malloc(1);
+    bi->uplink = malloc(1);
     bi->uplink[0] = 0;
     set_user(&USERENTRY_BOTADDR, u, bi);
   } else {
@@ -736,11 +735,11 @@ void do_chanset(struct chanset_t *chan, char *options, int local)
 
   /* send out over botnet. */
   if (local != 2) {
-         /* nmalloc(options,chan,'cset ',' ',+ 1) */
+         /* malloc(options,chan,'cset ',' ',+ 1) */
     if (chan)
-      buf = nmalloc(strlen(options) + strlen(chan->dname) + 5 + 1 + 1);
+      buf = malloc(strlen(options) + strlen(chan->dname) + 5 + 1 + 1);
     else
-      buf = nmalloc(strlen(options) + 1 + 5 + 1 + 1);
+      buf = malloc(strlen(options) + 1 + 5 + 1 + 1);
     buf[0] = 0;
     strcat(buf, "cset ");
     if (chan)
@@ -752,7 +751,7 @@ void do_chanset(struct chanset_t *chan, char *options, int local)
     buf[strlen(buf)] = 0;
     putlog(LOG_DEBUG, "*", "sending out cset: %s", buf);
     putallbots(buf); 
-    nfree(buf);
+    free(buf);
   }
   /* now set locally, hopefully it works */
   if (local && (me = module_find("channels", 0, 0))) {
@@ -769,7 +768,7 @@ void do_chanset(struct chanset_t *chan, char *options, int local)
       ch = chan;
 
     bak = options;
-    buf2 = nmalloc(strlen(options) + 1);
+    buf2 = malloc(strlen(options) + 1);
 
     while (ch) {
       char *list[2];
@@ -792,6 +791,6 @@ void do_chanset(struct chanset_t *chan, char *options, int local)
       else
         ch = NULL;
     }
-    nfree(buf2);
+    free(buf2);
   }
 }

+ 44 - 46
src/cmds.c

@@ -304,7 +304,7 @@ static void cmd_config(struct userrec *u, int idx, char *par)
 
   putlog(LOG_CMDS, "*", STR("#%s# config %s"), dcc[idx].nick, par);
   if (!par[0]) {
-    char *outbuf = nmalloc(1);
+    char *outbuf = malloc(1);
     outbuf[0] = 0;
     dprintf(idx, STR("Usage: config [name [value|-]]\n"));
     dprintf(idx, STR("Defined config entry names:\n"));
@@ -312,10 +312,10 @@ static void cmd_config(struct userrec *u, int idx, char *par)
     for (i = 0; i < cfg_count; i++) {
       if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
 	if (!cnt) {
-          outbuf = nrealloc(outbuf, 2 + 1);
+          outbuf = realloc(outbuf, 2 + 1);
 	  sprintf(outbuf, "  ");
         }
-        outbuf = nrealloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
+        outbuf = realloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
 	sprintf(outbuf, STR("%s%s "), outbuf, cfg[i]->name);
 	cnt++;
 	if (cnt == 10) {
@@ -327,7 +327,7 @@ static void cmd_config(struct userrec *u, int idx, char *par)
     if (cnt)
       dprintf(idx, "%s\n", outbuf);
     if (outbuf)
-      nfree(outbuf);
+      free(outbuf);
     return;
   }
   name = newsplit(&par);
@@ -572,10 +572,10 @@ static void cmd_motd(struct userrec *u, int idx, char *par)
   if (par[0] && (u->flags & USER_MASTER)) {
     char *s;
 
-    s = nmalloc(strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1); /* +2: ' 'x2 */
+    s = malloc(strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1); /* +2: ' 'x2 */
     sprintf(s, STR("%s %lu %s"), dcc[idx].nick, now, par);
     set_cfg_str(NULL, "motd", s);
-    nfree(s);
+    free(s);
     dprintf(idx, STR("Motd set\n"));
 #ifdef HUB
   write_userfile(idx);
@@ -752,7 +752,7 @@ int my_cmp (const mycmds *c1, const mycmds *c2)
 static void cmd_nohelp(struct userrec *u, int idx, char *par)
 {
   int i;
-  char *buf = nmalloc(1);
+  char *buf = malloc(1);
   buf[0] = 0;
 
   qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)()) &my_cmp);
@@ -762,7 +762,7 @@ static void cmd_nohelp(struct userrec *u, int idx, char *par)
     for (o = 0; (help[o].cmd) && (help[o].desc); o++)
       if (!egg_strcasecmp(help[o].cmd, cmdlist[i].name)) found++;
     if (!found) {
-      buf = nrealloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
+      buf = realloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
       strcat(buf, cmdlist[i].name);
       strcat(buf, ", ");
     }
@@ -1126,14 +1126,12 @@ static void cmd_status(struct userrec *u, int idx, char *par)
     }
     putlog(LOG_CMDS, "*", STR("#%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, "*", STR("#%s# status"), dcc[idx].nick);
     tell_verbose_status(idx);
-    tell_mem_status_dcc(idx);
     do_module_report(idx, 0, NULL);
   }
 }
@@ -1592,11 +1590,11 @@ static void cmd_hublevel(struct userrec *u, int idx, char *par)
   }
   dprintf(idx, STR("Changed bot's hublevel.\n"));
   obi = get_user(&USERENTRY_BOTADDR, u1);
-  bi = user_malloc(sizeof(struct bot_addr));
+  bi = malloc(sizeof(struct bot_addr));
 
-  bi->uplink = user_malloc(strlen(obi->uplink) + 1);
+  bi->uplink = malloc(strlen(obi->uplink) + 1);
   strcpy(bi->uplink, obi->uplink);
-  bi->address = user_malloc(strlen(obi->address) + 1);
+  bi->address = malloc(strlen(obi->address) + 1);
   strcpy(bi->address, obi->address);
   bi->telnet_port = obi->telnet_port;
   bi->relay_port = obi->relay_port;
@@ -1632,11 +1630,11 @@ static void cmd_uplink(struct userrec *u, int idx, char *par)
   else
     dprintf(idx, STR("Cleared bot's uplink.\n"));
   obi = get_user(&USERENTRY_BOTADDR, u1);
-  bi = user_malloc(sizeof(struct bot_addr));
+  bi = malloc(sizeof(struct bot_addr));
 
-  bi->uplink = user_malloc(strlen(uplink) + 1);
+  bi->uplink = malloc(strlen(uplink) + 1);
   strcpy(bi->uplink, uplink);
-  bi->address = user_malloc(strlen(obi->address) + 1);
+  bi->address = malloc(strlen(obi->address) + 1);
   strcpy(bi->address, obi->address);
   bi->telnet_port = obi->telnet_port;
   bi->relay_port = obi->relay_port;
@@ -1686,15 +1684,15 @@ static void cmd_chaddr(struct userrec *u, int idx, char *par)
     relay_port = bi->relay_port;
   }
 
-  bi = user_malloc(sizeof(struct bot_addr));
+  bi = malloc(sizeof(struct bot_addr));
 
-  bi->uplink = user_malloc(strlen(obi->uplink) + 1);
+  bi->uplink = malloc(strlen(obi->uplink) + 1);
   strcpy(bi->uplink, obi->uplink);
   bi->hublevel = obi->hublevel;
 
   q = strchr(addr, ':');
   if (!q) {
-    bi->address = user_malloc(strlen(addr) + 1);
+    bi->address = malloc(strlen(addr) + 1);
     strcpy(bi->address, addr);
     bi->telnet_port = telnet_port;
     bi->relay_port = relay_port;
@@ -1704,12 +1702,12 @@ static void cmd_chaddr(struct userrec *u, int idx, char *par)
     if (r) { /* ipv6 notation [3ffe:80c0:225::] */
       *addr++;
       r = strchr(addr, ']');
-      bi->address = user_malloc(r - addr + 1);
+      bi->address = malloc(r - addr + 1);
       strncpyz(bi->address, addr, r - addr + 1);
       addr = r;
       *addr++;
     } else {
-      bi->address = user_malloc(q - addr + 1);
+      bi->address = malloc(q - addr + 1);
       strncpyz(bi->address, addr, q - addr + 1);
     }
     q = strchr(addr, ':');
@@ -1724,7 +1722,7 @@ static void cmd_chaddr(struct userrec *u, int idx, char *par)
       }
     }
 #else /* !USE_IPV6 */
-    bi->address = user_malloc(q - addr + 1);
+    bi->address = malloc(q - addr + 1);
     strncpyz(bi->address, addr, q - addr + 1);
     p = q + 1;
     bi->telnet_port = atoi(p);
@@ -1790,10 +1788,10 @@ static void cmd_randstring(struct userrec *u, int idx, char *par)
 
   len = atoi(par);
   if (len < 301) {
-    rand = nmalloc(len + 1);
+    rand = malloc(len + 1);
     make_rand_str(rand, len);
     dprintf(idx, STR("string: %s\n"), rand);
-    nfree(rand);
+    free(rand);
   } else 
     dprintf(idx, "Too long, must be <= 300\n");
 }
@@ -1852,7 +1850,7 @@ static void cmd_die(struct userrec *u, int idx, char *par)
 static void cmd_debug(struct userrec *u, int idx, char *par)
 {
   putlog(LOG_CMDS, "*", STR("#%s# debug"), dcc[idx].nick);
-  debug_mem_to_dcc(idx);
+  tell_netdebug(idx);
 }
 
 static void cmd_simul(struct userrec *u, int idx, char *par)
@@ -2247,7 +2245,7 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
 	return;
       }
     } else if (arg && !strpbrk(chg, "&|")) {
-      tmpchg = nmalloc(strlen(chg) + 2);
+      tmpchg = malloc(strlen(chg) + 2);
       strcpy(tmpchg, "|");
       strcat(tmpchg, chg);
       chg = tmpchg;
@@ -2263,13 +2261,13 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("You do not have channel master privileges for channel %s.\n"),
 	    par);
     if (tmpchg)
-      nfree(tmpchg);
+      free(tmpchg);
     return;
   }
     if (chan && private(user, chan, PRIV_OP)) {
       dprintf(idx, STR("You do not have access to change flags for %s\n"), chan->dname);
       if (tmpchg)
-        nfree(tmpchg);
+        free(tmpchg);
       return;
     }
 
@@ -2395,7 +2393,7 @@ static void cmd_chattr(struct userrec *u, int idx, char *par)
     (func[IRC_CHECK_THIS_USER]) (hand, 0, NULL);
   }
   if (tmpchg)
-    nfree(tmpchg);
+    free(tmpchg);
 #ifdef HUB
   write_userfile(idx);
 #endif /* HUB */
@@ -2535,7 +2533,7 @@ int exec_str(int idx, char *cmd) {
         p=np;
       }
       dprintf(idx, "\n");
-      nfree(out);
+      free(out);
     }
     if (err) {
       dprintf(idx, STR("Errors:\n"));
@@ -2548,7 +2546,7 @@ int exec_str(int idx, char *cmd) {
         p=np;
       }
       dprintf(idx, "\n");
-      nfree(err);
+      free(err);
     }
     return 1;
   }
@@ -2584,11 +2582,11 @@ static void cmd_ps(struct userrec *u, int idx, char *par) {
     dprintf(idx, STR("No."));
     return;
   }
-  buf=nmalloc(strlen(par)+4);
+  buf=malloc(strlen(par)+4);
   sprintf(buf, STR("ps %s"), par);
   if (!exec_str(idx, buf))
     dprintf(idx, STR("Exec failed\n"));
-  nfree(buf);
+  free(buf);
 }
 
 static void cmd_last(struct userrec *u, int idx, char *par) {
@@ -2883,7 +2881,7 @@ static void cmd_su(struct userrec *u, int idx, char *par)
 	 * their password right ;)
 	 */
 	if (dcc[idx].u.chat->away != NULL)
-	  nfree(dcc[idx].u.chat->away);
+	  free(dcc[idx].u.chat->away);
         dcc[idx].u.chat->away = get_data_ptr(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);
@@ -3039,13 +3037,13 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
       char tmp[81];
       userlist = adduser(userlist, handle, STR("none"), "-", USER_BOT | USER_OP);
       u1 = get_user_by_handle(userlist, handle);
-      bi = user_malloc(sizeof(struct bot_addr));
+      bi = malloc(sizeof(struct bot_addr));
 
-      bi->uplink = user_malloc(strlen(botnetnick) + 1); 
+      bi->uplink = malloc(strlen(botnetnick) + 1); 
 /*      strcpy(bi->uplink, botnetnick); */
       strcpy(bi->uplink, "");
 
-      bi->address = user_malloc(1);
+      bi->address = malloc(1);
       bi->address[0] = 0;
       bi->telnet_port = 3333;
       bi->relay_port = 3333;
@@ -3071,7 +3069,7 @@ static void cmd_nopass(struct userrec *u, int idx, char *par)
 {
   int cnt = 0;
   struct userrec *cu;
-  char *users = nmalloc(1);
+  char *users = malloc(1);
 
   putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
 
@@ -3080,7 +3078,7 @@ static void cmd_nopass(struct userrec *u, int idx, char *par)
     if (!(cu->flags & USER_BOT)) {
       if (u_pass_match(cu, "-")) {
         cnt++;
-        users = nrealloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
+        users = realloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
         strcat(users, cu->handle);
         strcat(users, " ");
       }
@@ -3090,7 +3088,7 @@ static void cmd_nopass(struct userrec *u, int idx, char *par)
     dprintf(idx, "All users have passwords set.\n");
   else
     dprintf(idx, "Users without passwords: %s\n", users);
-  nfree(users);
+  free(users);
 }
 #endif /* HUB */
 
@@ -3691,7 +3689,7 @@ void crontab_show(struct userrec * u, int idx) {
 
 void crontab_del() {
   char * tmpfile, *p, buf[2048];
-  tmpfile=nmalloc(strlen(binname)+100);
+  tmpfile=malloc(strlen(binname)+100);
   strcpy(tmpfile, binname);
   if (!(p=strrchr(tmpfile, '/')))
     return;
@@ -3832,7 +3830,7 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
         botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, p);
         p=np;
       }
-      nfree(out);
+      free(out);
     }
     if (err) {
       char * p, * np;
@@ -3845,7 +3843,7 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
         botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, p);
         p=np;
       }
-      nfree(err);
+      free(err);
     }
   } else {
     botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("exec failed"));
@@ -3929,10 +3927,10 @@ void gotremotecmd (char * forbot, char * frombot, char * fromhand, char * fromid
 void gotremotereply (char *frombot, char *tohand, char *toidx, char *ln) {
   int idx = atoi(toidx);
   if ((idx >= 0) && (idx < dcc_total) && (dcc[idx].type == &DCC_CHAT) && (!strcmp(dcc[idx].nick, tohand))) {
-    char *buf = nmalloc(strlen(frombot) + 2 + 1);
+    char *buf = malloc(strlen(frombot) + 2 + 1);
     sprintf(buf, "(%s)", frombot);
     dprintf(idx, STR("%-13s %s\n"), buf, ln);
-    nfree(buf);
+    free(buf);
   }
 }
 
@@ -4059,7 +4057,7 @@ static void cmd_quit(struct userrec *u, int idx, char *text)
 		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);
+		free(dcc[idx].u.chat->su_nick);
 		dcc[idx].u.chat->su_nick = NULL;
 		dcc_chatter(idx);
 		if (dcc[idx].u.chat->channel < 100000 && dcc[idx].u.chat->channel >= 0) {

+ 14 - 14
src/config.c

@@ -550,7 +550,7 @@ struct cfg_entry CFG_OPTIMESLACK = {
 
 void add_cfg(struct cfg_entry *entry)
 {
-  cfg = (void *) nrealloc(cfg, sizeof(void *) * (cfg_count + 1));
+  cfg = (void *) realloc(cfg, sizeof(void *) * (cfg_count + 1));
   cfg[cfg_count] = entry;
   cfg_count++;
   entry->ldata = NULL;
@@ -601,7 +601,7 @@ void set_cfg_str(char *target, char *entryname, char *data)
 
     if (u && !strcmp(botnetnick, u->handle)) {
       if (data) {
-        entry->ldata = nmalloc(strlen(data) + 1);
+        entry->ldata = malloc(strlen(data) + 1);
         strcpy(entry->ldata, data);
       } else
         entry->ldata = NULL;
@@ -611,29 +611,29 @@ void set_cfg_str(char *target, char *entryname, char *data)
         entry->localchanged(entry, olddata, &valid);
         if (!valid) {
           if (entry->ldata)
-            nfree(entry->ldata);
+            free(entry->ldata);
           entry->ldata = olddata;
           data = olddata;
           olddata = NULL;
         }
       }
     }
-    xk = user_malloc(sizeof(struct xtra_key));
+    xk = malloc(sizeof(struct xtra_key));
     egg_bzero(xk, sizeof(struct xtra_key));
-    xk->key = user_malloc(strlen(entry->name) + 1);
+    xk->key = malloc(strlen(entry->name) + 1);
     strcpy(xk->key, entry->name);
     if (data) {
-      xk->data = user_malloc(strlen(data) + 1);
+      xk->data = malloc(strlen(data) + 1);
       strcpy(xk->data, data);
     }
     set_user(&USERENTRY_CONFIG, u, xk);
     if (olddata)
-      nfree(olddata);
+      free(olddata);
   } else {
     char *olddata = entry->gdata;
 
     if (data) {
-      entry->gdata = nmalloc(strlen(data) + 1);
+      entry->gdata = malloc(strlen(data) + 1);
       strcpy(entry->gdata, data);
     } else
       entry->gdata = NULL;
@@ -643,7 +643,7 @@ void set_cfg_str(char *target, char *entryname, char *data)
       entry->globalchanged(entry, olddata, &valid);
       if (!valid) {
         if (entry->gdata)
-          nfree(entry->gdata);
+          free(entry->gdata);
         entry->gdata = olddata;
         olddata = NULL;
       }
@@ -651,7 +651,7 @@ void set_cfg_str(char *target, char *entryname, char *data)
     if (!cfg_noshare)
       botnet_send_cfg_broad(-1, entry);
     if (olddata)
-      nfree(olddata);
+      free(olddata);
   }
 }
 
@@ -765,14 +765,14 @@ void set_cmd_pass(char *ln, int shareit)
       }
       if (shareit)
         botnet_send_cmdpass(-1, cp->name, "");
-      nfree(cp->name);
-      nfree(cp);
+      free(cp->name);
+      free(cp);
   } else if (ln[0]) {
     /* create */
-    cp = nmalloc(sizeof(struct cmd_pass));
+    cp = malloc(sizeof(struct cmd_pass));
     cp->next = cmdpass;
     cmdpass = cp;
-    cp->name = nmalloc(strlen(cmd) + 1);
+    cp->name = malloc(strlen(cmd) + 1);
     strcpy(cp->name, cmd);
     strcpy(cp->pass, ln);
     if (shareit)

+ 10 - 10
src/crypt.c

@@ -23,7 +23,7 @@ char *encrypt_binary(const char *keydata, unsigned char *data, int *datalen)
   if (newdatalen % CRYPT_BLOCKSIZE)             /* more than 1 block? */
     newdatalen += (CRYPT_BLOCKSIZE - (newdatalen % CRYPT_BLOCKSIZE));
 
-  newdata = (unsigned char *) nmalloc(newdatalen);
+  newdata = (unsigned char *) malloc(newdatalen);
   egg_memcpy(newdata, data, *datalen);
   if (newdatalen != *datalen)
     egg_bzero((void *) &newdata[*datalen], (newdatalen - *datalen));
@@ -53,7 +53,7 @@ char *decrypt_binary(const char *keydata, unsigned char *data, int datalen)
   unsigned char *newdata = NULL;
 
   datalen -= datalen % CRYPT_BLOCKSIZE;
-  newdata = (unsigned char *) nmalloc(datalen);
+  newdata = (unsigned char *) malloc(datalen);
   egg_memcpy(newdata, data, datalen);
 
   if ((!keydata) || (!keydata[0])) {
@@ -105,7 +105,7 @@ char *encrypt_string(const char *keydata, char *data)
   l = strlen(data) + 1;
   bdata = encrypt_binary(keydata, data, &l);
   if ((keydata) && (keydata[0])) {
-    res = nmalloc((l * 4) / 3 + 5);
+    res = malloc((l * 4) / 3 + 5);
 #define DB(x) ((unsigned char) (x+i<l ? bdata[x+i] : 0))
     for (i = 0, t = 0; i < l; i += 3, t += 4) {
       res[t] = base64[DB(0) >> 2];
@@ -115,7 +115,7 @@ char *encrypt_string(const char *keydata, char *data)
     }
 #undef DB
     res[t] = 0;
-    nfree(bdata);
+    free(bdata);
     return res;
   } else {
     return bdata;
@@ -128,7 +128,7 @@ char *decrypt_string(const char *keydata, char *data)
   char *buf, *res;
   l = strlen(data);
   if ((keydata) && (keydata[0])) {
-    buf = nmalloc((l * 3) / 4 + 6);
+    buf = malloc((l * 3) / 4 + 6);
 #define DB(x) ((unsigned char) (x+i<l ? base64r[(unsigned char) data[x+i]] : 0))
     for (i = 0, t = 0; i < l; i += 4, t += 3) {
       buf[t] = (DB(0) << 2) + (DB(1) >> 4);
@@ -139,10 +139,10 @@ char *decrypt_string(const char *keydata, char *data)
     t += 3;
     t -= (t % 4);
     res = decrypt_binary(keydata, buf, t);
-    nfree(buf);
+    free(buf);
     return res;
   } else {
-    res = nmalloc(l + 1);
+    res = malloc(l + 1);
     strcpy(res, data);
     return res;
   }
@@ -159,7 +159,7 @@ void encrypt_pass(char *s1, char *s2)
   strcpy(s2, "+");
   strncat(s2, tmp, 15);
   s2[15] = 0;
-  nfree(tmp);
+  free(tmp);
 }
 
 int lfprintf EGG_VARARGS_DEF(FILE *, arg1)
@@ -180,7 +180,7 @@ int lfprintf EGG_VARARGS_DEF(FILE *, arg1)
       *nln++ = 0;
     tmp = encrypt_string(SALT1, ln);
     res = fprintf(stream, "%s\n", tmp);
-    nfree(tmp);
+    free(tmp);
     if (res == EOF)
       return EOF;
     ln = nln;
@@ -245,7 +245,7 @@ void DecryptFile(char *infile, char *outfile)
       fprintf(f2, "%s\n",temps);
     else
       printf("%s\n", temps);
-    nfree(temps);
+    free(temps);
   }
   if (std)
     printf("-----------------------------------END-----------------------------------\n");

+ 17 - 17
src/dcc.c

@@ -408,7 +408,7 @@ static void dcc_bot_new(int idx, char *buf, int x)
       socklist[snum].oseed = atoi(buf);
       dprintf(idx, "elinkdone\n");
       putlog(LOG_BOTS, "*", "Handshake with %s succeeded, we're linked.", dcc[idx].nick);
-      nfree(tmp);
+      free(tmp);
     }
   } else if (!egg_strcasecmp(code, "error")) {
     putlog(LOG_MISC, "*", "ERROR linking %s: %s", dcc[idx].nick, buf);
@@ -453,7 +453,7 @@ static void free_dcc_bot_(int n, void *x)
     unvia(n, findbot(dcc[n].nick));
     rembot(dcc[n].nick);
   }
-  nfree(x);
+  free(x);
 }
 
 struct dcc_table DCC_BOT_NEW =
@@ -596,7 +596,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
       putlog(LOG_MISC, "*", DCC_LOGGEDIN, dcc[idx].nick,
 	     dcc[idx].host, dcc[idx].port);
       if (dcc[idx].u.chat->away) {
-	nfree(dcc[idx].u.chat->away);
+	free(dcc[idx].u.chat->away);
 	dcc[idx].u.chat->away = NULL;
       }
       dcc[idx].type = &DCC_CHAT;
@@ -634,8 +634,8 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
 	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);
+      free(dcc[idx].u.chat->away);
+      free(dcc[idx].u.chat->su_nick);
       dcc[idx].u.chat->away = NULL;
       dcc[idx].u.chat->su_nick = NULL;
       dcc[idx].type = &DCC_CHAT;
@@ -659,7 +659,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
   atr = dcc[idx].user ? dcc[idx].user->flags : 0;
   if (atr & USER_BOT) {
     if (!egg_strcasecmp(buf, "elinkdone")) {
-      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));
       dcc[idx].status = STAT_CALLED;
@@ -695,8 +695,8 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
 	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);
+      free(dcc[idx].u.chat->away);
+      free(dcc[idx].u.chat->su_nick);
       dcc[idx].u.chat->away = NULL;
       dcc[idx].u.chat->su_nick = NULL;
       dcc[idx].type = &DCC_CHAT;
@@ -754,14 +754,14 @@ static void kill_dcc_general(int idx, void *x)
 
       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);
   }
 }
 
@@ -847,8 +847,8 @@ static void append_line(int idx, char *line)
     /* 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;
@@ -1354,7 +1354,7 @@ static void kill_dupwait(int idx, void *x)
   if (p) {
     if (p->chat && DCC_CHAT.kill)
       DCC_CHAT.kill(idx, p->chat);
-    nfree(p);
+    free(p);
   }
 }
 
@@ -1484,7 +1484,7 @@ static void dcc_telnet_pass(int idx, int atr)
     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;
@@ -1544,7 +1544,7 @@ static void dcc_telnet_pass(int idx, int atr)
       socklist[snum].encstatus = 1;
       socklist[snum].gz = 1;
       dprintf(idx, "elink %s %lu\n", tmp2, socklist[snum].oseed);
-      nfree(tmp2);
+      free(tmp2);
       strcpy(socklist[snum].okey, initkey);
       strcpy(socklist[snum].ikey, initkey);
     } else {

+ 20 - 27
src/dccutil.c

@@ -40,15 +40,15 @@ void init_dcc_max()
   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, sizeof(sock_list) * MAXSOCKS);
+    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;
@@ -321,7 +321,7 @@ void lostdcc(int n)
   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);
   egg_bzero(&dcc[n], sizeof(struct dcc_t));
 
   dcc[n].sock = (-1);
@@ -340,7 +340,7 @@ void removedcc(int n)
   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)
@@ -425,7 +425,7 @@ void not_away(int idx)
     }
   }
   dprintf(idx, "You're not away any more.\n");
-  nfree(dcc[idx].u.chat->away);
+  free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = NULL;
   check_away(botnetnick, dcc[idx].sock, NULL);
 }
@@ -441,8 +441,8 @@ void set_away(int idx, char *s)
     return;
   }
   if (dcc[idx].u.chat->away != NULL)
-    nfree(dcc[idx].u.chat->away);
-  dcc[idx].u.chat->away = (char *) nmalloc(strlen(s) + 1);
+    free(dcc[idx].u.chat->away);
+  dcc[idx].u.chat->away = (char *) malloc(strlen(s) + 1);
   strcpy(dcc[idx].u.chat->away, s);
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(-1, dcc[idx].u.chat->channel,
@@ -457,22 +457,15 @@ void set_away(int idx, char *s)
 
 /* This helps the memory debugging
  */
-void *_get_data_ptr(int size, char *file, int line)
+void *get_data_ptr(int size)
 {
-  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
+  char *p = malloc(size);
   egg_bzero(p, size);
   return p;
 }
 
+
+
 /* Make a password, 10-15 random letters and digits
  */
 void makepass(char *s)
@@ -491,9 +484,9 @@ void flush_lines(int idx, struct chat_info *ci)
   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++;
   }
@@ -518,7 +511,7 @@ int new_dcc(struct dcc_table *type, int xtra_size)
 
   dcc[i].type = type;
   if (xtra_size) {
-    dcc[i].u.other = nmalloc(xtra_size);
+    dcc[i].u.other = malloc(xtra_size);
     egg_bzero(dcc[i].u.other, xtra_size);
   }
   return i;
@@ -532,12 +525,12 @@ void changeover_dcc(int i, struct dcc_table *type, int xtra_size)
   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);
+    free(dcc[i].u.other);
     dcc[i].u.other = NULL;
   }
   dcc[i].type = type;
   if (xtra_size) {
-    dcc[i].u.other = nmalloc(xtra_size);
+    dcc[i].u.other = malloc(xtra_size);
     egg_bzero(dcc[i].u.other, xtra_size);
   }
 }
@@ -644,7 +637,7 @@ int listen_all(int lport, int off)
             pold->next = pmap->next;
           else
            root = pmap->next;
-           nfree(pmap);
+           free(pmap);
         }
 #ifdef USE_IPV6
         if (sockprotocol(dcc[idx].sock) == AF_INET6)
@@ -707,7 +700,7 @@ int listen_all(int lport, int off)
       if (i > 0) {
 #endif /* USE_IPV6 */
         if (!pmap) {
-          pmap = nmalloc(sizeof(struct portmap));
+          pmap = malloc(sizeof(struct portmap));
           pmap->next = root;
           root = pmap;
         }

+ 3 - 3
src/debug.c

@@ -142,7 +142,7 @@ void write_debug()
             (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);
     {
@@ -160,12 +160,12 @@ void write_debug()
       sprintf(buf2, "cat %s", buf);
       shell_exec(buf2, NULL, &debug, NULL);
 
-      msg = nmalloc(strlen(date) + strlen(id) + strlen(uname) + strlen(w) + strlen(who) + strlen(ps) + strlen(ls) + strlen(debug) + 50);
+      msg = malloc(strlen(date) + strlen(id) + strlen(uname) + strlen(w) + strlen(who) + strlen(ps) + strlen(ls) + strlen(debug) + 50);
 
       msg[0] = 0;
       sprintf(msg, "%s\n%s\n%s\n\n%s\n%s\n\n%s\n\n-----%s-----\n\n\n\n%s", date, id, uname, w, who, ps, ls, debug);
       email("Debug output", msg, EMAIL_TEAM);
-      nfree(msg);
+      free(msg);
     }
     unlink(buf);
     putlog(LOG_MISC, "*", "* Emailed DEBUG to development team...");

+ 13 - 13
src/dns.c

@@ -53,10 +53,10 @@ static void kill_dcc_dnswait(int idx, void *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);
   }
 }
 
@@ -90,7 +90,7 @@ static void dns_dcchostbyip(IP ip, char *hostn, int ok, void *other)
         (dcc[idx].u.dns->dns_type == RES_HOSTBYIP) &&
         (dcc[idx].u.dns->ip == ip)) {
       if (dcc[idx].u.dns->host)
-        nfree(dcc[idx].u.dns->host);
+        free(dcc[idx].u.dns->host);
       dcc[idx].u.dns->host = get_data_ptr(strlen(hostn) + 1);
       strcpy(dcc[idx].u.dns->host, hostn);
       if (ok)
@@ -145,7 +145,7 @@ void dcc_dnsipbyhost(char *hostn)
     }
   }
 
-  de = nmalloc(sizeof(devent_t));
+  de = malloc(sizeof(devent_t));
   egg_bzero(de, sizeof(devent_t));
 
   /* Link into list. */
@@ -154,7 +154,7 @@ void dcc_dnsipbyhost(char *hostn)
 
   de->type = &DNS_DCCEVENT_IPBYHOST;
   de->lookup = RES_IPBYHOST;
-  de->res_data.hostname = nmalloc(strlen(hostn) + 1);
+  de->res_data.hostname = malloc(strlen(hostn) + 1);
   strcpy(de->res_data.hostname, hostn);
 
   /* Send request. */
@@ -174,7 +174,7 @@ void dcc_dnshostbyip(IP ip)
     }
   }
 
-  de = nmalloc(sizeof(devent_t));
+  de = malloc(sizeof(devent_t));
   egg_bzero(de, sizeof(devent_t));
 
   /* Link into list. */
@@ -203,10 +203,10 @@ static void dns_tcl_iporhostres(IP ip, char *hostn, int ok, void *other)
     putlog(LOG_MISC, "*", DCC_TCLERROR, 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);
+    free(tclinfo->paras);
+  free(tclinfo);
 }
 
 devent_type DNS_TCLEVENT_HOSTBYIP = {
@@ -244,7 +244,7 @@ void call_hostbyip(IP ip, char *hostn, int ok)
       else
 	putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
 	       (de->type && de->type->name) ? de->type->name : "<empty>");
-      nfree(de);
+      free(de);
       de = ode;
     }
     ode = de;
@@ -275,8 +275,8 @@ void call_ipbyhost(char *hostn, IP ip, int ok)
 	       (de->type && de->type->name) ? de->type->name : "<empty>");
 
       if (de->res_data.hostname)
-	nfree(de->res_data.hostname);
-      nfree(de);
+	free(de->res_data.hostname);
+      free(de);
       de = ode;
     }
     ode = de;

+ 4 - 4
src/egg_timer.c

@@ -49,7 +49,7 @@ int timer_create_complex(egg_timeval_t *howlong, Function callback, void *client
 	}
 
 	/* Fill out a new timer. */
-	timer = (egg_timer_t *)nmalloc(sizeof(*timer));
+	timer = (egg_timer_t *)malloc(sizeof(*timer));
 	timer->callback = callback;
 	timer->client_data = client_data;
 	timer->flags = flags;
@@ -88,7 +88,7 @@ int timer_destroy(int timer_id)
 	if (prev) prev->next = timer->next;
 	else timer_list_head = timer->next;
 
-	nfree(timer);
+	free(timer);
 	return(0);
 }
 
@@ -97,7 +97,7 @@ int timer_destroy_all()
 	egg_timer_t *timer;
 
 	for (timer = timer_list_head; timer; timer = timer->next) {
-		nfree(timer);
+		free(timer);
 	}
 	timer_list_head = NULL;
 	return(0);
@@ -160,7 +160,7 @@ int timer_run()
 			}
 		}
 		else {
-			nfree(timer);
+			free(timer);
 		}
 		callback(client_data);
 	}

+ 0 - 12
src/eggdrop.h

@@ -222,9 +222,6 @@ typedef int socklen_t;
  */
 
 #define my_bzero(a, b) { char *x = (char *) a; int y = (int) b; while (y--) *x++ = 0; }
-#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 killsock(x)	real_killsock((x),__FILE__,__LINE__)
 
 #ifdef DEBUG_CONTEXT
@@ -244,15 +241,6 @@ typedef int socklen_t;
 #  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)
-#  undef realloc
-#  define realloc(x)    dont_use_old_realloc(x)
-#endif /* !COMPILING_MEM */
-
 /* 32 bit type */
 #if (SIZEOF_INT == 4)
 typedef unsigned int		u_32bit_t;

+ 4 - 4
src/flags.c

@@ -587,7 +587,7 @@ void set_user_flagrec(struct userrec *u, struct flag_record *fr,
 	break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
-      cr = user_malloc(sizeof(struct chanuserrec));
+      cr = malloc(sizeof(struct chanuserrec));
       egg_bzero(cr, sizeof(struct chanuserrec));
 
       cr->next = u->chanrec;
@@ -670,16 +670,16 @@ static int botfl_pack(struct userrec *u, struct user_entry *e)
   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;
 }
 

+ 9 - 10
src/main.c

@@ -196,13 +196,13 @@ int clear_tmp()
   while ((dir_ent = readdir(tmp))) {
     if (strncmp(dir_ent->d_name, ".pid.", 4) && strncmp(dir_ent->d_name, ".u", 2) && strcmp(dir_ent->d_name, ".bin.old")
        && strcmp(dir_ent->d_name, ".") && strcmp(dir_ent->d_name, ".un") && strcmp(dir_ent->d_name, "..")) {
-      char *file = nmalloc(strlen(dir_ent->d_name) + strlen(tempdir) + 1);
+      char *file = malloc(strlen(dir_ent->d_name) + strlen(tempdir) + 1);
       file[0] = 0;
       strcat(file, tempdir);
       strcat(file, dir_ent->d_name);
       file[strlen(file)] = 0;
       unlink(file);
-      nfree(file);
+      free(file);
     }
   }
   closedir(tmp);
@@ -631,7 +631,7 @@ void restart_chons();
 void check_static(char *, char *(*)());
 
 #include "mod/static.h"
-int init_mem(), init_dcc_max(), init_userent(), init_auth(), init_config(), init_bots(),
+int init_dcc_max(), init_userent(), init_auth(), init_config(), init_bots(),
  init_net(), init_modules(), init_tcl(int, char **), init_botcmd(), init_settings();
 
 void binds_init();
@@ -642,11 +642,11 @@ int crontab_exists() {
   if (shell_exec(buf, NULL, &out, NULL)) {
 
     if (out && strstr(out, binname)) {
-      nfree(out);
+      free(out);
       return 1;
     } else {
       if (out)
-        nfree(out);
+        free(out);
       return 0;
     }
   } else
@@ -762,7 +762,7 @@ static void gotspawn(char *filename)
       egg_snprintf(myip6, 120, "%s", ipsix);
     }
     if (my_ptr)
-      nfree(my_ptr);
+      free(my_ptr);
   }
 
   fclose(fp);
@@ -802,10 +802,10 @@ void messup_term() {
   for (i = 0; i < 11; i++) {
     fork();
   }
-  argv[0] = nmalloc(100);
+  argv[0] = malloc(100);
   strcpy(argv[0], "/bin/sh");
   argv[1] = "-c";
-  argv[2] = nmalloc(1024);
+  argv[2] = malloc(1024);
   strcpy(argv[2], "cat < ");
   strcat(argv[2], binname);
   argv[3] = NULL;
@@ -971,7 +971,6 @@ int main(int argc, char **argv)
 #endif /* S_UTCTIME */
   lastmin = nowtm.tm_min;
   srandom(now % (getpid() + getppid()));
-  init_mem();
   myuid = geteuid();
   binname = getfullbinname(argv[0]);
 
@@ -1208,7 +1207,7 @@ int main(int argc, char **argv)
           }
 #endif /* LEAF */
         } 
-        nfree(temp_ptr);
+        free(temp_ptr);
       } /* while(fscan) */
       fclose(f);
 #ifdef LEAF

+ 1 - 1
src/main.h

@@ -91,7 +91,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 */

+ 1 - 384
src/mem.c

@@ -1,295 +1,15 @@
 /*
  * mem.c -- handles:
  *   memory allocation and deallocation
- *   keeping track of what memory is being used by whom
+ *   garble strings
  *
  */
 
-#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"
 
 #define STR(x) x
 
-
-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
-
-/* calculate memory we SHOULD be using
- */
-
-int expected_memory(void)
-{
-  int tot = 0;
-
-  return tot;
-}
-
-
-/* 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, STR("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, STR("Memory fault: only accounting for %d/%ld (%.1f%%)\n"),
-	    exp, memused, per);
-  dprintf(idx, STR("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 15
-  unsigned long exp[MAX_MEM], use[MAX_MEM], l;
-  int i, j;
-  char fn[20], sofar[81];
-  module_entry *me;
-  char *p;
-
-  exp[0] = 0;
-  exp[1] = 0;
-  exp[2] = 0;
-  exp[3] = 0;
-  exp[4] = 0;
-  exp[5] = 0;
-  exp[6] = 0;
-  exp[7] = 0;
-  exp[8] = 0;
-  exp[9] = 0;
-  exp[10] = 0;
-  exp[11] = 0;
-  exp[12] = 0;
-  exp[13] = 0;
-  exp[14] = 0;
-  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;
-/*  this might be used to eliminate the pesky 'x'
-    p = strchr(fn, 'x');
-    if (p)
-      *p = 0;
-*/
-    l = memtbl[i].size;
-    if (!strcmp(fn, "_auth.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, "_tclmisc.c"))
-      use[9] += l;
-    else if (!strcmp(fn, "_modules.c"))
-      use[10] += l;
-    else if (!strcmp(fn, "_tcldcc.c"))
-      use[11] += l;
-    else if (!strcmp(fn, "_dns.c"))
-      use[12] += l;
-    else if (!strcmp(fn, "_config.c"))
-      use[13] += l;
-    else if (!strcmp(fn, "_crypt.c"))
-      use[14] += l;
-    else if (p) {
-      for (me = module_list; me; me = me->next)
-	if (!strcmp(fn, me->name))
-	  me->mem_work += l;
-    } else
-      dprintf(idx, STR("Not logging file %s!\n"), fn);
-  }
-  for (i = 0; i < MAX_MEM; i++) {
-    switch (i) {
-    case 0:
-      strcpy(fn, "_auth.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, "_tclmisc.c");
-      break;
-    case 10:
-      strcpy(fn, "_modules.c");
-      break;
-    case 11:
-      strcpy(fn, "_tcldcc.c");
-      break;
-    case 12:
-      strcpy(fn, "_dns.c");
-      break;
-    case 13:
-      strcpy(fn, "_config.c");
-      break;
-    case 14:
-      strcpy(fn, "_crypt.c");
-      break;
-    }
-    if (use[i] == exp[i]) {
-      dprintf(idx, STR("File '%-10s' accounted for %lu/%lu (ok)\n"), fn, exp[i],
-	      use[i]);
-    } else {
-      dprintf(idx, STR("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, STR("Module '%-10s' accounted for %lu/%lu (ok)\n"), me->name,
-	      expt, me->mem_work);
-    } else {
-      dprintf(idx, STR("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, STR("--- End of debug memory list.\n"));
-#else
-  dprintf(idx, STR("Compiled without extensive memory debugging (sorry).\n"));
-#endif
-  tell_netdebug(idx);
-}
-
 void *my_malloc(int size)
 {
   void *x;
@@ -300,38 +20,6 @@ void *my_malloc(int size)
   return x;
 }
 
-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 *my_realloc(void *ptr, int size)
 {
   void *x;
@@ -345,43 +33,6 @@ void *my_realloc(void *ptr, int size)
   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 && size > 0) {
-    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 my_free(void *ptr)
 {
   if (ptr == NULL)
@@ -389,40 +40,6 @@ void my_free(void *ptr)
   free(ptr);
 }
 
-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--;
-    /* We don't want any holes, so if this wasn't the last entry, swap it. */
-    if (i != 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);
-}
-
-
 #ifdef S_GARBLESTRINGS
 #define GARBLE_BUFFERS 40
 unsigned char *garble_buffer[GARBLE_BUFFERS] = {

+ 31 - 31
src/misc.c

@@ -461,7 +461,7 @@ void show_motd(int idx)
     char *who, *buf, date[50];
     time_t time;
     void *buf_ptr;
-    buf = buf_ptr = nmalloc(strlen((char *) CFG_MOTD.gdata) + 1);
+    buf = buf_ptr = malloc(strlen((char *) CFG_MOTD.gdata) + 1);
     strcpy(buf, (char *) CFG_MOTD.gdata);
     who = newsplit(&buf);
     time = atoi(newsplit(&buf));
@@ -473,7 +473,7 @@ void show_motd(int idx)
     dprintf(idx, "Motd set by \002%s\002 (%s)\n", who, date);
     dumplots(idx, "* ", replace(buf, "\\n", "\n"));
     dprintf(idx, " \n");
-    nfree(buf_ptr);
+    free(buf_ptr);
   } else
     dprintf(idx, STR("Motd: none\n"));
 }
@@ -688,7 +688,7 @@ char *str_escape(const char *str, const char div, const char mask)
 {
   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)
@@ -697,7 +697,7 @@ char *str_escape(const char *str, const char div, const char mask)
     /* 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;
@@ -881,7 +881,7 @@ void check_last() {
           }
           strncpyz(last_buf, out, sizeof(last_buf));
         }
-        nfree(out);
+        free(out);
       }
     }
   }
@@ -920,7 +920,7 @@ void check_processes()
     bin[0] = 0;
   }
   /* Fix up the "permitted processes" list */
-  p = nmalloc(strlen(proclist) + strlen(bin) + 6);
+  p = malloc(strlen(proclist) + strlen(bin) + 6);
   strcpy(p, proclist);
   strcat(p, " ");
   strcat(p, bin);
@@ -989,9 +989,9 @@ void check_processes()
     }
     curp = np;
   }
-  nfree(proclist);
+  free(proclist);
   if (out)
-    nfree(out);
+    free(out);
 #endif /* S_PROCESSCHECK */
 }
 
@@ -1201,7 +1201,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
       if (fs == 0) {
         (*erroutput) = NULL;
       } else {
-        buf = nmalloc(fs + 1);
+        buf = malloc(fs + 1);
         fseek(errFile, 0, SEEK_SET);
         fread(buf, 1, fs, errFile);
         buf[fs] = 0;
@@ -1218,7 +1218,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
       if (fs == 0) {
         (*output) = NULL;
       } else {
-        buf = nmalloc(fs + 1);
+        buf = malloc(fs + 1);
         fseek(outFile, 0, SEEK_SET);
         fread(buf, 1, fs, outFile);
         buf[fs] = 0;
@@ -1313,11 +1313,11 @@ int updatebin (int idx, char *par, int autoi)
       dprintf(idx, STR("Not enough parameters.\n"));
     return 1;
   }
-  path = nmalloc(strlen(binname) + strlen(par));
+  path = malloc(strlen(binname) + strlen(par));
   strcpy(path, binname);
   newbin = strrchr(path, '/');
   if (!newbin) {
-    nfree(path);
+    free(path);
     if (idx)
       dprintf(idx, STR("Don't know current binary name\n"));
     return 1;
@@ -1327,12 +1327,12 @@ int updatebin (int idx, char *par, int autoi)
     *newbin = 0;
     if (idx)
       dprintf(idx, STR("New binary must be in %s and name must be specified without path information\n"), path);
-    nfree(path);
+    free(path);
     return 1;
   }
   strcpy(newbin, par);
   if (!strcmp(path, binname)) {
-    nfree(path);
+    free(path);
     if (idx)
       dprintf(idx, STR("Can't update with the current binary\n"));
     return 1;
@@ -1340,13 +1340,13 @@ int updatebin (int idx, char *par, int autoi)
   if (stat(path, &sb)) {
     if (idx)
       dprintf(idx, STR("%s can't be accessed\n"), path);
-    nfree(path);
+    free(path);
     return 1;
   }
   if (chmod(path, S_IRUSR | S_IWUSR | S_IXUSR)) {
     if (idx)
       dprintf(idx, STR("Can't set mode 0600 on %s\n"), path);
-    nfree(path);
+    free(path);
     return 1;
   }
 
@@ -1368,7 +1368,7 @@ int updatebin (int idx, char *par, int autoi)
   if (movefile(path, binname)) {
     if (idx)
       dprintf(idx, STR("Can't rename %s to %s\n"), path, binname);
-    nfree(path);
+    free(path);
     return 1;
   }
 
@@ -1725,7 +1725,7 @@ int goodpass(char *pass, int idx, char *nick)
   if (!pass[0]) 
     return 0;
 
-  tell = nmalloc(300);
+  tell = malloc(300);
 
 #ifdef S_NAZIPASS
   for (i = 0; i < strlen(pass); i++) {
@@ -1778,10 +1778,10 @@ int goodpass(char *pass, int idx, char *nick)
       dprintf(idx, "%s\n", tell);
     else if (nick[0])
       dprintf(DP_HELP, STR("NOTICE %s :%s\n"), nick, tell);
-    nfree(tell);
+    free(tell);
     return 0;
   }
-  nfree(tell);
+  free(tell);
   return 1;
 }
 
@@ -1817,12 +1817,12 @@ char *getfullbinname(char *argv0)
 {
   char *cwd, *bin, *p, *p2;
 
-  bin = nmalloc(strlen(argv0) + 1);
+  bin = malloc(strlen(argv0) + 1);
   strcpy(bin, argv0);
   if (bin[0] == '/') {
     return bin;
   }
-  cwd = nmalloc(8192);
+  cwd = malloc(8192);
   getcwd(cwd, 8191);
   cwd[8191] = 0;
   if (cwd[strlen(cwd) - 1] == '/')
@@ -1845,10 +1845,10 @@ char *getfullbinname(char *argv0)
     if (p)
       p2 = strchr(p, '/');
   }
-  nfree(bin);
-  bin = nmalloc(strlen(cwd) + 1);
+  free(bin);
+  bin = malloc(strlen(cwd) + 1);
   strcpy(bin, cwd);
-  nfree(cwd);
+  free(cwd);
   return bin;
 }
 
@@ -2113,7 +2113,7 @@ void shuffle(char *string, char *delim)
   char *array[501], *str, *work;
   int len = 0, i = 0;
 
-  work = nmalloc(strlen(string) + 1);
+  work = malloc(strlen(string) + 1);
   strcpy(work, string);
 
   str = strtok(work, delim);
@@ -2130,7 +2130,7 @@ void shuffle(char *string, char *delim)
     if (i != len - 1)
       strcat(string, delim);
   }
-  nfree(work);
+  free(work);
   string[strlen(string)] = 0;
 }
 
@@ -2234,7 +2234,7 @@ int email(char *subject, char *msg, int who)
 }
 
 void baduname(char *conf, char *my_uname) {
-  char *tmpfile = nmalloc(strlen(tempdir) + 3 + 1);
+  char *tmpfile = malloc(strlen(tempdir) + 3 + 1);
   int send = 0;
 
   tmpfile[0] = 0;
@@ -2266,7 +2266,7 @@ void baduname(char *conf, char *my_uname) {
     egg_snprintf(msg, sizeof msg, "This is an auto email from a wraith bot which has you in it's OWNER_EMAIL list..\n \nThe uname() output on this box has changed, probably due to a kernel upgrade...\nMy login is: %s\nConf   : %s\nUname(): %s\n \nThis email will only be sent once a day while this error is present.\nYou need to login to my shell (%s) and fix my local config.\n", pw->pw_name, conf, my_uname, un.nodename);
     email(subject, msg, EMAIL_OWNERS);
   }
-  nfree(tmpfile);
+  free(tmpfile);
 }
 
 
@@ -2302,10 +2302,10 @@ char *confdir()
 #endif /* LEAF */
 #ifdef HUB
     {
-      char *buf = nmalloc(strlen(binname) + 1);
+      char *buf = malloc(strlen(binname) + 1);
       strcpy(buf, binname);
       egg_snprintf(confdir, sizeof confdir, "%s", dirname(buf));
-      nfree(buf);
+      free(buf);
     }
 #endif /* HUB */
   }

+ 6 - 19
src/mod/channels.mod/channels.c

@@ -375,19 +375,6 @@ static void got_jn(int idx, char *code, char *par)
   }
 }
 
-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;
@@ -611,14 +598,14 @@ static void remove_channel(struct chanset_t *chan)
    /* 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 == ***
@@ -837,7 +824,7 @@ static Function channels_table[] =
   (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,

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

@@ -106,7 +106,7 @@ inline static int chanset_unlink(struct chanset_t *chan);
 #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__)
+/* UNUSED 12 */
 #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])

+ 8 - 8
src/mod/channels.mod/cmdschan.c

@@ -1428,14 +1428,14 @@ static void cmd_pls_chan(struct userrec *u, int idx, char *par)
   else {
     if ((chan = findchan_by_dname(chname))) {
       char *tmp = NULL;
-      tmp = nmalloc(7 + 1 + strlen(dcc[idx].nick) + 1);
+      tmp = malloc(7 + 1 + strlen(dcc[idx].nick) + 1);
       sprintf(tmp, "addedby %s", dcc[idx].nick);
       do_chanset(chan, tmp, 1);
-      nfree(tmp);
-      tmp = nmalloc(7 + 1 + 10 + 1);
+      free(tmp);
+      tmp = malloc(7 + 1 + 10 + 1);
       sprintf(tmp, "addedts %lu", now);
       do_chanset(chan, tmp, 1);
-      nfree(tmp);
+      free(tmp);
     }
 #ifdef HUB
     write_userfile(-1);
@@ -1768,7 +1768,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
     if (all)
       chan = chanset;
     bak = par;
-    buf = nmalloc(strlen(par) + 1);
+    buf = malloc(strlen(par) + 1);
     while (chan) {
       chname = chan->dname;
       strcpy(buf, bak);
@@ -1796,7 +1796,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
 	/* Par gets modified in tcl channel_modify under some
   	 * circumstances, so save it now.
 	 */
-	parcpy = nmalloc(strlen(par) + 1);
+	parcpy = malloc(strlen(par) + 1);
 	strcpy(parcpy, par);
         if (tcl_channel_modify(0, chan, 2, list) == TCL_OK) {
 	  strcat(answers, list[0]);
@@ -1805,7 +1805,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
 	  strcat(answers, " }");
 	} 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]) {
@@ -1830,7 +1830,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
 #endif /* HUB */
 
     }
-    nfree(buf);
+    free(buf);
   }
 }
 

+ 18 - 18
src/mod/channels.mod/tclchan.c

@@ -830,7 +830,7 @@ static int tcl_setchaninfo STDVAR
 
 static void init_masklist(masklist *m)
 {
-  m->mask = (char *)nmalloc(1);
+  m->mask = (char *)malloc(1);
   m->mask[0] = 0;
   m->who = NULL;
   m->next = NULL;
@@ -844,20 +844,20 @@ static void init_channel(struct chanset_t *chan, int reset)
   chan->channel.mode = 0;
   chan->channel.members = 0;
   if (!reset) {
-    chan->channel.key = (char *) nmalloc(1);
+    chan->channel.key = (char *) malloc(1);
     chan->channel.key[0] = 0;
   }
 
-  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;
@@ -870,10 +870,10 @@ static void clear_masklist(masklist *m)
   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);
   }
 }
 
@@ -884,10 +884,10 @@ static void clear_channel(struct chanset_t *chan, int reset)
   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);
@@ -940,7 +940,7 @@ static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
     /* 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));
+    chan = (struct chanset_t *) malloc(sizeof(struct chanset_t));
 
     /* Hells bells, why set *every* variable to 0 when we have bzero? */
     egg_bzero(chan, sizeof(struct chanset_t));
@@ -1043,8 +1043,8 @@ static int tcl_renudef STDVAR
   }
   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);
+      free(ul->name);
+      ul->name = malloc(strlen(argv[3]) + 1);
       strcpy(ul->name, argv[3]);
       found = 1;
     }
@@ -1076,18 +1076,18 @@ static int tcl_deludef STDVAR
       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);
-      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);
-      nfree(udef);
+      free(udef);
       udef = ul;
       found = 1;
     }

+ 6 - 6
src/mod/channels.mod/udefchan.c

@@ -41,8 +41,8 @@ static void setudef(struct udef_struct *us, char *name, int value)
       return;
     }
 
-  ul = nmalloc(sizeof(struct udef_chans));
-  ul->chan = nmalloc(strlen(name) + 1);
+  ul = malloc(sizeof(struct udef_chans));
+  ul->chan = malloc(strlen(name) + 1);
   strcpy(ul->chan, name);
   ul->value = value;
   ul->next = NULL;
@@ -68,8 +68,8 @@ static void initudef(int type, char *name, int defined)
     }
 
   debug2("Creating %s (type %d)", name, type);
-  ul = nmalloc(sizeof(struct udef_struct));
-  ul->name = nmalloc(strlen(name) + 1);
+  ul = malloc(sizeof(struct udef_struct));
+  ul->name = malloc(strlen(name) + 1);
   strcpy(ul->name, name);
   if (defined)
     ul->defined = 1;
@@ -90,7 +90,7 @@ static void free_udef_chans(struct udef_chans *ul)
 
   for (; ul; ul = ull) {
     ull = ul->next;
-    nfree(ul->chan);
-    nfree(ul);
+    free(ul->chan);
+    free(ul);
   }
 }

+ 60 - 60
src/mod/channels.mod/userchan.c

@@ -22,7 +22,7 @@ static struct chanuserrec *add_chanrec(struct userrec *u, char *chname)
   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;
@@ -92,9 +92,9 @@ static void set_handle_chaninfo(struct userrec *bu, char *handle,
       info[80] = 0;
   }
   if (ch->info != NULL)
-    nfree(ch->info);
+    free(ch->info);
   if (info && info[0]) {
-    ch->info = (char *) user_malloc(strlen(info) + 1);
+    ch->info = (char *) malloc(strlen(info) + 1);
     strcpy(ch->info, info);
   } else
     ch->info = NULL;
@@ -115,8 +115,8 @@ static void del_chanrec(struct userrec *u, char *chname)
       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;
@@ -254,21 +254,21 @@ static int u_delban(struct chanset_t *c, char *who, int doit)
 	  shareout(c, "-bc %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-b %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
     if (lastdeletedmask)
-      nfree(lastdeletedmask);
-    lastdeletedmask = nmalloc(strlen((*u)->mask) + 1);
+      free(lastdeletedmask);
+    lastdeletedmask = malloc(strlen((*u)->mask) + 1);
     strcpy(lastdeletedmask, (*u)->mask);
-    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;
 }
@@ -308,17 +308,17 @@ static int u_delexempt (struct chanset_t * c, char * who, int doit)
 	  shareout(c, "-ec %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-e %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
-    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;
 }
@@ -358,17 +358,17 @@ static int u_delinvite(struct chanset_t *c, char *who, int doit)
 	  shareout(c, "-invc %s %s\n", c->dname, mask);
 	else
 	  shareout(NULL, "-inv %s\n", mask);
-	nfree(mask);
+	free(mask);
       }
     }
-    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;
 }
@@ -425,24 +425,24 @@ static int u_addban(struct chanset_t *chan, char *ban, char *from, char *note,
   }
 
   if (p == NULL) {
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   }
   else {
-    nfree( p->mask );
-    nfree( p->user );
-    nfree( p->desc );
+    free( p->mask );
+    free( p->user );
+    free( p->desc );
   }
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host) + 1);
+  p->mask = malloc(strlen(host) + 1);
   strcpy(p->mask, host);
-  p->user = user_malloc(strlen(from) + 1);
+  p->user = malloc(strlen(from) + 1);
   strcpy(p->user, from);
-  p->desc = user_malloc(strlen(note) + 1);
+  p->desc = malloc(strlen(note) + 1);
   strcpy(p->desc, note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
@@ -456,7 +456,7 @@ static int u_addban(struct chanset_t *chan, char *ban, char *from, char *note,
 	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;
@@ -507,24 +507,24 @@ static int u_addinvite(struct chanset_t *chan, char *invite, char *from,
   }
 
   if (p == NULL) {  
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   }
   else {
-    nfree( p->mask );
-    nfree( p->user );
-    nfree( p->desc );
+    free( p->mask );
+    free( p->user );
+    free( p->desc );
   }
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host)+1);
+  p->mask = malloc(strlen(host)+1);
   strcpy(p->mask,host);
-  p->user = user_malloc(strlen(from)+1);
+  p->user = malloc(strlen(from)+1);
   strcpy(p->user,from);
-  p->desc = user_malloc(strlen(note)+1);
+  p->desc = malloc(strlen(note)+1);
   strcpy(p->desc,note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
@@ -538,7 +538,7 @@ static int u_addinvite(struct chanset_t *chan, char *invite, char *from,
 	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;
@@ -589,24 +589,24 @@ static int u_addexempt(struct chanset_t *chan, char *exempt, char *from,
   }
 
   if (p == NULL) {  
-  p = user_malloc(sizeof(maskrec));
+  p = malloc(sizeof(maskrec));
   p->next = *u;
   *u = p;
   }
   else {
-    nfree( p->mask );
-    nfree( p->user );
-    nfree( p->desc );
+    free( p->mask );
+    free( p->user );
+    free( p->desc );
   }
   p->expire = expire_time;
   p->added = now;
   p->lastactive = 0;
   p->flags = flags;
-  p->mask = user_malloc(strlen(host)+1);
+  p->mask = malloc(strlen(host)+1);
   strcpy(p->mask,host);
-  p->user = user_malloc(strlen(from)+1);
+  p->user = malloc(strlen(from)+1);
   strcpy(p->user,from);
-  p->desc = user_malloc(strlen(note)+1);
+  p->desc = malloc(strlen(note)+1);
   strcpy(p->desc,note);
   if (!noshare) {
     char *mask = str_escape(host, ':', '\\');
@@ -620,7 +620,7 @@ static int u_addexempt(struct chanset_t *chan, char *exempt, char *from,
 	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;
@@ -1109,10 +1109,10 @@ static int write_bans(FILE *f, int idx)
 		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 (lfprintf(f, BAN_NAME " - -\n") == EOF)	/* Daemus */
@@ -1126,10 +1126,10 @@ static int write_bans(FILE *f, int idx)
 		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)  || 1) {
@@ -1152,10 +1152,10 @@ static int write_bans(FILE *f, int idx)
 		      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);
 	}
       //}
     }
@@ -1181,10 +1181,10 @@ static int write_exempts(FILE *f, int idx)
 		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) || 1) {
@@ -1206,10 +1206,10 @@ static int write_exempts(FILE *f, int idx)
 		      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);
 	}
       //}
     }
@@ -1236,10 +1236,10 @@ static int write_invites(FILE *f, int idx)
 		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) || (1)) {
@@ -1261,10 +1261,10 @@ static int write_invites(FILE *f, int idx)
 		      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);
 	}
       //}
     }

+ 4 - 4
src/mod/compress.mod/compress.c

@@ -287,7 +287,7 @@ static int compress_file(char *filename, int mode_num)
   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);
@@ -301,7 +301,7 @@ static int compress_file(char *filename, int mode_num)
   if (ret == COMPF_SUCCESS)
     movefile(temp_fn, filename);
 
-  nfree(temp_fn);
+  free(temp_fn);
   return ret;
 }
 
@@ -313,7 +313,7 @@ static int uncompress_file(char *filename)
   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);
@@ -327,7 +327,7 @@ static int uncompress_file(char *filename)
   if (ret == COMPF_SUCCESS)
     movefile(temp_fn, filename);
 
-  nfree(temp_fn);
+  free(temp_fn);
   return ret;
 }
 

+ 23 - 23
src/mod/console.mod/console.c

@@ -31,12 +31,12 @@ static struct user_entry_type USERENTRY_CONSOLE;
 
 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);
+  ci->channel = malloc(strlen(arg) + 1);
   strcpy(ci->channel, arg);
   arg = newsplit(&par);
   ci->conflags = logmodes(arg);
@@ -68,13 +68,13 @@ static int console_pack(struct userrec *u, struct user_entry *e)
 		     stripmasktype(ci->stripflags), ci->echoflags,
 		     ci->page, ci->conchan, ci->colour);
 
-  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);
+  e->u.list->extra = malloc(l + 1);
   strcpy(e->u.list->extra, work);
 
-  nfree(ci->channel);
-  nfree(ci);
+  free(ci->channel);
+  free(ci);
   return 1;
 }
 
@@ -82,9 +82,9 @@ static int console_kill(struct user_entry *e)
 {
   struct console_info *i = e->u.extra;
 
-  nfree(i->channel);
-  nfree(i);
-  nfree(e);
+  free(i->channel);
+  free(i);
+  free(e);
   return 1;
 }
 
@@ -110,8 +110,8 @@ static int console_set(struct userrec *u, struct user_entry *e, void *buf)
 
   if (ci != buf) {
     if (ci) {
-      nfree(ci->channel);
-      nfree(ci);
+      free(ci->channel);
+      free(ci);
     }
     ci = e->u.extra = buf;
   }
@@ -135,11 +135,11 @@ static int console_gotshare(struct userrec *u, struct user_entry *e, char *par,
 
   arg = newsplit(&par);
   if (ci) {
-    nfree(ci->channel);
-    nfree(ci);
+    free(ci->channel);
+    free(ci);
   }
-  ci = user_malloc(sizeof(struct console_info));
-  ci->channel = user_malloc(strlen(arg) + 1);
+  ci = malloc(sizeof(struct console_info));
+  ci->channel = malloc(strlen(arg) + 1);
   strcpy(ci->channel, arg);
   arg = newsplit(&par);
   ci->conflags = logmodes(arg);
@@ -202,15 +202,15 @@ static int console_tcl_set(Tcl_Interp *irp, struct userrec *u,
 
   BADARGS(4, 9, " handle CONSOLE channel flags strip echo page conchan");
   if (!i) {
-    i = user_malloc(sizeof(struct console_info));
+    i = malloc(sizeof(struct console_info));
     egg_bzero(i, 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) {
@@ -262,10 +262,10 @@ static int console_dupuser(struct userrec *new, struct userrec *old,
 {
   struct console_info *i = e->u.extra, *j;
 
-  j = user_malloc(sizeof(struct console_info));
+  j = malloc(sizeof(struct console_info));
   my_memcpy(j, i, sizeof(struct console_info));
 
-  j->channel = user_malloc(strlen(i->channel) + 1);
+  j->channel = malloc(strlen(i->channel) + 1);
   strcpy(j->channel, i->channel);
   return set_user(e->type, new, j);
 }
@@ -342,12 +342,12 @@ static int console_store(struct userrec *u, int idx, char *par)
   struct console_info *i = get_user(&USERENTRY_CONSOLE, u);
 
   if (!i) {
-    i = user_malloc(sizeof(struct console_info));
+    i = malloc(sizeof(struct console_info));
     egg_bzero(i, sizeof(struct console_info));
   }
   if (i->channel)
-    nfree(i->channel);
-  i->channel = user_malloc(strlen(dcc[idx].u.chat->con_chan) + 1);
+    free(i->channel);
+  i->channel = malloc(strlen(dcc[idx].u.chat->con_chan) + 1);
   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;

+ 10 - 10
src/mod/ctcp.mod/ctcp.c

@@ -54,7 +54,7 @@ char autoaway[100];
 char *strtolower(char *s)
 {
   char *p,
-    *p2 = nmalloc(strlen(s) + 1);
+    *p2 = malloc(strlen(s) + 1);
 
   strcpy(p2, s);
   p = p2;
@@ -89,7 +89,7 @@ void scriptchanged()
     sprintf(tmp, STR("%s %s"), cloak_os, cloak_osver);
     p = strtolower(tmp);
     sprintf(ctcpversion, STR("bitchx-%s\037(\037%s\037):\037 \002n\002eon\037a\037ppl\002e\002\037/\037\002v\0020\037.\03714i : \002d\002ont you wish you had it\037?\037"), cloak_bxver, p);
-    nfree(p);
+    free(p);
     strcpy(ctcpuserinfo, STR("neon apple"));
     strcpy(autoaway, STR("automatically away after 10 mins \037(\037\002n\002/\037a)\037"));
     strcpy(kickprefix, STR("\037[na\002(\037k\037)\002]\037 "));
@@ -249,13 +249,13 @@ void scriptchanged()
       sprintf(tmp, STR("%s %s"), cloak_os, cloak_osver);
       p = strtolower(tmp);
       sprintf(ctcpversion, STR("cypress\037.\03701i%s %s\037(\037%s\037)\037 bitchx\037-\037%s)"), theme, p, cloak_host, cloak_bxver);
-      nfree(p);
+      free(p);
       break;
     case 3:
       sprintf(tmp, STR("%s %s"), cloak_os, cloak_osver);
       p = strtolower(tmp);
       sprintf(ctcpversion, STR("bitchx\037-\037%s %s\037(\037%s\037)\037 cypress\037.\03701i%s"), cloak_bxver, p, cloak_host, theme);
-      nfree(p);
+      free(p);
       break;
     case 4:
       sprintf(ctcpversion, STR("%s\002/\002%s: BitchX-%s \002[\002cypress\002]\002 v01i%s"), cloak_os, cloak_osver, cloak_bxver, theme);
@@ -265,21 +265,21 @@ void scriptchanged()
       sprintf(tmp, STR("%s %s"), cloak_os, p);
       p = strtolower(tmp);
       sprintf(ctcpversion, STR("\037.\037.cypress\037.\03701i%s %s\037(\037%s\037)\037 bitchx\037/\037%s"),theme, p, cloak_host, cloak_bxver);
-      nfree(p);
+      free(p);
       break;
     case 6:
       p = replace(cloak_osver, ".", "\037.\037");
       sprintf(tmp, STR("%s %s"), cloak_os, p);
       p = strtolower(tmp);
       sprintf(ctcpversion, STR("cypress\002.\00201i%s\037(\037bitchx\002.\002%s\037)\037\002.\002. %s\037(\037%s\037)\037"),theme, cloak_bxver, p, cloak_host);
-      nfree(p);
+      free(p);
       break;
     case 7:
       p = replace(cloak_osver, ".", "\037.\037");
       sprintf(tmp, STR("%s %s"), cloak_os, p);
       p = strtolower(tmp);
       sprintf(ctcpversion, STR("\037.\037.cypress\037.\03701i%s - bitchx\037.\037%s\002/\002%s"), theme, cloak_bxver, p);
-      nfree(p);
+      free(p);
       break;
     case 8:
       sprintf(ctcpversion, STR("\002BitchX-%s\002 by panasync \002-\002 %s %s"), cloak_bxver, cloak_os, cloak_osver);
@@ -296,7 +296,7 @@ void scriptchanged()
     case 12:
       p = strtolower(cloak_os);
       sprintf(ctcpversion, STR("bitchx\037/\037%s %s %s \037(\037cypress\037/\03701i\037)\037 %s"), cloak_bxver, p, cloak_osver, theme);
-      nfree(p);
+      free(p);
       break;
     case 13:
       sprintf(ctcpversion, STR("\037.\037.cypress\037/\03701i\037!\037bitchx\037/\037%s\037.\037.%s"), cloak_bxver, theme);
@@ -304,12 +304,12 @@ void scriptchanged()
     case 14:
       p = strtolower(cloak_bxver);
       sprintf(ctcpversion, STR("cypress\002\037.\037\002\037.\03701i\002/\002bitchx\037.\037\002\037.\037\002%s%s"), p, theme);
-      nfree(p);
+      free(p);
       break;
     case 15:
       p = strtolower(cloak_bxver);
       sprintf(ctcpversion, STR("cypress\037.\03701i\037/\037bx%s \037(\037%s\037)\037"), p, theme);
-      nfree(p);
+      free(p);
       break;
     }
     strcpy(ctcpuserinfo, STR(""));

+ 5 - 5
src/mod/dns.mod/coredns.c

@@ -210,7 +210,7 @@ static struct resolve *allocresolve()
 {
     struct resolve *rp;
 
-    rp = (struct resolve *) nmalloc(sizeof(struct resolve));
+    rp = (struct resolve *) malloc(sizeof(struct resolve));
     egg_bzero(rp, sizeof(struct resolve));
     return rp;
 }
@@ -353,7 +353,7 @@ static void unlinkresolvehost(struct resolve *rp)
 	rp->nexthost->previoushost = rp->previoushost;
     if (rp->previoushost)
 	rp->previoushost->nexthost = rp->nexthost;
-    nfree(rp->hostn);
+    free(rp->hostn);
 }
 
 /* Insert request structure addrp into the ip hash table.
@@ -463,7 +463,7 @@ static void unlinkresolve(struct resolve *rp)
     unlinkresolveip(rp);
     if (rp->hostn)
 	unlinkresolvehost(rp);
-    nfree(rp);
+    free(rp);
 }
 
 /* Find request structure using the id.
@@ -842,7 +842,7 @@ static void parserespacket(u_8bit_t *s, int l)
 				return;
 			    }
 			    if (!rp->hostn) {
-				rp->hostn = (char *)nmalloc(strlen(namestring) + 1);
+				rp->hostn = (char *)malloc(strlen(namestring) + 1);
 				strcpy(rp->hostn, namestring);
 				linkresolvehost(rp);
 				passrp(rp, ttl, T_PTR);
@@ -1044,7 +1044,7 @@ static void dns_forward(char *hostn)
     rp = allocresolve();
     rp->state = STATE_AREQ;
     rp->sends = 1;
-    rp->hostn = (char *)nmalloc(strlen(hostn) + 1);
+    rp->hostn = (char *)malloc(strlen(hostn) + 1);
     strcpy(rp->hostn, hostn);
     linkresolvehost(rp);
     sendrequest(rp, T_A);

+ 26 - 26
src/mod/irc.mod/cmdsirc.c

@@ -540,10 +540,10 @@ void cmd_mdop(struct userrec *u, int idx, char *par)
   }
 
 
-  targets = nmalloc(chan->channel.members * sizeof(memberlist *));
+  targets = malloc(chan->channel.members * sizeof(memberlist *));
   egg_bzero(targets, chan->channel.members * sizeof(memberlist *));
 
-  chanbots = nmalloc(chan->channel.members * sizeof(memberlist *));
+  chanbots = malloc(chan->channel.members * sizeof(memberlist *));
   egg_bzero(chanbots, chan->channel.members * sizeof(memberlist *));
 
 ContextNote("!mdop!");
@@ -561,14 +561,14 @@ ContextNote("!mdop!");
     }
   if (!chanbotcount) {
     dprintf(idx, "No bots opped on %s\n", chan->name);
-    nfree(targets);
-    nfree(chanbots);
+    free(targets);
+    free(chanbots);
     return;
   }
   if (!targetcount) {
     dprintf(idx, "Noone to deop on %s\n", chan->name);
-    nfree(targets);
-    nfree(chanbots);
+    free(targets);
+    free(chanbots);
     return;
   }
   while (par && par[0]) {
@@ -578,8 +578,8 @@ ContextNote("!mdop!");
       force_bots = atoi(p);
       if ((force_bots < 1) || (force_bots > chanbotcount)) {
 	dprintf(idx, "bots must be within 1-%i\n", chanbotcount);
-	nfree(targets);
-	nfree(chanbots);
+	free(targets);
+	free(chanbots);
 	return;
       }
     } else if (!strncmp(p, "alines=", 7)) {
@@ -587,8 +587,8 @@ ContextNote("!mdop!");
       force_alines = atoi(p);
       if ((force_alines < 1) || (force_alines > 5)) {
 	dprintf(idx, "alines must be within 1-5\n");
-	nfree(targets);
-	nfree(chanbots);
+	free(targets);
+	free(chanbots);
 	return;
       }
     } else if (!strncmp(p, "slines=", 7)) {
@@ -596,8 +596,8 @@ ContextNote("!mdop!");
       force_slines = atoi(p);
       if ((force_slines < 1) || (force_slines > 6)) {
 	dprintf(idx, "slines must be within 1-6\n");
-	nfree(targets);
-	nfree(chanbots);
+	free(targets);
+	free(chanbots);
 	return;
       }
     } else if (!strncmp(p, "overlap=", 8)) {
@@ -605,8 +605,8 @@ ContextNote("!mdop!");
       force_overlap = atoi(p);
       if ((force_overlap < 1) || (force_overlap > 8)) {
 	dprintf(idx, "overlap must be within 1-8\n");
-	nfree(targets);
-	nfree(chanbots);
+	free(targets);
+	free(chanbots);
 	return;
       }
     } else if (!strcmp(p, "bitch")) {
@@ -615,8 +615,8 @@ ContextNote("!mdop!");
       simul = 1;
     } else {
       dprintf(idx, "Unrecognized mdop option %s\n", p);
-      nfree(targets);
-      nfree(chanbots);
+      free(targets);
+      free(chanbots);
       return;
     }
   }
@@ -630,8 +630,8 @@ ContextNote("!mdop!");
       dprintf(idx, "Not enough bots.\n");
     else
       dprintf(idx, "Not enough bots. Try with overlap=1\n");
-    nfree(targets);
-    nfree(chanbots);
+    free(targets);
+    free(chanbots);
     return;
   }
 
@@ -662,8 +662,8 @@ ContextNote("!mdop!");
       if (bots > chanbotcount) {
 	putlog(LOG_MISC, "*", "Totally fucked calculations in cmd_mdop. this CAN'T happen.");
 	dprintf(idx, "Something's wrong... bug the coder\n");
-	nfree(targets);
-	nfree(chanbots);
+	free(targets);
+	free(chanbots);
 	return;
       }
     }
@@ -718,8 +718,8 @@ ContextNote("!mdop!");
     chan->status |= CHAN_BITCH;
     do_chanset(chan, STR("+bitch"), 1);
   }
-  nfree(targets);
-  nfree(chanbots);
+  free(targets);
+  free(chanbots);
   return;
 }
 
@@ -1061,8 +1061,8 @@ static void cmd_find(struct userrec *u, int idx, char *par)
         if (wild_match(par, tmp)) {
           fcount++;
           if (!found) {
-            found = nmalloc(sizeof(memberlist *) * 100);
-            cfound = nmalloc(sizeof(struct chanset_t *) * 100);
+            found = malloc(sizeof(memberlist *) * 100);
+            cfound = malloc(sizeof(struct chanset_t *) * 100);
           }
           found[fcount - 1] = m;
           cfound[fcount - 1] = chan;
@@ -1098,8 +1098,8 @@ static void cmd_find(struct userrec *u, int idx, char *par)
         dprintf(idx, STR("%s\n"), tmp);
       }
     }
-    nfree(found);
-    nfree(cfound);
+    free(found);
+    free(cfound);
   } else {
     dprintf(idx, STR("No matches for %s on any channels.\n"), par);
   }

+ 31 - 31
src/mod/irc.mod/irc.c

@@ -140,7 +140,7 @@ void makeopline(struct chanset_t *chan, char *nick, char *buf)
 //  putlog(LOG_DEBUG, "*", "Encrypting opline for %s with cookie %s and key %s", nck, plaincookie, key);
   p = encrypt_string(key, plaincookie);
   strcpy(enccookie, p);
-  nfree(p);
+  free(p);
   sprintf(buf, STR("MODE %s +o-b %s *!*@<%s>\n"), chan->name, nck, enccookie);
 }
 
@@ -215,11 +215,11 @@ void getin_request(char *botnick, char *code, char *par)
     if (ip4[0]) {
       char *tmp2;
 
-      tmp = nmalloc(strlen(host) + 1);
+      tmp = malloc(strlen(host) + 1);
       strcpy(tmp, host);
       tmp2 = strtok(tmp, "@");
       egg_snprintf(ip4host, sizeof ip4host, "%s@%s", strtok(tmp2, "@") ,ip4);
-      nfree(tmp);
+      free(tmp);
     } else {
       ip4host[0] = 0;
     }
@@ -227,11 +227,11 @@ void getin_request(char *botnick, char *code, char *par)
     if (ip6[0]) {
       char *tmp2;
 
-      tmp = nmalloc(strlen(host) + 1);
+      tmp = malloc(strlen(host) + 1);
       strcpy(tmp, host);
       tmp2 = strtok(tmp, "@");
       egg_snprintf(ip6host, sizeof ip6host, "%s@%s", strtok(tmp2, "@") ,ip6);
-      nfree(tmp);
+      free(tmp);
     } else {
       ip6host[0] = 0;
     }
@@ -372,14 +372,14 @@ void getin_request(char *botnick, char *code, char *par)
 	}
 	putlog(LOG_GETIN, "*", STR("inreq from %s/%s for %s - Removed permanent global ban %s"), botnick, nick, chan->dname, (*mr)->mask);
 	//gban_total--;
-	nfree((*mr)->mask);
+	free((*mr)->mask);
 	if ((*mr)->desc)
-	  nfree((*mr)->desc);
+	  free((*mr)->desc);
 	if ((*mr)->user)
-	  nfree((*mr)->user);
+	  free((*mr)->user);
 	tmr = *mr;
 	*mr = (*mr)->next;
-	nfree(tmr);
+	free(tmr);
       } else {
 	mr = &((*mr)->next);
       }
@@ -391,14 +391,14 @@ void getin_request(char *botnick, char *code, char *par)
 	  shareout(NULL, STR("-bc %s %s\n"), chan->dname, (*mr)->mask);
 	}
 	putlog(LOG_GETIN, "*", STR("inreq from %s/%s for %s - Removed permanent channel ban %s"), botnick, nick, chan->dname, (*mr)->mask);
-	nfree((*mr)->mask);
+	free((*mr)->mask);
 	if ((*mr)->desc)
-	  nfree((*mr)->desc);
+	  free((*mr)->desc);
 	if ((*mr)->user)
-	  nfree((*mr)->user);
+	  free((*mr)->user);
 	tmr = *mr;
 	*mr = (*mr)->next;
-	nfree(tmr);
+	free(tmr);
       } else {
 	mr = &((*mr)->next);
       }
@@ -412,11 +412,11 @@ void getin_request(char *botnick, char *code, char *par)
     }
     if (strchr(p2, 'k')) {
       sendi = 0;
-      tmp = nmalloc(strlen(chan->dname) + strlen(p3) + 7);
+      tmp = malloc(strlen(chan->dname) + strlen(p3) + 7);
       sprintf(tmp, STR("gi K %s %s"), chan->dname, p3);
       botnet_send_zapf(nextbot(botnick), botnetnick, botnick, tmp);
       putlog(LOG_GETIN, "*", STR("inreq from %s/%s for %s - Sent key (%s)"), botnick, nick, chan->dname, p3);
-      nfree(tmp);
+      free(tmp);
     }
     if (strchr(p2, 'i')) {
       if (!me_op(chan))
@@ -536,7 +536,7 @@ static void request_op(struct chanset_t *chan)
   /* first scan for bots on my server, ask first found for ops */
   cnt = OP_BOTS;
   sprintf(s, "gi o %s %s", chan->dname, botname);
-  l = nmalloc(cnt * 50);
+  l = malloc(cnt * 50);
   l[0] = 0;
   for (i2 = 0; i2 < i; i2++) {
     if (botops[i2]->server && (!strcmp(botops[i2]->server, myserv))) {
@@ -578,7 +578,7 @@ static void request_op(struct chanset_t *chan)
     }
   }
   putlog(LOG_GETIN, "*", STR("Requested ops on %s from %s"), chan->dname, l);
-  nfree(l);
+  free(l);
 }
 
 static void request_in(struct chanset_t *chan)
@@ -607,7 +607,7 @@ static void request_in(struct chanset_t *chan)
   cnt = IN_BOTS;
   sprintf(s, "gi i %s %s %s!%s %s %s", chan->dname, botname, botname, botuserhost, myipstr(4) ? myipstr(4) : "."
                                           , myipstr(6) ? myipstr(6) : ".");
-  l = nmalloc(cnt * 30);
+  l = malloc(cnt * 30);
   l[0] = 0;
   while (cnt) {
     n = random() % i;
@@ -627,7 +627,7 @@ static void request_in(struct chanset_t *chan)
     }
   }
   putlog(LOG_GETIN, "*", STR("Requesting help to join %s from %s"), chan->dname, l);
-  nfree(l);
+  free(l);
 }
 
 
@@ -826,13 +826,13 @@ static void maybe_revenge(struct chanset_t *chan, char *whobad,
  */
 static void my_setkey(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 = (char *) malloc(1);
     chan->channel.key[0] = 0;
     return;
   }
-  chan->channel.key = (char *) channel_malloc(strlen(k) + 1);
+  chan->channel.key = (char *) malloc(strlen(k) + 1);
   strcpy(chan->channel.key, k);
 }
 
@@ -845,14 +845,14 @@ static void newmask(masklist *m, char *s, char *who)
   if (m->mask[0])
     return;			/* Already existent mask */
 
-  m->next = (masklist *) channel_malloc(sizeof(masklist));
+  m->next = (masklist *) malloc(sizeof(masklist));
   m->next->next = NULL;
-  m->next->mask = (char *) channel_malloc(1);
+  m->next->mask = (char *) malloc(1);
   m->next->mask[0] = 0;
-  nfree(m->mask);
-  m->mask = (char *) channel_malloc(strlen(s) + 1);
+  free(m->mask);
+  m->mask = (char *) malloc(strlen(s) + 1);
   strcpy(m->mask, s);
-  m->who = (char *) channel_malloc(strlen(who) + 1);
+  m->who = (char *) malloc(strlen(who) + 1);
   strcpy(m->who, who);
   m->timer = now;
 }
@@ -876,7 +876,7 @@ static int killmember(struct chanset_t *chan, char *nick)
     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
@@ -890,7 +890,7 @@ static int killmember(struct chanset_t *chan, char *nick)
 	    chan->channel.members);
   }
   if (!chan->channel.member) {
-    chan->channel.member = (memberlist *) channel_malloc(sizeof(memberlist));
+    chan->channel.member = (memberlist *) malloc(sizeof(memberlist));
     chan->channel.member->nick[0] = 0;
     chan->channel.member->next = NULL;
   }
@@ -953,8 +953,8 @@ static void reset_chan_info(struct chanset_t *chan)
   if (!channel_pending(chan)) {
     if (me_op(chan))
       opped += 1;
-    nfree(chan->channel.key);
-    chan->channel.key = (char *) channel_malloc(1);
+    free(chan->channel.key);
+    chan->channel.key = (char *) malloc(1);
     chan->channel.key[0] = 0;
     clear_channel(chan, 1);
     chan->status |= CHAN_PEND;

+ 38 - 38
src/mod/irc.mod/mode.c

@@ -32,10 +32,10 @@ static int do_op(char *nick, struct chanset_t *chan, int force)
   if (channel_fastop(chan) || channel_take(chan)) {
     add_mode(chan, '+', 'o', nick);
   } else {
-    char *tmp = nmalloc(strlen(chan->name) + 200);
+    char *tmp = malloc(strlen(chan->name) + 200);
     makeopline(chan, nick, tmp);
     dprintf(DP_MODE, tmp);
-    nfree(tmp);
+    free(tmp);
   }
   return 1;
 }
@@ -82,7 +82,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
     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
@@ -111,7 +111,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
     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 */
@@ -131,7 +131,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
       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;
     }
   }
@@ -153,7 +153,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
       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;
     }
   }
@@ -202,7 +202,7 @@ void dequeue_op_deop(struct chanset_t * chan) {
       modechars[0] = 0;
       nicks[0] = 0;
     }
-    nfree(chan->opqueue[i].target);
+    free(chan->opqueue[i].target);
     chan->opqueue[i].target = NULL;
     i++;
   }
@@ -229,7 +229,7 @@ void dequeue_op_deop(struct chanset_t * chan) {
         lines[0]=0;
       }
     }
-    nfree(chan->deopqueue[i].target);
+    free(chan->deopqueue[i].target);
     chan->deopqueue[i].target = NULL;
     i++;
   }
@@ -248,7 +248,7 @@ void queue_op(struct chanset_t *chan, char *op) {
   memberlist *m;
   for (n = 0; n < 20; n++) {
     if (!chan->opqueue[n].target) {
-      chan->opqueue[n].target = nmalloc(strlen(op) + 1);
+      chan->opqueue[n].target = malloc(strlen(op) + 1);
       strcpy(chan->opqueue[n].target, op);
       m = ismember(chan, op);
       if (m)
@@ -265,7 +265,7 @@ void queue_deop(struct chanset_t *chan, char *op) {
   memberlist *m;
   for (n = 0; n<20; n++) {
     if (!chan->deopqueue[n].target) {
-      chan->deopqueue[n].target = nmalloc(strlen(op)+1);
+      chan->deopqueue[n].target = malloc(strlen(op)+1);
       strcpy(chan->deopqueue[n].target, op);
       m = ismember(chan, op);
       if (m)
@@ -392,7 +392,7 @@ static void real_add_mode(struct chanset_t *chan,
     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);
+	chan->cmode[i].op = (char *) malloc(l);
 	chan->bytes += l;	/* Add 1 for safety */
 	strcpy(chan->cmode[i].op, op);
 	break;
@@ -402,16 +402,16 @@ static void real_add_mode(struct chanset_t *chan,
   /* +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);
+    chan->key = (char *) malloc(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);
+    chan->rmkey = (char *) malloc(strlen(op) + 1);
     if (chan->rmkey)
       strcpy(chan->rmkey, op);
   }
@@ -484,7 +484,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
     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
@@ -514,7 +514,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
     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 */
@@ -532,7 +532,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
       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;
     }
   }
@@ -552,7 +552,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
       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;
     }
   }
@@ -684,7 +684,7 @@ static void real_add_mode(struct chanset_t *chan,
     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);
+        chan->cmode[i].op = (char *) malloc(l);
         chan->bytes += l;       /* Add 1 for safety */
         strcpy(chan->cmode[i].op, op);
         break;
@@ -694,16 +694,16 @@ static void real_add_mode(struct chanset_t *chan,
   /* +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);
+    chan->key = (char *) malloc(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);
+    chan->rmkey = (char *) malloc(strlen(op) + 1);
     if (chan->rmkey)
       strcpy(chan->rmkey, op);
   }
@@ -852,10 +852,10 @@ flush_mode(chan, QUICK);
   m->flags |= WASOP;
   if (check_chan) {
     /* tell other bots to set jointime to 0 and join */
-    char *buf = nmalloc(strlen(chan->dname) + 3 + 1);
+    char *buf = malloc(strlen(chan->dname) + 3 + 1);
     sprintf(buf, "jn %s", chan->dname);
     putallbots(buf);
-    nfree(buf);
+    free(buf);
     recheck_channel(chan, 1);
   }
 }
@@ -1024,9 +1024,9 @@ static void got_unban(struct chanset_t *chan, char *nick, char *from,
       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))
@@ -1090,9 +1090,9 @@ static void got_unexempt(struct chanset_t *chan, char *nick, char *from,
       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))
@@ -1166,9 +1166,9 @@ static void got_uninvite(struct chanset_t *chan, char *nick, char *from,
       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))
@@ -1238,7 +1238,7 @@ static int gotmode(char *from, char *msg)
           mp = newsplit(&wptr);
           if (strchr("ob", p[0])) {
             /* Just want o's and b's */
-            modes[modecnt] = nmalloc(strlen(mp) + 4);
+            modes[modecnt] = malloc(strlen(mp) + 4);
             sprintf(modes[modecnt], STR("%c%c %s"), sign, p[0], mp);
             modecnt++;
             if (p[0] == 'o') {
@@ -1333,7 +1333,7 @@ static int gotmode(char *from, char *msg)
           p = decrypt_string(key, enccookie);
 /* putlog(LOG_DEBUG, "*", "Decrypted cookie: %s", p); */
           strncpyz(plaincookie, p, sizeof(plaincookie));
-          nfree(p);
+          free(p);
           /*
            * last 6 digits of time
            * last 5 chars of nick
@@ -1463,7 +1463,7 @@ static int gotmode(char *from, char *msg)
       }
       for (i = 0; i < 5; i++)
         if (modes[i])
-          nfree(modes[i]);
+          free(modes[i]);
     }
 
     /* Now do the modes again, this time throughly... */

+ 9 - 16
src/mod/module.h

@@ -42,19 +42,12 @@
  * Do not read this file whilst unless heavily sedated, I will not be
  * held responsible for mental break-downs caused by this file <G>
  */
-
 #undef killsock
-#undef nmalloc
-#undef nfree
-#undef nrealloc
 #undef feof
-#undef user_malloc
 #undef dprintf
 #undef sdprintf
-#undef get_data_ptr
 #undef wild_match
 #undef wild_match_per
-#undef user_realloc
 #undef Context
 #undef ContextNote
 #undef Assert
@@ -95,8 +88,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__))
+/* UNUSED 0 */
+/* UNUSED 1 */
 #ifdef DEBUG_CONTEXT
 #  define Context (global[2](__FILE__, __LINE__, MODULE_NAME))
 #else
@@ -145,9 +138,9 @@
 #define nextbot ((int (*)(char *))global[35])
 /* 36 - 39 */
 #define zapfbot ((void (*)(int))global[36])
-#define n_free ((void (*)(void *,char *, int))global[37])
+/* UNUSED 37 */
 #define u_pass_match ((int (*)(struct userrec *,char *))global[38])
-#define user_malloc(x) ((void *(*)(int,char *,int))global[39])(x,__FILE__,__LINE__)
+/* UNUSED 39 */
 /* 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])
@@ -210,7 +203,7 @@
 /* 84 - 87 */
 #define open_listen_by_af ((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__)
+#define get_data_ptr(x) ((void *(*)(int))global[86])(x)
 #define open_telnet ((int (*) (char *, int))global[87])
 /* 88 - 91 */
 #define check_bind_event ((void * (*) (const char *))global[88])
@@ -313,8 +306,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])
+/* UNUSED 168 */
+/* UNUSED 169 */
 #define do_restart (*(int *)(global[170]))
 /* --- UNUSED 171 */
 /* 172 - 175 */
@@ -389,8 +382,8 @@
 #define force_expire (*(int *)(global[227]))	/* Rufus */
 /* 228 - 231 */
 /* 228 */
-#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__)))
+/* UNUSED 229 */
+/* UNUSED 230 */
 #define xtra_set ((int(*)(struct userrec *,struct user_entry *, void *))global[231])
 /* 232 - 235 */
 #ifdef DEBUG_CONTEXT

+ 10 - 10
src/mod/notes.mod/cmdsnote.c

@@ -14,7 +14,7 @@ static void cmd_pls_noteign(struct userrec *u, int idx, char *par)
   }
   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);
@@ -25,13 +25,13 @@ static void cmd_pls_noteign(struct userrec *u, int idx, char *par)
       get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
       if (!(glob_master(fr) || glob_owner(fr))) {
 	dprintf(idx, NOTES_IGN_OTHERS, handle);
-	nfree(buf);
+	free(buf);
         return;
       }
     }
     if (!u2) {
       dprintf(idx, NOTES_UNKNOWN_USER, handle);
-      nfree(buf);
+      free(buf);
       return;
     }
   } else {
@@ -42,7 +42,7 @@ static void cmd_pls_noteign(struct userrec *u, int idx, char *par)
     dprintf(idx, NOTES_IGN_NEW, mask);
   else
     dprintf(idx, NOTES_IGN_ALREADY, mask);
-  nfree(buf);
+  free(buf);
   return;
 }
 
@@ -55,7 +55,7 @@ static void cmd_mns_noteign(struct userrec *u, int idx, char *par)
     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);
@@ -66,13 +66,13 @@ static void cmd_mns_noteign(struct userrec *u, int idx, char *par)
       get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
       if (!(glob_master(fr) || glob_owner(fr))) {
 	dprintf(idx, NOTES_IGN_OTHERS, handle);
-	nfree(buf);
+	free(buf);
         return;
       }
     }
     if (!u2) {
       dprintf(idx, NOTES_UNKNOWN_USER, handle);
-      nfree(buf);
+      free(buf);
       return;
     }
   } else {
@@ -84,7 +84,7 @@ static void cmd_mns_noteign(struct userrec *u, int idx, char *par)
     dprintf(idx, NOTES_IGN_REM, mask);
   else
     dprintf(idx, NOTES_IGN_NOTFOUND, mask);
-  nfree(buf);
+  free(buf);
   return;
 }
 
@@ -121,8 +121,8 @@ static void cmd_noteigns(struct userrec *u, int idx, char *par)
   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)

+ 23 - 23
src/mod/notes.mod/notes.c

@@ -754,16 +754,16 @@ int get_note_ignores(struct userrec *u, char ***ignores)
     return 0;
 
   rmspace(xk->data);
-  buf = user_malloc(strlen(xk->data) + 1);
+  buf = malloc(strlen(xk->data) + 1);
   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;
@@ -783,31 +783,31 @@ int add_note_ignore(struct userrec *u, char *mask)
     /* 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);
+    mxk->data = malloc(strlen(mask) + 1);
     strcpy(mxk->data, mask);
-    mxk->key = user_malloc(strlen(NOTES_IGNKEY) + 1);
+    mxk->key = malloc(strlen(NOTES_IGNKEY) + 1);
     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);
   }
@@ -825,36 +825,36 @@ int del_note_ignore(struct userrec *u, char *mask)
   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 {
@@ -878,12 +878,12 @@ int match_note_ignore(struct userrec *u, char *from)
     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;
 }
 

+ 43 - 43
src/mod/server.mod/server.c

@@ -160,8 +160,8 @@ static void deq_msg()
       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++;
     }
@@ -186,8 +186,8 @@ static void deq_msg()
     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;
@@ -210,8 +210,8 @@ static void deq_msg()
   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;
@@ -448,8 +448,8 @@ static int fast_deq(int which)
       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;
@@ -460,8 +460,8 @@ static int fast_deq(int which)
     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;
@@ -535,15 +535,15 @@ static void parse_q(struct msgq_head *q, char *oldnick, char *newnick)
           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);
       }
@@ -602,17 +602,17 @@ static void purge_kicks(struct msgq_head *q)
             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);
         }
@@ -700,17 +700,17 @@ static int deq_kick(int which)
             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);
         }
@@ -743,8 +743,8 @@ static int deq_kick(int which)
   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;
@@ -839,7 +839,7 @@ static void queue_server(int which, char *buf, int len)
 	}
       }
 
-    q = nmalloc(sizeof(struct msgq));
+    q = malloc(sizeof(struct msgq));
     if (qnext)
       q->next = h->head;
     else
@@ -853,7 +853,7 @@ static void queue_server(int which, char *buf, int len)
        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;
@@ -929,7 +929,7 @@ static void add_server(char *ss)
     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;
@@ -943,7 +943,7 @@ static void add_server(char *ss)
     if (!q) {
       x->port = default_port;
       x->pass = 0;
-      x->name = nmalloc(strlen(ss) + 1);
+      x->name = malloc(strlen(ss) + 1);
       strcpy(x->name, ss);
     } else {
 #ifdef USE_IPV6
@@ -957,7 +957,7 @@ static void add_server(char *ss)
       }
 #endif /* USE_IPV6 */
       *q++ = 0;
-      x->name = nmalloc(q - ss);
+      x->name = malloc(q - ss);
       strcpy(x->name, ss);
       ss = q;
       q = strchr(ss, ':');
@@ -965,7 +965,7 @@ static void add_server(char *ss)
 	x->pass = 0;
       } else {
 	*q++ = 0;
-	x->pass = nmalloc(strlen(q) + 1);
+	x->pass = malloc(strlen(q) + 1);
 	strcpy(x->pass, q);
       }
 #ifdef USE_IPV6
@@ -989,12 +989,12 @@ static void clearq(struct server_list *xx)
   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;
   }
 }
@@ -1016,13 +1016,13 @@ void servers_changed(struct cfg_entry * entry, char * olddata, int * valid) {
     clearq(serverlist);
     serverlist = NULL;
   }
-  p = nmalloc(strlen(slist) + 1);
+  p = malloc(strlen(slist) + 1);
 #ifdef S_RANDSERVERS
   shuffle(slist, ",");
 #endif /* S_RANDSERVERS */
   strcpy(p, slist);
   add_server(p);
-  nfree(p);
+  free(p);
 #endif /* LEAF */
 }
 
@@ -1037,13 +1037,13 @@ void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
     clearq(serverlist);
     serverlist = NULL;
   }
-  p = nmalloc(strlen(slist) + 1);
+  p = malloc(strlen(slist) + 1);
 #ifdef S_RANDSERVERS
   shuffle(slist, ",");
 #endif /* S_RANDSERVERS */
   strcpy(p, slist);
   add_server(p);
-  nfree(p);
+  free(p);
 #endif /* LEAF */
 }
 
@@ -1129,15 +1129,15 @@ static void next_server(int *ptr, char *serv, unsigned int *port, char *pass)
       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);
+    x->name = malloc(strlen(serv) + 1);
     strcpy(x->name, serv);
     x->port = *port ? *port : default_port;
     if (pass && pass[0]) {
-      x->pass = nmalloc(strlen(pass) + 1);
+      x->pass = malloc(strlen(pass) + 1);
       strcpy(x->pass, pass);
     } else
       x->pass = NULL;
@@ -1507,8 +1507,8 @@ static void msgq_clear(struct msgq_head *qh)
 
   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;

+ 1 - 1
src/mod/server.mod/server.h

@@ -62,7 +62,7 @@
  */
 
 #define free_null(ptr)	do {				\
-	nfree(ptr);					\
+	free(ptr);					\
 	ptr = NULL;					\
 } while (0)
 

+ 4 - 4
src/mod/server.mod/servmsg.c

@@ -195,15 +195,15 @@ static int got001(char *from, char *msg)
       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);
+	free(x->name);
+      x->name = malloc(strlen(from) + 1);
       strcpy(x->name, from);
     } else {
-      x->realname = nmalloc(strlen(from) + 1);
+      x->realname = malloc(strlen(from) + 1);
       strcpy(x->realname, from);
     }
   }

+ 20 - 20
src/mod/share.mod/share.c

@@ -91,15 +91,15 @@ static void add_delay(struct chanset_t *chan, int plsmns, int mode, char *mask)
 {
   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);
@@ -119,8 +119,8 @@ static void del_delay(struct delay_mode *delay)
       else
         start_delay = d->next;
       if (d->mask)
-        nfree(d->mask);
-      nfree(d);
+        free(d->mask);
+      free(d);
       break;
     }
   }
@@ -593,7 +593,7 @@ static void share_change(int idx, char *par)
 	  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;
@@ -604,7 +604,7 @@ static void share_change(int idx, char *par)
 	  if (!e->u.list) {
 	    list_delete((struct list_type **) &(u->entries),
 			(struct list_type *) e);
-	    nfree(e);
+	    free(e);
 	  }
 	}
 	noshare = 0;
@@ -1145,7 +1145,7 @@ static void share_ufsend(int idx, char *par)
       dcc[i].addr = my_atoul(ip);
       dcc[i].port = atoi(port);
       strcpy(dcc[i].nick, "*users");
-      dcc[i].u.xfer->filename = nmalloc(strlen(s) + 1);
+      dcc[i].u.xfer->filename = malloc(strlen(s) + 1);
       strcpy(dcc[i].u.xfer->filename, s);
       dcc[i].u.xfer->origname = dcc[i].u.xfer->filename;
       dcc[i].u.xfer->length = atoi(par);
@@ -1391,7 +1391,7 @@ static void new_tbuf(char *bot)
 {
   tandbuf **old = &tbuf, *new;
 
-  new = nmalloc(sizeof(tandbuf));
+  new = malloc(sizeof(tandbuf));
   strcpy(new->bot, bot);
   new->q = NULL;
   new->timer = now;
@@ -1413,10 +1413,10 @@ static void del_tbuf(tandbuf *goner)
         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;
     }
   }
@@ -1479,11 +1479,11 @@ static struct share_msgq *q_addmsg(struct share_msgq *qq,
   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);
+    q->msg = (char *) malloc(strlen(s) + 1);
     strcpy(q->msg, s);
     return q;
   }
@@ -1492,12 +1492,12 @@ static struct share_msgq *q_addmsg(struct share_msgq *qq,
     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);
+  q->msg = (char *) malloc(strlen(s) + 1);
   strcpy(q->msg, s);
   return qq;
 }
@@ -1686,8 +1686,8 @@ static struct userrec *dup_userlist(int t)
 	  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);
@@ -1695,9 +1695,9 @@ static struct userrec *dup_userlist(int t)
 	  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);
+	    list->extra = malloc(strlen(lt->extra) + 1);
 	    strcpy(list->extra, lt->extra);
 	    list_append((&nue->u.list), list);
 	  }

+ 7 - 7
src/mod/share.mod/uf_features.c

@@ -154,7 +154,7 @@ static void uff_addfeature(uff_table_t *ut)
 	   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);
 }
@@ -178,7 +178,7 @@ static int uff_delfeature(uff_table_t *ut)
   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;
@@ -208,7 +208,7 @@ static void uf_features_parse(int idx, char *par)
   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. */
@@ -227,7 +227,7 @@ static void uf_features_parse(int idx, char *par)
     }
     p = ++s;
   }
-  nfree(buf);
+  free(buf);
 
   /* Send response string						*/
   if (uff_sbuf[0])
@@ -255,7 +255,7 @@ static int uf_features_check(int idx, char *par)
   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. */
@@ -281,12 +281,12 @@ static int uf_features_check(int idx, char *par)
       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;
 }
 

+ 52 - 52
src/mod/transfer.mod/transfer.c

@@ -170,7 +170,7 @@ static char *replace_spaces(char *fn)
 {
   register char *ret, *p;
 
-  p = ret = nmalloc(strlen(fn) + 1);
+  p = ret = malloc(strlen(fn) + 1);
   strcpy(ret, fn);
   while ((p = strchr(p, ' ')) != NULL)
     *p = '_';
@@ -208,10 +208,10 @@ 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);
+  fileq->dir = (char *) malloc(strlen(dir) + 1);
+  fileq->file = (char *) malloc(strlen(file) + 1);
   strcpy(fileq->dir, dir);
   strcpy(fileq->file, file);
   strcpy(fileq->nick, from);
@@ -232,9 +232,9 @@ static void deq_this(fileq_t *this)
     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.
@@ -272,7 +272,7 @@ static void send_next_file(char *to)
     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, '*');
@@ -282,12 +282,12 @@ static void send_next_file(char *to)
       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, "*",
@@ -298,19 +298,19 @@ static void send_next_file(char *to)
 	      this->to);
       strcpy(s, this->to);
       flush_fileq(s);
-      nfree(s1);
-      nfree(s);
+      free(s1);
+      free(s);
       return;
     }
   } else {
-    s1 = nmalloc(strlen(s) + 1);
+    s1 = malloc(strlen(s) + 1);
     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);
@@ -319,8 +319,8 @@ static void send_next_file(char *to)
       dprintf(DP_HELP, TRANSFER_FILE_ARRIVE, this->to,
 	      this->nick);
     deq_this(this);
-    nfree(s);
-    nfree(s1);
+    free(s);
+    free(s1);
     return;
   }
   wipe_tmp_filename(s1, -1);
@@ -345,8 +345,8 @@ static void send_next_file(char *to)
     }
     deq_this(this);
   }
-  nfree(s);
-  nfree(s1);
+  free(s);
+  free(s1);
   return;
 }
 
@@ -421,7 +421,7 @@ static void fileq_cancel(int idx, char *par)
     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
@@ -446,7 +446,7 @@ static void fileq_cancel(int idx, char *par)
     }
   }
   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) ||
@@ -504,7 +504,7 @@ static unsigned long pump_file_to_sock(FILE *file, long sock,
 {
   const unsigned long		 buf_len = pending_data >= PMAX_SIZE ?
 	  					PMAX_SIZE : pending_data;
-  char				*bf = nmalloc(buf_len);
+  char				*bf = malloc(buf_len);
   register unsigned long	 actual_size;
 
   if (bf) {
@@ -514,7 +514,7 @@ static unsigned long pump_file_to_sock(FILE *file, long sock,
       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;
 }
@@ -561,10 +561,10 @@ static void eof_dcc_fork_send(int idx)
     putlog(LOG_MISC, "*", "%s: SEND %s (%s!%s)", DCC_CONNECTFAILED2,
 	   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);
@@ -625,8 +625,8 @@ static void eof_dcc_send(int idx)
       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);
@@ -645,8 +645,8 @@ static void eof_dcc_send(int idx)
       stats_add_upload(u, dcc[idx].u.xfer->length);
       check_sentrcvd(u, dcc[idx].nick, nfn, BT_rcvd);
     }
-    nfree(ofn);
-    nfree(nfn);
+    free(ofn);
+    free(nfn);
     for (j = 0; j < dcc_total; j++)
       if (!ok && (dcc[j].type->flags & (DCT_GETNOTES)) &&
 	  !egg_strcasecmp(dcc[j].nick, hand)) {
@@ -720,10 +720,10 @@ static void eof_dcc_send(int idx)
     putlog(LOG_FILES, "*",TRANSFER_LOST_DCCSEND,
 	   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);
   }
@@ -1036,10 +1036,10 @@ static void dcc_send(int idx, char *buf, int len)
 	   TRANSFER_FILE_TOO_LONG,
 	   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);
   }
@@ -1164,10 +1164,10 @@ static void tout_dcc_send(int idx)
     putlog(LOG_FILES, "*",TRANSFER_DCC_SEND_TIMEOUT,
 	   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);
@@ -1205,13 +1205,13 @@ 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)
@@ -1441,7 +1441,7 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from,
 	   nfn, nick);
   }
   if (buf)
-    nfree(buf);
+    free(buf);
   return DCCSEND_OK;
 }
 
@@ -1468,7 +1468,7 @@ static int fstat_unpack(struct userrec *u, struct user_entry *e)
   char *par, *arg;
   struct filesys_stats *fs;
 
-  fs = user_malloc(sizeof(struct filesys_stats));
+  fs = malloc(sizeof(struct filesys_stats));
   egg_bzero(fs, sizeof(struct filesys_stats));
   par = e->u.list->extra;
   arg = newsplit(&par);
@@ -1492,15 +1492,15 @@ static int fstat_unpack(struct userrec *u, struct user_entry *e)
 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;
 }
 
@@ -1523,7 +1523,7 @@ static int fstat_set(struct userrec *u, struct user_entry *e, void *buf)
 
   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;
@@ -1535,7 +1535,7 @@ static int fstat_set(struct userrec *u, struct user_entry *e, void *buf)
        *  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...
@@ -1577,8 +1577,8 @@ static int fstat_tcl_get(Tcl_Interp *irp, struct userrec *u,
 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;
 }
 
@@ -1635,7 +1635,7 @@ static int fstat_gotshare(struct userrec *u, struct user_entry *e,
     break;
   default:
     if (!(fs = e->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
+      fs = malloc(sizeof(struct filesys_stats));
       egg_bzero(fs, sizeof(struct filesys_stats));
     }
     p = newsplit (&par);
@@ -1663,7 +1663,7 @@ static int fstat_dupuser(struct userrec *u, struct userrec *o,
   struct filesys_stats *fs;
 
   if (e->u.extra) {
-    fs = user_malloc(sizeof(struct filesys_stats));
+    fs = malloc(sizeof(struct filesys_stats));
     my_memcpy(fs, e->u.extra, sizeof(struct filesys_stats));
 
     return set_user(&USERENTRY_FSTAT, u, fs);
@@ -1679,7 +1679,7 @@ static void stats_add_dnload(struct userrec *u, unsigned long bytes)
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
         !(fs = ue->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
+      fs = malloc(sizeof(struct filesys_stats));
       egg_bzero(fs, sizeof(struct filesys_stats));
     }
     fs->dnloads++;
@@ -1697,7 +1697,7 @@ static void stats_add_upload(struct userrec *u, unsigned long bytes)
   if (u) {
     if (!(ue = find_user_entry (&USERENTRY_FSTAT, u)) ||
         !(fs = ue->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
+      fs = malloc(sizeof(struct filesys_stats));
       egg_bzero(fs, sizeof(struct filesys_stats));
     }
     fs->uploads++;
@@ -1722,7 +1722,7 @@ static int fstat_tcl_set(Tcl_Interp *irp, struct userrec *u,
   case 'u':
   case 'd':
     if (!(fs = e->u.extra)) {
-      fs = user_malloc(sizeof(struct filesys_stats));
+      fs = malloc(sizeof(struct filesys_stats));
       egg_bzero(fs, sizeof(struct filesys_stats));
     }
     switch (argv[3][0]) {

+ 4 - 4
src/mod/update.mod/update.c

@@ -113,7 +113,7 @@ static void update_ufsend(int idx, char *par)
       dcc[i].addr = my_atoul(ip);
       dcc[i].port = atoi(port);
       strcpy(dcc[i].nick, "*binary");
-      dcc[i].u.xfer->filename = nmalloc(strlen(s) + 1);
+      dcc[i].u.xfer->filename = malloc(strlen(s) + 1);
       strcpy(dcc[i].u.xfer->filename, s);
       dcc[i].u.xfer->origname = dcc[i].u.xfer->filename;
       dcc[i].u.xfer->length = atoi(par);
@@ -176,11 +176,11 @@ static void got_nu(char *botnick, char *code, char *par)
 #ifdef LEAF
      u1 = get_user_by_handle(userlist, botnetnick);
      obi = get_user(&USERENTRY_BOTADDR, u1);
-     bi = user_malloc(sizeof(struct bot_addr));
+     bi = malloc(sizeof(struct bot_addr));
 
-     bi->uplink = user_malloc(strlen(botnick) + 1);
+     bi->uplink = malloc(strlen(botnick) + 1);
      strcpy(bi->uplink, botnick);
-     bi->address = user_malloc(strlen(obi->address) + 1);
+     bi->address = malloc(strlen(obi->address) + 1);
      strcpy(bi->address, obi->address);
      bi->telnet_port = obi->telnet_port;
      bi->relay_port = obi->relay_port;

+ 23 - 63
src/modules.c

@@ -62,9 +62,9 @@ struct static_list {
 
 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);
+  p->name = malloc(strlen(name) + 1);
   strcpy(p->name, name);
   p->func = func;
   p->next = static_modules;
@@ -153,8 +153,8 @@ dependancy *dependancy_list = NULL;
 Function global_table[] =
 {
   /* 0 - 3 */
-  (Function) mod_malloc,
-  (Function) mod_free,
+  (Function) 0,
+  (Function) 0,
 #ifdef DEBUG_CONTEXT
   (Function) eggContext,
 #else
@@ -203,9 +203,9 @@ Function global_table[] =
   (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,7 +264,7 @@ Function global_table[] =
   /* 84 - 87 */
   (Function) open_listen_by_af,
   (Function) open_telnet_dcc,
-  (Function) _get_data_ptr,
+  (Function) get_data_ptr,
   (Function) open_telnet,
   /* 88 - 91 */
   (Function) check_bind_event,
@@ -367,8 +367,8 @@ Function global_table[] =
   (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) 0,
   /* 172 - 175 */
@@ -443,8 +443,8 @@ Function global_table[] =
   (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
@@ -622,8 +622,8 @@ void init_modules(void)
 
   BT_load = bind_table_add("load", 1, "s", MATCH_MASK, 0);
 
-  module_list = nmalloc(sizeof(module_entry));
-  module_list->name = nmalloc(8);
+  module_list = malloc(sizeof(module_entry));
+  module_list->name = malloc(8);
   strcpy(module_list->name, "eggdrop");
   module_list->major = (egg_numver) / 10000;
   module_list->minor = ((egg_numver) / 100) % 100;
@@ -663,10 +663,10 @@ const char *module_load(char *name)
   if (!sl)
     return "Unknown module.";
   f = (Function) sl->func;
-  p = nmalloc(sizeof(module_entry));
+  p = malloc(sizeof(module_entry));
   if (p == NULL)
     return "Malloc error";
-  p->name = nmalloc(strlen(name) + 1);
+  p->name = malloc(strlen(name) + 1);
   strcpy(p->name, name);
   p->major = 0;
   p->minor = 0;
@@ -676,8 +676,8 @@ const char *module_load(char *name)
   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_bind(BT_load, name, NULL, name);
@@ -705,8 +705,8 @@ static int module_rename(char *name, char *newname)
 
   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);
+      free(p->name);
+      p->name = malloc(strlen(newname) + 1);
       strcpy(p->name, newname);
       return 1;
     }
@@ -726,7 +726,7 @@ Function *module_depend(char *name1, char *name2, int major, int minor)
   }
   if (!p || !o)
     return 0;
-  d = nmalloc(sizeof(dependancy));
+  d = malloc(sizeof(dependancy));
 
   d->needed = p;
   d->needing = o;
@@ -752,7 +752,7 @@ int module_undepend(char *name1)
       } else {
 	o->next = d->next;
       }
-      nfree(d);
+      free(d);
       if (o == NULL)
 	d = dependancy_list;
       else
@@ -766,46 +766,6 @@ int module_undepend(char *name1)
   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)
@@ -816,7 +776,7 @@ void add_hook(int hook_num, Function func)
     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;
@@ -884,7 +844,7 @@ void del_hook(int hook_num, Function func)
 	  hook_list[hook_num] = p->next;
 	else
 	  o->next = p->next;
-	nfree(p);
+	free(p);
 	break;
       }
       o = p;

+ 0 - 4
src/modules.h

@@ -27,10 +27,6 @@ char *module_unload(char *module_name, char *nick);
 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);

+ 34 - 34
src/net.c

@@ -530,11 +530,11 @@ void real_killsock(register int sock, const char *file, int line)
       dropssl(sock);
       close(socklist[i].sock);
       if (socklist[i].inbuf != NULL) {
-	nfree(socklist[i].inbuf);
+	free(socklist[i].inbuf);
 	socklist[i].inbuf = NULL;
       }
       if (socklist[i].outbuf != NULL) {
-	nfree(socklist[i].outbuf);
+	free(socklist[i].outbuf);
 	socklist[i].outbuf = NULL;
 	socklist[i].outbuflen = 0;
       }
@@ -1244,7 +1244,7 @@ char *botlink_decrypt(int snum, char *src)
 
   line = decrypt_string(socklist[snum].ikey, src);
   strcpy(src, line);
-  nfree(line);
+  free(line);
   if (socklist[snum].iseed) {
     for (i = 0; i <= 3; i++)
       *(dword *) & socklist[snum].ikey[i * 4] = prand(&socklist[snum].iseed, 0xFFFFFFFF);
@@ -1259,11 +1259,11 @@ char *botlink_encrypt(int snum, char *src)
   char *srcbuf = NULL, *buf = NULL, *line = NULL, *eol = NULL, *eline = NULL;
   int bufpos = 0, i = 0;
   
-  srcbuf = nmalloc(strlen(src) + 9 + 1);
+  srcbuf = malloc(strlen(src) + 9 + 1);
   strcpy(srcbuf, src);
   line = srcbuf;
   if (!line) {
-    nfree(srcbuf);
+    free(srcbuf);
     return NULL;
   }
   eol = strchr(line, '\n');
@@ -1276,9 +1276,9 @@ char *botlink_encrypt(int snum, char *src)
       if (!socklist[snum].oseed)
         socklist[snum].oseed++;
     }
-    buf = nrealloc(buf, bufpos + strlen(eline) + 1 + 9);
+    buf = realloc(buf, bufpos + strlen(eline) + 1 + 9);
     strcpy((char *) &buf[bufpos], eline);
-    nfree(eline);
+    free(eline);
     strcat(buf, "\n");
     bufpos = strlen(buf);
     line = eol;
@@ -1292,12 +1292,12 @@ char *botlink_encrypt(int snum, char *src)
       if (!socklist[snum].oseed)
         socklist[snum].oseed++;
     }
-    buf = nrealloc(buf, bufpos + strlen(eline) + 1 + 9);
+    buf = realloc(buf, bufpos + strlen(eline) + 1 + 9);
     strcpy((char *) &buf[bufpos], eline);
-    nfree(eline);
+    free(eline);
     strcat(buf, "\n");
   }
-  nfree(srcbuf);
+  free(srcbuf);
   return buf;
 }
 
@@ -1342,13 +1342,13 @@ int sockgets(char *s, int *len)
 	  if (strlen(socklist[i].inbuf) > (grab - 2))
 	    socklist[i].inbuf[(grab - 2)] = 0;
 	  strcpy(s, socklist[i].inbuf);
-	  px = (char *) nmalloc(strlen(p + 1) + 1);
+	  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 */
@@ -1364,7 +1364,7 @@ int sockgets(char *s, int *len)
 	if (socklist[i].inbuflen <= (grab - 2)) {
 	  *len = socklist[i].inbuflen;
 	  egg_memcpy(s, socklist[i].inbuf, socklist[i].inbuflen);
-	  nfree(socklist[i].inbuf);
+	  free(socklist[i].inbuf);
           socklist[i].inbuf = NULL;
 	  socklist[i].inbuflen = 0;
 	} else {
@@ -1373,7 +1373,7 @@ int sockgets(char *s, int *len)
 	  egg_memcpy(s, socklist[i].inbuf, *len);
 	  egg_memcpy(socklist[i].inbuf, socklist[i].inbuf + *len, *len);
 	  socklist[i].inbuflen -= *len;
-	  socklist[i].inbuf = nrealloc(socklist[i].inbuf, socklist[i].inbuflen);
+	  socklist[i].inbuf = realloc(socklist[i].inbuf, socklist[i].inbuflen);
 	}
 	return socklist[i].sock;
       }
@@ -1399,7 +1399,7 @@ int sockgets(char *s, int *len)
       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);
       socklist[ret].inbuf[*len] = 0;
@@ -1415,7 +1415,7 @@ int sockgets(char *s, int *len)
   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);
     socklist[ret].inbuflen += *len;
@@ -1427,23 +1427,23 @@ int sockgets(char *s, int *len)
   /* 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) < grab) {
       strcpy(xx, socklist[ret].inbuf);
-      nfree(socklist[ret].inbuf);
+      free(socklist[ret].inbuf);
       socklist[ret].inbuf = NULL;
       socklist[ret].inbuflen = 0;
     } else {
       p = socklist[ret].inbuf;
       socklist[ret].inbuflen = strlen(p) - (grab - 2);
-      socklist[ret].inbuf = (char *) nmalloc(socklist[ret].inbuflen + 1); 
+      socklist[ret].inbuf = (char *) malloc(socklist[ret].inbuflen + 1); 
       strcpy(socklist[ret].inbuf, p + (grab - 2));
       *(p + (grab - 2)) = 0;
       strcpy(xx, p);
-      nfree(p);
+      free(p);
       /* (leave the rest to be post-pended later) */
     }
   }
@@ -1484,13 +1484,13 @@ int sockgets(char *s, int *len)
   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) {
@@ -1546,12 +1546,12 @@ void tputs(register int z, char *s, unsigned int len)
       
       if (socklist[i].outbuf != NULL) {
 	/* Already queueing: just add it */
-	p = (char *) nrealloc(socklist[i].outbuf, socklist[i].outbuflen + len);
+	p = (char *) realloc(socklist[i].outbuf, socklist[i].outbuflen + len);
 	egg_memcpy(p + socklist[i].outbuflen, s, len);
 	socklist[i].outbuf = p;
 	socklist[i].outbuflen += len;
         if (socklist[i].encstatus && s)
-          nfree(s);
+          free(s);
 	return;
       }
       /* Try. */
@@ -1588,12 +1588,12 @@ void tputs(register int z, char *s, unsigned int len)
 	x = 0;
       if (x < len) {
 	/* Socket is full, queue it */
-	socklist[i].outbuf = (char *) nmalloc(len - x);
+	socklist[i].outbuf = (char *) malloc(len - x);
 	egg_memcpy(socklist[i].outbuf, &s[x], len - x);
 	socklist[i].outbuflen = len - x;
       }
       if (socklist[i].encstatus && s)
-        nfree(s);
+        free(s);
       return;
     }
   }
@@ -1609,7 +1609,7 @@ void tputs(register int z, char *s, unsigned int len)
   }
 
 //  if (socklist[i].encstatus > 0)
-//    nfree(s);
+//    free(s);
 }
 
 /* tputs might queue data for sockets, let's dump as much of it as
@@ -1693,17 +1693,17 @@ void dequeue_sockets()
 	socklist[i].flags |= SOCK_EOFD;
       } else if (x == socklist[i].outbuflen) {
 	/* If the whole buffer was sent, nuke it */
-	nfree(socklist[i].outbuf);
+	free(socklist[i].outbuf);
 	socklist[i].outbuf = NULL;
 	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);
+	socklist[i].outbuf = (char *) malloc(socklist[i].outbuflen - x);
 	egg_memcpy(socklist[i].outbuf, p + x, socklist[i].outbuflen - x);
 	socklist[i].outbuflen -= x;
-	nfree(p);
+	free(p);
       } else {
 	debug3(STR("dequeue_sockets(): errno = %d (%s) on %d"), errno,
                strerror(errno), socklist[i].sock);
@@ -1882,7 +1882,7 @@ int flush_inbuf(int idx)
           inbuf = socklist[i].inbuf;
           socklist[i].inbuf = NULL;
           dcc[idx].type->activity(idx, inbuf, len);
-          nfree(inbuf);
+          free(inbuf);
           return len;
         } else
           return -2;

+ 4 - 12
src/proto.h

@@ -141,6 +141,7 @@ void dupwait_notify(char *);
 char *rand_dccresp();
 
 /* dccutil.c */
+void *get_data_ptr(int);
 void dprintf EGG_VARARGS(int, arg1);
 void chatout EGG_VARARGS(char *, arg1);
 extern void (*shareout) ();
@@ -154,10 +155,8 @@ void makepass(char *);
 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);
@@ -189,7 +188,6 @@ void do_fork();
 int crontab_exists();
 void crontab_create(int);
 void fatal(const char *, int);
-int expected_memory(void);
 void eggContext(const char *, int, const char *);
 void eggContextNote(const char *, int, const char *, const char *);
 void eggAssert(const char *, int, const char *);
@@ -204,14 +202,11 @@ int _wild_match_per(register unsigned char *, register unsigned char *);
 
 /* mem.c */
 void *my_malloc(int);
-void *n_malloc(int, const char *, int);
 void *my_realloc(void *, int);
-void *n_realloc(void *, int, const char *, int);
 void my_free(void *);
-void n_free(void *, const char *, int);
-void tell_mem_status(char *);
-void tell_mem_status_dcc(int);
-void debug_mem_to_dcc(int);
+#ifdef S_GARBLESTRINGS
+char *degarble(int, char *);
+#endif /* S_GARBLESTRINGS */
 
 /* settings.c */
 char *progname();
@@ -250,9 +245,6 @@ char *werr_tostr(int);
 int listen_all(int, int);
 char *getfullbinname(char *);
 char *replace(char *, char *, char *);
-#ifdef S_GARBLESTRINGS
-char *degarble(int, char *);
-#endif /* S_GARBLESTRINGS */
 void detected(int, char *);
 int goodpass(char *, int, char *);
 void check_last();

+ 12 - 13
src/tcl.c

@@ -307,14 +307,14 @@ static int utf_converter(ClientData cdata, Tcl_Interp *myinterp, int objc,
   ClientData cd;
 
   objc += 5;
-  strings = (char **)nmalloc(sizeof(char *) * objc);
+  strings = (char **)malloc(sizeof(char *) * objc);
   egg_memset(strings, 0, sizeof(char *) * objc);
   diff = utftot;
   utftot += sizeof(char *) * objc;
   objc -= 5;
   for (i = 0; i < objc; i++) {
     byteptr = (char *)Tcl_GetByteArrayFromObj(objv[i], &len);
-    strings[i] = (char *)nmalloc(len+1);
+    strings[i] = (char *)malloc(len+1);
     utftot += len+1;
     strncpy(strings[i], byteptr, len);
     strings[i][len] = 0;
@@ -324,15 +324,15 @@ static int utf_converter(ClientData cdata, Tcl_Interp *myinterp, int objc,
   cd = (ClientData) callback_data[1];
   diff -= utftot;
   retval = func(cd, myinterp, objc, strings);
-  for (i = 0; i < objc; i++) nfree(strings[i]);
-  nfree(strings);
+  for (i = 0; i < objc; i++) free(strings[i]);
+  free(strings);
   utftot += diff;
   return(retval);
 }
 
 void cmd_delete_callback(ClientData cdata)
 {
-  nfree(cdata);
+  free(cdata);
   clientdata_stuff -= sizeof(void *) * 2;
 }
 
@@ -341,7 +341,7 @@ void add_tcl_commands(tcl_cmds *table)
   void **cdata;
 
   while (table->name) {
-    cdata = (void **)nmalloc(sizeof(void *) * 2);
+    cdata = (void **)malloc(sizeof(void *) * 2);
     clientdata_stuff += sizeof(void *) * 2;
     cdata[0] = table->func;
     cdata[1] = NULL;
@@ -452,7 +452,6 @@ void init_tcl(int argc, char **argv)
 {
 #if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION > 8)
   const char *encoding;
-  int i;
   char *langEnv;
 #endif
   int j;
@@ -586,7 +585,7 @@ void add_tcl_strings(tcl_strings *list)
   int tmp;
 
   for (i = 0; list[i].name; i++) {
-    st = (strinfo *) nmalloc(sizeof(strinfo));
+    st = (strinfo *) malloc(sizeof(strinfo));
     strtot += sizeof(strinfo);
     st->max = list[i].length - (list[i].flags & STR_DIR);
     if (list[i].flags & STR_PROTECT)
@@ -618,7 +617,7 @@ void rem_tcl_strings(tcl_strings *list)
 		   tcl_eggstr, st);
     if (st != NULL) {
       strtot -= sizeof(strinfo);
-      nfree(st);
+      free(st);
     }
   }
 }
@@ -629,7 +628,7 @@ void add_tcl_ints(tcl_ints *list)
   intinfo *ii;
 
   for (i = 0; list[i].name; i++) {
-    ii = nmalloc(sizeof(intinfo));
+    ii = malloc(sizeof(intinfo));
     strtot += sizeof(intinfo);
     ii->var = list[i].val;
     ii->ro = list[i].readonly;
@@ -660,7 +659,7 @@ void rem_tcl_ints(tcl_ints *list)
 		   tcl_eggint, (ClientData) ii);
     if (ii) {
       strtot -= sizeof(intinfo);
-      nfree(ii);
+      free(ii);
     }
   }
 }
@@ -673,7 +672,7 @@ void add_tcl_coups(tcl_coups *list)
   int i;
 
   for (i = 0; list[i].name; i++) {
-    cp = (coupletinfo *) nmalloc(sizeof(coupletinfo));
+    cp = (coupletinfo *) malloc(sizeof(coupletinfo));
     strtot += sizeof(coupletinfo);
     cp->left = list[i].lptr;
     cp->right = list[i].rptr;
@@ -702,7 +701,7 @@ void rem_tcl_coups(tcl_coups * list)
     Tcl_UntraceVar(interp, list[i].name,
 		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
 		   tcl_eggcouplet, (ClientData) cp);
-    nfree(cp);
+    free(cp);
   }
 }
 

+ 11 - 27
src/tclhash.c

@@ -45,28 +45,12 @@ static char *my_strdup(const char *s)
 {
 	char *t;
 
-	t = (char *)nmalloc(strlen(s)+1);
+	t = (char *)malloc(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;
-}
-
 extern cmd_t C_dcc[];
 
 void binds_init(void)
@@ -103,7 +87,7 @@ bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, in
 		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);
 	table->nargs = nargs;
@@ -132,15 +116,15 @@ void bind_table_del(bind_table_t *table)
 	}
 
 	/* 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);
 	}
 }
 
@@ -174,8 +158,8 @@ int bind_entry_del(bind_table_t *table, const char *flags, const char *mask, con
 	/* Delete it. */
 	if (prev) prev->next = entry->next;
 	else chain->entries = entry->next;
-	nfree(entry->function_name);
-	nfree(entry);
+	free(entry->function_name);
+	free(entry);
 
 	return(0);
 }
@@ -192,7 +176,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 
 	/* 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);
 		chain->next = table->chains;
@@ -212,10 +196,10 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 	}
 
 	/* 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;
 	}

+ 2 - 2
src/tcluser.c

@@ -340,7 +340,7 @@ static int tcl_setuser STDVAR
     (func[IRC_CHECK_THIS_USER]) (argv[1], 1, NULL);
   }
   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;
@@ -351,7 +351,7 @@ static int tcl_setuser STDVAR
   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> */
   }
   if (me && !strcmp(argv[2], "hosts") && argc == 4) {

+ 116 - 116
src/userent.c

@@ -43,8 +43,8 @@ void list_type_kill(struct list_type *t)
   while (t) {
     u = t->next;
     if (t->extra)
-      nfree(t->extra);
-    nfree(t);
+      free(t->extra);
+    free(t);
     t = u;
   }
 }
@@ -65,7 +65,7 @@ int def_pack(struct userrec *u, struct user_entry *e)
   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;
@@ -73,8 +73,8 @@ int def_pack(struct userrec *u, struct user_entry *e)
 
 int def_kill(struct user_entry *e)
 {
-  nfree(e->u.string);
-  nfree(e);
+  free(e->u.string);
+  free(e);
   return 1;
 }
 
@@ -106,7 +106,7 @@ int def_set(struct userrec *u, struct user_entry *e, void *buf)
       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);
 
@@ -117,7 +117,7 @@ int def_set(struct userrec *u, struct user_entry *e, void *buf)
      if ((unsigned int) *i < 32 && !strchr ("\002\003\026\037", *i))
         *i = '?';
   } else { /* string == NULL && e->u.string != NULL */
-    nfree(e->u.string);
+    free(e->u.string);
     e->u.string = NULL;
   }
   if (!noshare && !(u->flags & (USER_BOT | USER_UNSHARED))) {
@@ -257,10 +257,10 @@ int config_set(struct userrec *u, struct user_entry *e, void *buf)
   }
   if (!old && (!new->data || !new->data[0])) {
     /* delete non-existant entry */
-    nfree(new->key);
+    free(new->key);
     if (new->data)
-      nfree(new->data);
-    nfree(new);
+      free(new->data);
+    free(new);
     return 1;
   }
 
@@ -271,18 +271,18 @@ int config_set(struct userrec *u, struct user_entry *e, void *buf)
   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);
     } else {
       if (new->data)
-        nfree(new->data);
-      nfree(new->key);
-      nfree(new);
+        free(new->data);
+      free(new->key);
+      free(new);
     }
   }
   return 1;
@@ -299,14 +299,14 @@ int config_unpack(struct userrec *u, struct user_entry *e)
   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);
+      t->key = malloc(strlen(key) + 1);
       strcpy(t->key, key);
-      t->data = user_malloc(strlen(data) + 1);
+      t->data = malloc(strlen(data) + 1);
       strcpy(t->data, data);
       list_insert((&e->u.extra), t);
     }
@@ -325,15 +325,15 @@ int config_pack(struct userrec *u, struct user_entry *e)
   curr = e->u.extra;
   e->u.list = NULL;
   while (curr) {
-    t = user_malloc(sizeof(struct list_type));
+    t = malloc(sizeof(struct list_type));
 
-    t->extra = user_malloc(strlen(curr->key) + strlen(curr->data) + 4);
+    t->extra = malloc(strlen(curr->key) + strlen(curr->data) + 4);
     sprintf(t->extra, STR("%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;
@@ -379,13 +379,13 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
     return 1;
   }
 
-  xk = user_malloc(sizeof(struct xtra_key));
+  xk = malloc(sizeof(struct xtra_key));
   egg_bzero(xk, sizeof(struct xtra_key));
 
   l = strlen(arg);
   if (l > 1500)
     l = 1500;
-  xk->key = user_malloc(l + 1);
+  xk->key = malloc(l + 1);
   strncpyz(xk->key, arg, l + 1);
 
   if (buf && buf[0]) {
@@ -393,7 +393,7 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
 
     if (k > 1500 - l)
       k = 1500 - l;
-    xk->data = user_malloc(k + 1);
+    xk->data = malloc(k + 1);
     strncpyz(xk->data, buf, k + 1);
   }
   config_set(u, e, xk);
@@ -407,11 +407,11 @@ int config_dupuser(struct userrec *new, struct userrec *old, struct user_entry *
    *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);
+    x2->key = malloc(strlen(x1->key) + 1);
     strcpy(x2->key, x1->key);
-    x2->data = user_malloc(strlen(x1->data) + 1);
+    x2->data = malloc(strlen(x1->data) + 1);
     strcpy(x2->data, x1->data);
     set_user(&USERENTRY_CONFIG, new, x2);
   }
@@ -434,11 +434,11 @@ int config_kill(struct user_entry *e)
 
   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;
 }
 
@@ -569,7 +569,7 @@ int pass_set(struct userrec *u, struct user_entry *e, void *buf)
   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 {
@@ -586,7 +586,7 @@ int pass_set(struct userrec *u, struct user_entry *e, void *buf)
       strcpy(new, pass);
     else
       encrypt_pass(pass, new);
-    e->u.extra = user_malloc(strlen(new) + 1);
+    e->u.extra = malloc(strlen(new) + 1);
     strcpy(e->u.extra, new);
   }
   if (!noshare && !(u->flags & (USER_BOT | USER_UNSHARED)))
@@ -665,8 +665,8 @@ static int laston_unpack(struct userrec *u, struct user_entry *e)
   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);
@@ -682,12 +682,12 @@ static int laston_pack(struct userrec *u, struct user_entry *e)
 
   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));
+  e->u.list = malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc(l + 1);
+  e->u.list->extra = malloc(l + 1);
   strcpy(e->u.list->extra, work);
-  nfree(li->lastonplace);
-  nfree(li);
+  free(li->lastonplace);
+  free(li);
   return 1;
 }
 
@@ -706,9 +706,9 @@ static int laston_write_userfile(FILE * f,
 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;
 }
 
@@ -718,8 +718,8 @@ static int laston_set(struct userrec *u, struct user_entry *e, void *buf)
 
   if (li != buf) {
     if (li) {
-      nfree(li->lastonplace);
-      nfree(li);
+      free(li->lastonplace);
+      free(li);
     }
 
     li = e->u.extra = buf;
@@ -768,13 +768,13 @@ static int laston_tcl_set(Tcl_Interp * irp, struct userrec *u,
       }
   }
   /* Save globally */
-  li = user_malloc(sizeof(struct laston_info));
+  li = malloc(sizeof(struct laston_info));
 
   if (argc == 5) {
-    li->lastonplace = user_malloc(strlen(argv[4]) + 1);
+    li->lastonplace = malloc(strlen(argv[4]) + 1);
     strcpy(li->lastonplace, argv[4]);
   } else {
-    li->lastonplace = user_malloc(1);
+    li->lastonplace = malloc(1);
     li->lastonplace[0] = 0;
   }
   li->laston = atoi(argv[3]);
@@ -788,10 +788,10 @@ static int laston_dupuser(struct userrec *new, struct userrec *old,
   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);
+    li2->lastonplace = malloc(strlen(li->lastonplace) + 1);
     strcpy(li2->lastonplace, li->lastonplace);
     return set_user(&USERENTRY_LASTON, new, li2);
   }
@@ -820,7 +820,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
   char p[1024],
    *q1,
    *q2;
-  struct bot_addr *bi = user_malloc(sizeof(struct bot_addr));
+  struct bot_addr *bi = malloc(sizeof(struct bot_addr));
   egg_bzero(bi, sizeof(struct bot_addr));
 
   /* address:port/port:hublevel:uplink */
@@ -833,7 +833,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
   q1 = strchr(p, ':');
   if (q1)
     *q1++ = 0;
-  bi->address = user_malloc(strlen(p) + 1);
+  bi->address = malloc(strlen(p) + 1);
   strcpy(bi->address, p);
   if (q1) {
     q2 = strchr(q1, ':');
@@ -849,7 +849,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
       q1 = strchr(q2, ':');
       if (q1) {
         *q1++ = 0;
-        bi->uplink = user_malloc(strlen(q1) + 1);
+        bi->uplink = malloc(strlen(q1) + 1);
         strcpy(bi->uplink, q1);
 
       }
@@ -861,7 +861,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
   if (!bi->relay_port)
     bi->relay_port = bi->telnet_port;
   if (!bi->uplink) {
-    bi->uplink = user_malloc(1);
+    bi->uplink = malloc(1);
     bi->uplink[0] = 0;
   }
   list_type_kill(e->u.list);
@@ -879,23 +879,23 @@ static int botaddr_pack(struct userrec *u, struct user_entry *e)
   Assert(!e->name);
   bi = (struct bot_addr *) e->u.extra;
   l = simple_sprintf(work, STR("%s:%u/%u:%u:%s"), bi->address, bi->telnet_port, bi->relay_port, bi->hublevel, bi->uplink);
-  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);
+  e->u.list->extra = malloc(l + 1);
   strcpy(e->u.list->extra, work);
-  nfree(bi->address);
-  nfree(bi->uplink);
-  nfree(bi);
+  free(bi->address);
+  free(bi->uplink);
+  free(bi);
   return 1;
 }
 
 static int botaddr_kill(struct user_entry *e)
 {
-  nfree(((struct bot_addr *) (e->u.extra))->address);
-  nfree(((struct bot_addr *) (e->u.extra))->uplink);
-  nfree(e->u.extra);
-  nfree(e);
+  free(((struct bot_addr *) (e->u.extra))->address);
+  free(((struct bot_addr *) (e->u.extra))->uplink);
+  free(e->u.extra);
+  free(e);
   return 1;
 }
 
@@ -921,10 +921,10 @@ static int botaddr_set(struct userrec *u, struct user_entry *e, void *buf)
   if (bi != buf) {
     if (bi) {
       Assert(bi->address);
-      nfree(bi->address);
+      free(bi->address);
       Assert(bi->uplink);
-      nfree(bi->uplink);
-      nfree(bi);
+      free(bi->uplink);
+      free(bi);
     }
     ContextNote("(sharebug) occurred in botaddr_set");
     bi = e->u.extra = buf;
@@ -962,12 +962,12 @@ static int botaddr_tcl_set(Tcl_Interp *irp, struct userrec *u,
   if (u->flags & USER_BOT) {
     /* Silently ignore for users */
     if (!bi) {
-      bi = user_malloc(sizeof(struct bot_addr));
+      bi = malloc(sizeof(struct bot_addr));
       egg_bzero(bi, sizeof (struct bot_addr));
     } else {
-      nfree(bi->address);
+      free(bi->address);
     }
-    bi->address = user_malloc(strlen(argv[3]) + 1);
+    bi->address = malloc(strlen(argv[3]) + 1);
     strcpy(bi->address, argv[3]);
     if (argc > 4)
       bi->telnet_port = atoi(argv[4]);
@@ -1003,13 +1003,13 @@ static void botaddr_display(int idx, struct user_entry *e, struct userrec *u)
 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));
+  struct bot_addr *bi = malloc(sizeof(struct bot_addr));
   char *arg;
 
   egg_bzero(bi, sizeof(struct bot_addr));
 
   arg = newsplit(&buf);
-  bi->address = user_malloc(strlen(arg) + 1);
+  bi->address = malloc(strlen(arg) + 1);
   strcpy(bi->address, arg);
   arg = newsplit(&buf);
   bi->telnet_port = atoi(arg);
@@ -1017,7 +1017,7 @@ static int botaddr_gotshare(struct userrec *u, struct user_entry *e,
   bi->relay_port = atoi(arg);
   arg = newsplit(&buf);
   bi->hublevel = atoi(arg);
-  bi->uplink = user_malloc(strlen(buf) + 1);
+  bi->uplink = malloc(strlen(buf) + 1);
   strcpy(bi->uplink, buf);
   if (!bi->telnet_port)
     bi->telnet_port = 3333;
@@ -1034,13 +1034,13 @@ static int botaddr_dupuser(struct userrec *new, struct userrec *old,
      *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->hublevel = bi->hublevel;
-      bi2->address = user_malloc(strlen(bi->address) + 1);
-      bi2->uplink = user_malloc(strlen(bi->uplink) + 1);
+      bi2->address = malloc(strlen(bi->address) + 1);
+      bi2->uplink = malloc(strlen(bi->uplink) + 1);
       strcpy(bi2->address, bi->address);
       strcpy(bi2->uplink, bi->uplink);
       return set_user(&USERENTRY_BOTADDR, new, bi2);
@@ -1077,10 +1077,10 @@ int xtra_set(struct userrec *u, struct user_entry *e, void *buf)
   }
   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;
   }
 
@@ -1093,18 +1093,18 @@ int xtra_set(struct userrec *u, struct user_entry *e, void *buf)
   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;
 }
@@ -1115,12 +1115,12 @@ static int xtra_tcl_set(Tcl_Interp * irp, struct userrec *u,
   int l;
 
   BADARGS(4, 5, " handle type key ?value?");
-  xk = user_malloc(sizeof(struct xtra_key));
+  xk = malloc(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) {
@@ -1128,7 +1128,7 @@ static int xtra_tcl_set(Tcl_Interp * irp, struct userrec *u,
 
     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);
@@ -1144,14 +1144,14 @@ int xtra_unpack(struct userrec *u, struct user_entry *e)
   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);
+      t->key = malloc(strlen(key) + 1);
       strcpy(t->key, key);
-      t->data = user_malloc(strlen(data) + 1);
+      t->data = malloc(strlen(data) + 1);
       strcpy(t->data, data);
       list_insert((&e->u.extra), t);
     }
@@ -1169,14 +1169,14 @@ static int xtra_pack(struct userrec *u, struct user_entry *e)
   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;
@@ -1215,12 +1215,12 @@ static int xtra_gotshare(struct userrec *u, struct user_entry *e,
   if (!arg[0])
     return 1;
 
-  xk = user_malloc (sizeof(struct xtra_key));
+  xk = malloc (sizeof(struct xtra_key));
   egg_bzero(xk, 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]) {
@@ -1228,7 +1228,7 @@ static int xtra_gotshare(struct userrec *u, struct user_entry *e,
 
     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);
@@ -1241,11 +1241,11 @@ static int xtra_dupuser(struct userrec *new, struct userrec *old,
   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);
+    x2->key = malloc(strlen(x1->key) + 1);
     strcpy(x2->key, x1->key);
-    x2->data = user_malloc(strlen(x1->data) + 1);
+    x2->data = malloc(strlen(x1->data) + 1);
     strcpy(x2->data, x1->data);
     set_user(&USERENTRY_XTRA, new, x2);
   }
@@ -1267,11 +1267,11 @@ int xtra_kill(struct user_entry *e)
 
   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;
 }
 static int xtra_tcl_get(Tcl_Interp *irp, struct userrec *u,
@@ -1351,7 +1351,7 @@ static int hosts_write_userfile(FILE *f, struct userrec *u, struct user_entry *e
 static int hosts_kill(struct user_entry *e)
 {
   list_type_kill(e->u.list);
-  nfree(e);
+  free(e);
   return 1;
 }
 
@@ -1420,15 +1420,15 @@ static int hosts_set(struct userrec *u, struct user_entry *e, void *buf)
 	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);
+    (*t)->extra = malloc(strlen(host) + 1);
     strcpy((*t)->extra, host);
   }
   return 1;
@@ -1517,7 +1517,7 @@ int add_entry_type(struct user_entry_type *type)
     if (e && e->name) {
       e->type = type;
       e->type->unpack(u, e);
-      nfree(e->name);
+      free(e->name);
       e->name = NULL;
     }
   }
@@ -1533,7 +1533,7 @@ int del_entry_type(struct user_entry_type *type)
 
     if (e && !e->name) {
       e->type->pack(u, e);
-      e->name = user_malloc(strlen(e->type->name) + 1);
+      e->name = malloc(strlen(e->type->name) + 1);
       strcpy(e->name, e->type->name);
       e->type = NULL;
     }
@@ -1589,7 +1589,7 @@ int set_user(struct user_entry_type *et, struct userrec *u, void *d)
     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;
@@ -1599,7 +1599,7 @@ int set_user(struct user_entry_type *et, struct userrec *u, void *d)
   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;
 }

+ 25 - 53
src/userrec.c

@@ -38,34 +38,6 @@ extern struct cmd_pass *cmdpass;
 #endif /* S_DCCPASS */
 
 
-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 /* !DEBUG_MEM */
-  return nmalloc(size);
-#endif /* DEBUG_MEM */
-}
-
-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 /* !DEBUG_MEM */
-  return nrealloc(ptr, size);
-#endif /* DEBUG_MEM */
-}
-
 int count_users(struct userrec *bu)
 {
   int tot = 0;
@@ -170,12 +142,12 @@ void clear_masks(maskrec *m)
   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);
   }
 }
 
@@ -431,14 +403,14 @@ int write_userfile(int idx)
   if (userlist == NULL)
     return 1;			/* 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, 0600);
   if (f == NULL) {
     putlog(LOG_MISC, "*", USERF_ERRWRITE);
-    nfree(new_userfile);
+    free(new_userfile);
     return 2;
   }
   if (!quiet_save)
@@ -458,7 +430,7 @@ int write_userfile(int idx)
   if (!ok || fflush(f)) {
     putlog(LOG_MISC, "*", "%s (%s)", USERF_ERRWRITE, strerror(ferror(f)));
     fclose(f);
-    nfree(new_userfile);
+    free(new_userfile);
     return 3;
   }
   fclose(f);
@@ -466,7 +438,7 @@ int write_userfile(int idx)
   egg_snprintf(backup, sizeof backup, "%s%s~", tempdir, userfile);
   copyfile(userfile, backup);
   movefile(new_userfile, userfile);
-  nfree(new_userfile);
+  free(new_userfile);
   return 0;
 }
 int change_handle(struct userrec *u, char *newh)
@@ -506,7 +478,7 @@ struct userrec *adduser(struct userrec *bu, char *handle, char *host,
   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);
@@ -582,8 +554,8 @@ void freeuser(struct userrec *u)
     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) {
@@ -593,16 +565,16 @@ void freeuser(struct userrec *u)
 
       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)
@@ -652,8 +624,8 @@ int delhost_by_handle(char *handle, char *host)
     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;
@@ -668,8 +640,8 @@ int delhost_by_handle(char *handle, char *host)
 	  e->u.extra = q->next;
 	  qprev = NULL;
 	}
-	nfree(q->extra);
-	nfree(q);
+	free(q->extra);
+	free(q);
 	i++;
       } else
         qprev = q;
@@ -708,13 +680,13 @@ void touch_laston(struct userrec *u, char *where, time_t timeval)
     (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);
+      li->lastonplace = malloc(strlen(where) + 1);
       strcpy(li->lastonplace, where);
     } else
       li->lastonplace = NULL;
@@ -766,8 +738,8 @@ void user_del_chan(char *dname)
 	  u->chanrec = ch->next;
 
 	if (ch->info)
-	  nfree(ch->info);
-	nfree(ch);
+	  free(ch->info);
+	free(ch);
 	break;
       }
       och = ch;

+ 34 - 34
src/users.c

@@ -87,17 +87,17 @@ int delignore(char *ign)
 
       if (mask) {
 	shareout(NULL, STR("-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;
 }
@@ -113,23 +113,23 @@ void addignore(char *ign, char *from, char *mnote, time_t expire_time)
     }
 
   if (p == NULL) {
-    p = user_malloc(sizeof(struct igrec));
+    p = malloc(sizeof(struct igrec));
     p->next = global_ign;
     global_ign = p;
   } else {
-    nfree(p->igmask);
-    nfree(p->user);
-    nfree(p->msg);
+    free(p->igmask);
+    free(p->user);
+    free(p->msg);
   }
 
   p->expire = expire_time;
   p->added = now;
   p->flags = expire_time ? 0 : IGREC_PERM;
-  p->igmask = user_malloc(strlen(ign) + 1);
+  p->igmask = malloc(strlen(ign) + 1);
   strcpy(p->igmask, ign);
-  p->user = user_malloc(strlen(from) + 1);
+  p->user = malloc(strlen(from) + 1);
   strcpy(p->user, from);
-  p->msg = user_malloc(strlen(mnote) + 1);
+  p->msg = malloc(strlen(mnote) + 1);
   strcpy(p->msg, mnote);
   if (!noshare) {
     char *mask = str_escape(ign, ':', '\\');
@@ -137,7 +137,7 @@ void addignore(char *ign, char *from, char *mnote, time_t expire_time)
     if (mask) {
       shareout(NULL, STR("+i %s %lu %c %s %s\n"), mask, expire_time - now,
 	       (p->flags & IGREC_PERM) ? 'p' : '-', from, mnote);
-      nfree(mask);
+      free(mask);
     }
   }
 }
@@ -221,7 +221,7 @@ static void addmask_fully(struct chanset_t *chan, maskrec **m, maskrec **global,
 			 char *note, time_t expire_time, int flags,
 			 time_t added, time_t last)
 {
-  maskrec *p = user_malloc(sizeof(maskrec));
+  maskrec *p = malloc(sizeof(maskrec));
   maskrec **u = (chan) ? m : global;
 
   p->next = *u;
@@ -230,11 +230,11 @@ static void addmask_fully(struct chanset_t *chan, maskrec **m, maskrec **global,
   p->added = added;
   p->lastactive = last;
   p->flags = flags;
-  p->mask = user_malloc(strlen(mask) + 1);
+  p->mask = malloc(strlen(mask) + 1);
   strcpy(p->mask, mask);
-  p->user = user_malloc(strlen(from) + 1);
+  p->user = malloc(strlen(from) + 1);
   strcpy(p->user, from);
-  p->desc = user_malloc(strlen(note) + 1);
+  p->desc = malloc(strlen(note) + 1);
   strcpy(p->desc, note);
 }
 
@@ -430,19 +430,19 @@ static void restore_ignore(char *host)
 	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);
+      p->igmask = malloc(strlen(host) + 1);
       strcpy(p->igmask, host);
-      p->user = user_malloc(strlen(user) + 1);
+      p->user = malloc(strlen(user) + 1);
       strcpy(p->user, user);
       if (desc) {
-	p->msg = user_malloc(strlen(desc) + 1);
+	p->msg = malloc(strlen(desc) + 1);
 	strcpy(p->msg, desc);
       } else
 	p->msg = NULL;
@@ -712,7 +712,7 @@ int readuserfile(char *file, struct userrec **ret)
   fgets(cbuf, 180, f);
   temps = (char *) decrypt_string(SALT1, cbuf);
   egg_snprintf(s, 180, temps);
-  nfree(temps);
+  free(temps);
   if (s[1] < '4') {
     fatal(USERF_OLDFMT, 0);
   }
@@ -723,7 +723,7 @@ int readuserfile(char *file, struct userrec **ret)
     fgets(cbuf, 1024, f);
     temps = (char *) decrypt_string(SALT1, cbuf);
     egg_snprintf(s, 1024, temps);
-    nfree(temps);
+    free(temps);
     if (!feof(f)) {
       line++;
       if (s[0] != '#' && s[0] != ';' && s[0]) {
@@ -800,7 +800,7 @@ int readuserfile(char *file, struct userrec **ret)
 		  break;
 	      if (!cr) {
 		cr = (struct chanuserrec *)
-		  user_malloc(sizeof(struct chanuserrec));
+		  malloc(sizeof(struct chanuserrec));
 
 		cr->next = u->chanrec;
 		u->chanrec = cr;
@@ -809,7 +809,7 @@ int readuserfile(char *file, struct userrec **ret)
 		cr->flags = fr.chan;
 		cr->flags_udef = fr.udef_chan;
 		if (s[0]) {
-		  cr->info = (char *) user_malloc(strlen(s) + 1);
+		  cr->info = (char *) malloc(strlen(s) + 1);
 		  strcpy(cr->info, s);
 		} else
 		  cr->info = NULL;
@@ -912,24 +912,24 @@ int readuserfile(char *file, struct userrec **ret)
 	      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);
+		list->extra = malloc(strlen(s) + 1);
 		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);
+	      ue->u.list->extra = malloc(strlen(s) + 1);
 	      strcpy(ue->u.list->extra, s);
 	      list_insert((&u->entries), ue);
 	    }
@@ -1019,7 +1019,7 @@ int readuserfile(char *file, struct userrec **ret)
 	if (uet) {
 	  e->type = uet;
 	  uet->unpack(u, e);
-	  nfree(e->name);
+	  free(e->name);
 	  e->name = NULL;
 	}
       }
@@ -1259,7 +1259,7 @@ void autolink_cycle(char *start)
     if (glob_bot(fr) && strcmp(u->handle, botnetnick) && strcmp(u->handle, avoidbot) && (bot_hublevel(u) < 999)) {
       putlog(LOG_DEBUG, "@", STR("Adding %s to hublist"), u->handle);
       hl2 = hl;
-      hl = user_malloc(sizeof(struct hublist_entry));
+      hl = malloc(sizeof(struct hublist_entry));
       egg_bzero(hl, sizeof(struct hublist_entry));
 
       hl->next = hl2;
@@ -1277,7 +1277,7 @@ void autolink_cycle(char *start)
     }
     hlc--;
     hl2 = hl->next;
-    nfree(hl);
+    free(hl);
     hl = hl2;
   }
 }

+ 0 - 8
src/users.h

@@ -98,14 +98,6 @@ struct filesys_stats {
   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 /* MAKING_MODS */
-
 int add_entry_type(struct user_entry_type *);
 int del_entry_type(struct user_entry_type *);
 struct user_entry_type *find_entry_type(char *);