Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-09-27 03:54:56 UTC

Modified files:
     ChangeLog ircd/parse.c

Log message:

Fix pseudo handling on rehash (#1305452).

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.707 ircu2.10/ChangeLog:1.708
--- ircu2.10/ChangeLog:1.707    Mon Sep 26 19:41:57 2005
+++ ircu2.10/ChangeLog  Mon Sep 26 20:54:46 2005
@@ -1,5 +1,10 @@
 2005-09-26  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/parse.c (del_msg_element): Only delete empty subtrees, and
+       leave subtrees that may still contain data.
+
+2005-09-26  Michael Poole <[EMAIL PROTECTED]>
+
        * include/channel.h (struct ModeBuf): Add mbm_oplevel to args
        array.
        (MB_OPLEVEL): New corresponding macro.
Index: ircu2.10/ircd/parse.c
diff -u ircu2.10/ircd/parse.c:1.53 ircu2.10/ircd/parse.c:1.54
--- ircu2.10/ircd/parse.c:1.53  Fri Aug 19 04:46:52 2005
+++ ircu2.10/ircd/parse.c       Mon Sep 26 20:54:46 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Parse input from IRC clients and other servers.
- * @version $Id: parse.c,v 1.53 2005/08/19 11:46:52 entrope Exp $
+ * @version $Id: parse.c,v 1.54 2005/09/27 03:54:46 entrope Exp $
  */
 #include "config.h"
 
@@ -678,20 +678,28 @@
  * @param[in,out] mtree_p Trie node to remove command from.
  * @param[in] cmd Text of command to remove.
  */
-void
+struct MessageTree *
 del_msg_element(struct MessageTree *mtree_p, char *cmd)
 {
-  struct MessageTree *ntree_p;
+  int slot = *cmd & (MAXPTRLEN-1);
 
+  /* Either remove leaf message or from appropriate child. */
   if (*cmd == '\0')
-    return;
+    mtree_p->msg = NULL;
+  else
+    mtree_p->pointers[slot] = del_msg_element(mtree_p->pointers[slot], cmd + 
1);
 
-  if ((ntree_p = mtree_p->pointers[*cmd & (MAXPTRLEN-1)]) != NULL)
-  {
-    del_msg_element(ntree_p, cmd+1);
-    MyFree(ntree_p);
-    mtree_p->pointers[*cmd & (MAXPTRLEN-1)] = NULL;
-  }
+  /* If current message or any child still exists, keep this node. */
+  if (mtree_p->msg)
+    return mtree_p;
+  for (slot = 0; slot < MAXPTRLEN; ++slot)
+    if (mtree_p->pointers[slot])
+      return mtree_p;
+
+  /* Otherwise, if we're not a root node, free it and return null. */
+  if (mtree_p != &msg_tree && mtree_p != &tok_tree)
+    MyFree(mtree_p);
+  return NULL;
 }
 
 /** Initialize the message lookup trie with all known commands. */
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to