[cvslog] (2002-08-09 23:44:18 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Fri Aug 9 18:45:03 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2002-08-09 23:44:18 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/tclhash.c src/tclhash.h

Log message:

* Beginning of load-order independent bind tables

---------------------- diff included ----------------------
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.71 eggdrop1.7/src/tclhash.c:1.72
--- eggdrop1.7/src/tclhash.c:1.71	Sun May 26 03:34:13 2002
+++ eggdrop1.7/src/tclhash.c	Fri Aug  9 18:44:07 2002
@@ -28,7 +28,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tclhash.c,v 1.71 2002/05/26 08:34:13 stdarg Exp $";
+static const char rcsid[] = "$Id: tclhash.c,v 1.72 2002/08/09 23:44:07 stdarg Exp $";
 #endif
 
 #include "main.h"
@@ -115,17 +115,22 @@
 	bind_table_t *table;
 
 	for (table = bind_table_list_head; table; table = table->next) {
-		if (!strcmp(table->name, name)) return(table);
+		if (!strcmp(table->name, name)) break;
 	}
-	/* Nope, we have to create a new one. */
-	table = (bind_table_t *)calloc(1, sizeof(*table));
-	table->name = strdup(name);
+
+	/* If it doesn't exist, create it. */
+	if (!table) {
+		table = (bind_table_t *)calloc(1, sizeof(*table));
+		table->name = strdup(name);
+		table->next = bind_table_list_head;
+		bind_table_list_head = table;
+	}
+	else if (!(table->flags & BIND_FAKE)) return(table);
+
 	table->nargs = nargs;
-	table->syntax = strdup(syntax);
+	if (syntax) table->syntax = strdup(syntax);
 	table->match_type = match_type;
 	table->flags = flags;
-	table->next = bind_table_list_head;
-	bind_table_list_head = table;
 	return(table);
 }
 
@@ -177,6 +182,15 @@
 	return(table);
 }
 
+bind_table_t *bind_table_lookup_or_fake(const char *name)
+{
+	bind_table_t *table;
+
+	table = bind_table_lookup(name);
+	if (!table) table = bind_table_add(name, 0, NULL, 0, BIND_FAKE);
+	return(table);
+}
+
 /* Look up a bind entry based on either function name or id. */
 bind_entry_t *bind_entry_lookup(bind_table_t *table, int id, const char *mask, const char *function_name)
 {
@@ -481,8 +495,7 @@
 	char name[50];
 	bind_table_t *table;
 
-	table = bind_table_lookup(table_name);
-	if (!table) return;
+	table = bind_table_lookup_or_fake(table_name);
 
 	for (; cmds->name; cmds++) {
 		snprintf(name, 50, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.32 eggdrop1.7/src/tclhash.h:1.33
--- eggdrop1.7/src/tclhash.h:1.32	Sun May 26 03:34:13 2002
+++ eggdrop1.7/src/tclhash.h	Fri Aug  9 18:44:07 2002
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: tclhash.h,v 1.32 2002/05/26 08:34:13 stdarg Exp $
+ * $Id: tclhash.h,v 1.33 2002/08/09 23:44:07 stdarg Exp $
  */
 
 #ifndef _TCLHASH_H_
@@ -37,12 +37,12 @@
 /* Flags for binds. */
 /* Does the callback want their client_data inserted as the first argument? */
 #define BIND_WANTS_CD 1
-
 #define BIND_USE_ATTR	2
 #define BIND_STRICT_ATTR	4
 #define BIND_BREAKABLE	8
 #define BIND_STACKABLE	16
 #define BIND_DELETED	32
+#define BIND_FAKE	64
 
 /* Flags for return values from bind callbacks */
 #define BIND_RET_LOG 1
----------------------- End of diff -----------------------



More information about the Changes mailing list