]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cmd.c
added PRVM_64 define which upgrades the QC VM to double precision
[xonotic/darkplaces.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index 51e946b299b54248eb2dea7c963cf401891f2516..4d615f1a23c9b1dcc8aed5cf04d85ef7ba077118 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -177,8 +177,8 @@ static sizebuf_t    cmd_text;
 static unsigned char           cmd_text_buf[CMDBUFSIZE];
 void *cmd_text_mutex = NULL;
 
-#define Cbuf_LockThreadMutex() (cmd_text_mutex ? Thread_LockMutex(cmd_text_mutex),1 : 0)
-#define Cbuf_UnlockThreadMutex() (cmd_text_mutex ? Thread_UnlockMutex(cmd_text_mutex),1 : 0)
+#define Cbuf_LockThreadMutex() (void)(cmd_text_mutex ? Thread_LockMutex(cmd_text_mutex) : 0)
+#define Cbuf_UnlockThreadMutex() (void)(cmd_text_mutex ? Thread_UnlockMutex(cmd_text_mutex) : 0)
 
 /*
 ============
@@ -463,7 +463,8 @@ static void Cmd_StuffCmds_f (void)
 static void Cmd_Exec(const char *filename)
 {
        char *f;
-       qboolean isdefaultcfg = strlen(filename) >= 11 && !strcmp(filename + strlen(filename) - 11, "default.cfg");
+       size_t filenameLen = strlen(filename);
+       qboolean isdefaultcfg = filenameLen >= 11 && !strcmp(filename + filenameLen - 11, "default.cfg");
 
        if (!strcmp(filename, "config.cfg"))
        {
@@ -968,6 +969,9 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t *
                {
                        memmove(p, p+1, strlen(p)); // with final NUL
                }
+               // if no function is left, NULL it
+               if(!*varfunc)
+                       varfunc = NULL;
        }
 
        if(varname[0] == '$')
@@ -1196,15 +1200,15 @@ static void Cmd_List_f (void)
        {
                partial = Cmd_Argv (1);
                len = strlen(partial);
+               ispattern = (strchr(partial, '*') || strchr(partial, '?'));
        }
        else
        {
                partial = NULL;
                len = 0;
+               ispattern = false;
        }
 
-       ispattern = partial && (strchr(partial, '*') || strchr(partial, '?'));
-
        count = 0;
        for (cmd = cmd_functions; cmd; cmd = cmd->next)
        {