[PATCH] Rename string tree structures

rb_string_root -> stree_root
rb_string_node -> stree_node

diff -urN a/NQ/cl_demo.c head/NQ/cl_demo.c
--- a/NQ/cl_demo.c	2006-02-18 13:21:44.000000000 +1030
+++ head/NQ/cl_demo.c	2006-02-19 12:13:39.000000000 +1030
@@ -314,14 +314,14 @@
 //      fscanf (cls.demofile, "%i\n", &cls.forcetrack);
 }
 
-struct rb_string_root *
+struct stree_root *
 CL_Demo_Arg_f(const char *arg)
 {
-    struct rb_string_root *root;
+    struct stree_root *root;
 
-    root = Z_Malloc(sizeof(struct rb_string_root));
+    root = Z_Malloc(sizeof(struct stree_root));
     if (root) {
-	*root = RB_STRING_ROOT;
+	*root = STREE_ROOT;
 	ST_AllocInit();
 	COM_ScanDir(root, "", arg, ".dem", true);
     }
diff -urN a/NQ/client.h head/NQ/client.h
--- a/NQ/client.h	2006-02-18 13:21:44.000000000 +1030
+++ head/NQ/client.h	2006-02-19 12:13:29.000000000 +1030
@@ -343,7 +343,7 @@
 
 void CL_TimeDemo_f(void);
 void CL_PlayDemo_f(void);
-struct rb_string_root *CL_Demo_Arg_f(const char *arg);
+struct stree_root *CL_Demo_Arg_f(const char *arg);
 
 //
 // cl_parse.c
diff -urN a/NQ/cmd.c head/NQ/cmd.c
--- a/NQ/cmd.c	2006-02-18 12:22:40.000000000 +1030
+++ head/NQ/cmd.c	2006-02-19 12:13:15.000000000 +1030
@@ -668,11 +668,11 @@
  * Return a string tree with all possible argument completions of the given
  * buffer for the given command.
  */
-struct rb_string_root *
+struct stree_root *
 Cmd_ArgCompletions(const char *name, const char *buf)
 {
     cmd_function_t *cmd;
-    struct rb_string_root *root = NULL;
+    struct stree_root *root = NULL;
 
     for (cmd = cmd_functions; cmd; cmd = cmd->next) {
 	if (!strcasecmp(name, cmd->name) && cmd->completion) {
@@ -693,7 +693,7 @@
 Cmd_ArgComplete(const char *name, const char *buf)
 {
     char *result = NULL;
-    struct rb_string_root *root;
+    struct stree_root *root;
 
     root = Cmd_ArgCompletions(name, buf);
     if (root) {
diff -urN a/NQ/cmd.h head/NQ/cmd.h
--- a/NQ/cmd.h	2006-02-18 12:22:40.000000000 +1030
+++ head/NQ/cmd.h	2006-02-19 12:13:55.000000000 +1030
@@ -86,7 +86,7 @@
  * Returns a string tree of possible completions
  * Requires ST_Alloc_Init() prior to calling
  */
-typedef struct rb_string_root *(*cmd_arg_f)(const char *);
+typedef struct stree_root *(*cmd_arg_f)(const char *);
 
 typedef enum {
     src_client,			// came in over a net connection as a clc_stringcmd
@@ -101,7 +101,7 @@
 void Cmd_AddCommand(const char *cmd_name, xcommand_t function);
 void Cmd_SetCompletion(const char *cmd_name, cmd_arg_f completion);
 char *Cmd_ArgComplete(const char *name, const char *buf);
-struct rb_string_root *Cmd_ArgCompletions(const char *name, const char *buf);
+struct stree_root *Cmd_ArgCompletions(const char *name, const char *buf);
 
 // called by the init functions of other parts of the program to
 // register commands and functions to call for them.
diff -urN a/NQ/common.c head/NQ/common.c
--- a/NQ/common.c	2006-02-19 11:18:28.000000000 +1030
+++ head/NQ/common.c	2006-02-19 12:12:48.000000000 +1030
@@ -1318,7 +1318,7 @@
 }
 
 static void
-COM_ScanDirDir(struct rb_string_root *root, DIR *dir, const char *pfx,
+COM_ScanDirDir(struct stree_root *root, DIR *dir, const char *pfx,
 	       const char *ext, qboolean stripext)
 {
     int pfx_len, ext_len;
@@ -1346,7 +1346,7 @@
 }
 
 static void
-COM_ScanDirPak(struct rb_string_root *root, pack_t *pak, const char *pfx,
+COM_ScanDirPak(struct stree_root *root, pack_t *pak, const char *pfx,
 	       const char *ext, qboolean stripext)
 {
     int i, pfx_len, ext_len;
@@ -1388,7 +1388,7 @@
 ============
 */
 void
-COM_ScanDir(struct rb_string_root *root, const char *path, const char *pfx,
+COM_ScanDir(struct stree_root *root, const char *path, const char *pfx,
 	    const char *ext, qboolean stripext)
 {
     searchpath_t *search;
diff -urN a/NQ/common.h head/NQ/common.h
--- a/NQ/common.h	2006-02-18 10:55:26.000000000 +1030
+++ head/NQ/common.h	2006-02-19 12:12:39.000000000 +1030
@@ -161,7 +161,7 @@
 int COM_OpenFile(const char *filename, int *hndl);
 int COM_FOpenFile(const char *filename, FILE **file);
 void COM_CloseFile(int h);
-void COM_ScanDir(struct rb_string_root *root, const char *path,
+void COM_ScanDir(struct stree_root *root, const char *path,
 		 const char *pfx, const char *ext, qboolean stripext);
 
 byte *COM_LoadStackFile(const char *path, void *buffer, int bufsize,
diff -urN a/NQ/host_cmd.c head/NQ/host_cmd.c
--- a/NQ/host_cmd.c	2006-02-18 12:26:40.000000000 +1030
+++ head/NQ/host_cmd.c	2006-02-19 12:12:19.000000000 +1030
@@ -299,14 +299,14 @@
     }
 }
 
-static struct rb_string_root *
+static struct stree_root *
 Host_Map_Arg_f(const char *arg)
 {
-    struct rb_string_root *root;
+    struct stree_root *root;
 
-    root = Z_Malloc(sizeof(struct rb_string_root));
+    root = Z_Malloc(sizeof(struct stree_root));
     if (root) {
-	*root = RB_STRING_ROOT;
+	*root = STREE_ROOT;
 
 	ST_AllocInit();
 	COM_ScanDir(root, "maps", arg, ".bsp", true);
diff -urN a/QW/client/cl_demo.c head/QW/client/cl_demo.c
--- a/QW/client/cl_demo.c	2006-02-18 13:21:44.000000000 +1030
+++ head/QW/client/cl_demo.c	2006-02-19 12:12:00.000000000 +1030
@@ -751,14 +751,14 @@
     realtime = 0;
 }
 
-struct rb_string_root *
+struct stree_root *
 CL_Demo_Arg_f(const char *arg)
 {
-    struct rb_string_root *root;
+    struct stree_root *root;
 
-    root = Z_Malloc(sizeof(struct rb_string_root));
+    root = Z_Malloc(sizeof(struct stree_root));
     if (root) {
-	*root = RB_STRING_ROOT;
+	*root = STREE_ROOT;
 	ST_AllocInit();
 	COM_ScanDir(root, "", arg, ".qwd", true);
     }
diff -urN a/QW/client/client.h head/QW/client/client.h
--- a/QW/client/client.h	2006-02-18 13:21:44.000000000 +1030
+++ head/QW/client/client.h	2006-02-19 12:11:47.000000000 +1030
@@ -435,7 +435,7 @@
 
 void CL_PlayDemo_f(void);
 void CL_TimeDemo_f(void);
-struct rb_string_root *CL_Demo_Arg_f(const char *arg);
+struct stree_root *CL_Demo_Arg_f(const char *arg);
 
 //
 // cl_parse.c
diff -urN a/QW/client/cmd.h head/QW/client/cmd.h
--- a/QW/client/cmd.h	2006-02-18 12:22:40.000000000 +1030
+++ head/QW/client/cmd.h	2006-02-19 12:11:32.000000000 +1030
@@ -80,14 +80,14 @@
  * Returns a string tree of possible completions
  * Requires ST_Alloc_Init() prior to calling
  */
-typedef struct rb_string_root *(*cmd_arg_f)(const char *);
+typedef struct stree_root *(*cmd_arg_f)(const char *);
 
 void Cmd_Init(void);
 
 void Cmd_AddCommand(const char *cmd_name, xcommand_t function);
 void Cmd_SetCompletion(const char *cmd_name, cmd_arg_f completion);
 char *Cmd_ArgComplete(const char *name, const char *buf);
-struct rb_string_root *Cmd_ArgCompletions(const char *name, const char *buf);
+struct stree_root *Cmd_ArgCompletions(const char *name, const char *buf);
 
 // called by the init functions of other parts of the program to
 // register commands and functions to call for them.
diff -urN a/QW/client/common.h head/QW/client/common.h
--- a/QW/client/common.h	2006-02-18 10:55:26.000000000 +1030
+++ head/QW/client/common.h	2006-02-19 12:11:13.000000000 +1030
@@ -176,7 +176,7 @@
 void COM_WriteFile(const char *filename, const void *data, int len);
 int COM_FOpenFile(const char *filename, FILE **file);
 void COM_CloseFile(FILE *h);
-void COM_ScanDir(struct rb_string_root *root, const char *path,
+void COM_ScanDir(struct stree_root *root, const char *path,
 		 const char *pfx, const char *ext, qboolean stripext);
 
 byte *COM_LoadStackFile(const char *path, void *buffer, int bufsize,
diff -urN a/QW/common/cmd.c head/QW/common/cmd.c
--- a/QW/common/cmd.c	2006-02-18 12:22:40.000000000 +1030
+++ head/QW/common/cmd.c	2006-02-19 12:10:54.000000000 +1030
@@ -708,11 +708,11 @@
  * Return a string tree with all possible argument completions of the given
  * buffer for the given command.
  */
-struct rb_string_root *
+struct stree_root *
 Cmd_ArgCompletions(const char *name, const char *buf)
 {
     cmd_function_t *cmd;
-    struct rb_string_root *root = NULL;
+    struct stree_root *root = NULL;
 
     for (cmd = cmd_functions; cmd; cmd = cmd->next) {
 	if (!strcasecmp(name, cmd->name) && cmd->completion) {
@@ -733,7 +733,7 @@
 Cmd_ArgComplete(const char *name, const char *buf)
 {
     char *result = NULL;
-    struct rb_string_root *root;
+    struct stree_root *root;
 
     root = Cmd_ArgCompletions(name, buf);
     if (root) {
diff -urN a/QW/common/common.c head/QW/common/common.c
--- a/QW/common/common.c	2006-02-19 11:18:28.000000000 +1030
+++ head/QW/common/common.c	2006-02-19 12:10:39.000000000 +1030
@@ -1406,7 +1406,7 @@
 }
 
 static void
-COM_ScanDirDir(struct rb_string_root *root, DIR *dir, const char *pfx,
+COM_ScanDirDir(struct stree_root *root, DIR *dir, const char *pfx,
 	       const char *ext, qboolean stripext)
 {
     int pfx_len, ext_len;
@@ -1434,7 +1434,7 @@
 }
 
 static void
-COM_ScanDirPak(struct rb_string_root *root, pack_t *pak, const char *pfx,
+COM_ScanDirPak(struct stree_root *root, pack_t *pak, const char *pfx,
 	       const char *ext, qboolean stripext)
 {
     int i, pfx_len, ext_len;
@@ -1476,7 +1476,7 @@
 ============
 */
 void
-COM_ScanDir(struct rb_string_root *root, const char *path, const char *pfx,
+COM_ScanDir(struct stree_root *root, const char *path, const char *pfx,
 	    const char *ext, qboolean stripext)
 {
     searchpath_t *search;
diff -urN a/QW/server/sv_ccmds.c head/QW/server/sv_ccmds.c
--- a/QW/server/sv_ccmds.c	2006-02-18 12:26:40.000000000 +1030
+++ head/QW/server/sv_ccmds.c	2006-02-19 12:09:58.000000000 +1030
@@ -339,14 +339,14 @@
     SV_BroadcastCommand("reconnect\n");
 }
 
-static struct rb_string_root *
+static struct stree_root *
 SV_Map_Arg_f(const char *arg)
 {
-    struct rb_string_root *root;
+    struct stree_root *root;
 
-    root = Z_Malloc(sizeof(struct rb_string_root));
+    root = Z_Malloc(sizeof(struct stree_root));
     if (root) {
-	*root = RB_STRING_ROOT;
+	*root = STREE_ROOT;
 
 	ST_AllocInit();
 	COM_ScanDir(root, "maps", arg, ".bsp", true);
diff -urN a/common/console.c head/common/console.c
--- a/common/console.c	2006-02-18 11:34:50.000000000 +1030
+++ head/common/console.c	2006-02-19 12:14:57.000000000 +1030
@@ -714,11 +714,11 @@
 Con_ShowTree_Populate(struct rb_node *n)
 {
     if (n) {
-	struct rb_string_node *sn;
+	struct stree_node *sn;
 
 	Con_ShowTree_Populate(n->rb_left);
 
-	sn = rb_entry(n, struct rb_string_node, node);
+	sn = rb_entry(n, struct stree_node, node);
 	showtree_list[showtree_idx++] = sn->string;
 
 	Con_ShowTree_Populate(n->rb_right);
@@ -726,7 +726,7 @@
 }
 
 void
-Con_ShowTree(struct rb_string_root *root)
+Con_ShowTree(struct stree_root *root)
 {
     /* FIXME - cheating with malloc */
     showtree_list = malloc(root->entries * sizeof(char *));
@@ -742,7 +742,7 @@
 void
 Con_Maplist_f()
 {
-    struct rb_string_root st_root = RB_STRING_ROOT;
+    struct stree_root st_root = STREE_ROOT;
     char *pfx = NULL;
 
     if (Cmd_Argc() == 2)
diff -urN a/common/keys.c head/common/keys.c
--- a/common/keys.c	2006-02-18 12:22:40.000000000 +1030
+++ head/common/keys.c	2006-02-19 12:07:22.000000000 +1030
@@ -283,7 +283,7 @@
 	    cmd[len] = 0;
 
 	    if (command_exists(cmd)) {
-		struct rb_string_root *root;
+		struct stree_root *root;
 
 		s += len;
 		while (*s == ' ')
@@ -320,6 +320,7 @@
     }
     Cbuf_AddText("\n");
 }
+
 /*
 ====================
 Key_Console
diff -urN a/common/shell.c head/common/shell.c
--- a/common/shell.c	2006-02-18 12:13:04.000000000 +1030
+++ head/common/shell.c	2006-02-19 12:14:38.000000000 +1030
@@ -38,7 +38,7 @@
  * hunk space by keeping the tree nodes together in blocks and allocating
  * strings right next to each other.
  */
-static struct rb_string_node *st_node_next;
+static struct stree_node *st_node_next;
 static int st_node_space;
 static char *st_string_next;
 static int st_string_space;
@@ -57,18 +57,18 @@
     st_string_space = 0;
 }
 
-struct rb_string_node *
+struct stree_node *
 ST_AllocNode(void)
 {
-    struct rb_string_node *ret = NULL;
+    struct stree_node *ret = NULL;
 
-    if (st_node_space < sizeof(struct rb_string_node)) {
+    if (st_node_space < sizeof(struct stree_node)) {
 	st_node_next = Hunk_TempAllocExtend(ST_NODE_CHUNK);
 	st_node_space = st_node_next ? ST_NODE_CHUNK : 0;
     }
-    if (st_node_space >= sizeof(struct rb_string_node)) {
+    if (st_node_space >= sizeof(struct stree_node)) {
 	ret = st_node_next++;
-	st_node_space -= sizeof(struct rb_string_node);
+	st_node_space -= sizeof(struct stree_node);
     }
 
     return ret;
@@ -103,17 +103,17 @@
  * Insert string node "node" into rb_tree rooted at "root"
  */
 qboolean
-ST_Insert(struct rb_string_root *root, struct rb_string_node *node)
+ST_Insert(struct stree_root *root, struct stree_node *node)
 {
     struct rb_node **p = &root->root.rb_node;
     struct rb_node *parent = NULL;
-    struct rb_string_node *sn;
+    struct stree_node *sn;
     unsigned int len;
     int cmp;
 
     while (*p) {
 	parent = *p;
-	sn = rb_entry(parent, struct rb_string_node, node);
+	sn = rb_entry(parent, struct stree_node, node);
 	cmp = strcasecmp(node->string, sn->string);
 	if (cmp < 0)
 	    p = &(*p)->rb_left;
@@ -140,8 +140,8 @@
  * NOTE: These allocations are only on the Temp hunk.
  */
 qboolean
-ST_InsertAlloc(struct rb_string_root *root, const char *s,
-	       struct rb_string_node *n)
+ST_InsertAlloc(struct stree_root *root, const char *s,
+	       struct stree_node *n)
 {
     qboolean ret = false;
 
@@ -161,13 +161,13 @@
 static int
 ST_node_match(struct rb_node *n, const char *str, int min_match, int max_match)
 {
-    struct rb_string_node *sn;
+    struct stree_node *sn;
 
     if (n) {
 	max_match = ST_node_match(n->rb_left, str, min_match, max_match);
 
 	/* How much does this node match */
-	sn = rb_entry(n, struct rb_string_node, node);
+	sn = rb_entry(n, struct stree_node, node);
 	while (max_match > min_match) {
 	    if (!strncasecmp(str, sn->string, max_match))
 		break;
@@ -185,11 +185,11 @@
  * the tree which match the given prefix.
  */
 char *
-ST_MaxMatch(struct rb_string_root *root, const char *pfx)
+ST_MaxMatch(struct stree_root *root, const char *pfx)
 {
     int max_match, min_match, match;
     struct rb_node *n;
-    struct rb_string_node *sn;
+    struct stree_node *sn;
     char *result = NULL;
 
     /* Can't be more than the shortest string */
@@ -197,7 +197,7 @@
     min_match = strlen(pfx);
 
     n = root->root.rb_node;
-    sn = rb_entry(n, struct rb_string_node, node);
+    sn = rb_entry(n, struct stree_node, node);
 
     if (root->entries == 1) {
 	match = strlen(sn->string);
diff -urN a/include/console.h head/include/console.h
--- a/include/console.h	2006-02-18 11:34:50.000000000 +1030
+++ head/include/console.h	2006-02-19 12:09:33.000000000 +1030
@@ -56,7 +56,7 @@
 void Con_ClearNotify(void);
 void Con_ToggleConsole_f(void);
 void Con_ShowList(const char **list, int cnt, int maxlen);
-void Con_ShowTree(struct rb_string_root *root);
+void Con_ShowTree(struct stree_root *root);
 
 // during startup for sound / cd warnings
 void Con_NotifyBox(char *text);
diff -urN a/include/shell.h head/include/shell.h
--- a/include/shell.h	2006-02-18 12:13:04.000000000 +1030
+++ head/include/shell.h	2006-02-19 12:14:17.000000000 +1030
@@ -28,29 +28,29 @@
  * We keep track of the number of entries in the tree as well as the longest
  * entry in the tree. This info is used for displaying lists on the console.
  */
-struct rb_string_root {
+struct stree_root {
     unsigned int entries;
     unsigned int maxlen;
     unsigned int minlen;
     struct rb_root root;
 };
 
-#define RB_STRING_ROOT (struct rb_string_root) { 0, 0, -1, RB_ROOT }
+#define STREE_ROOT (struct stree_root) { 0, 0, -1, RB_ROOT }
 
 /*
  * String node is simply an rb_tree node using the string as the index (and
  * the only data as well).
  */
-struct rb_string_node {
+struct stree_node {
     char *string;
     struct rb_node node;
 };
 
 void ST_AllocInit(void);
-qboolean ST_Insert(struct rb_string_root *root, struct rb_string_node *node);
-qboolean ST_InsertAlloc(struct rb_string_root *root, const char *s,
-			struct rb_string_node *n);
-char *ST_MaxMatch(struct rb_string_root *root, const char *pfx);
+qboolean ST_Insert(struct stree_root *root, struct stree_node *node);
+qboolean ST_InsertAlloc(struct stree_root *root, const char *s,
+			struct stree_node *n);
+char *ST_MaxMatch(struct stree_root *root, const char *pfx);
 
 /*
  * Set up some basic completion helpers
