]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Cleanups
authorDale Weiler <killfieldengine@gmail.com>
Tue, 15 Oct 2013 00:58:36 +0000 (20:58 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Tue, 15 Oct 2013 00:58:36 +0000 (20:58 -0400)
ast.c
exec.c
include.mk
msvc.c

diff --git a/ast.c b/ast.c
index 362a06f4e43da901d3ef44c6aa82c5132fc3b64f..cf03e017d9c418a959c838a74387c73c14e815ad 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -529,10 +529,8 @@ ast_unary* ast_unary_new(lex_ctx_t ctx, int op,
         ast_unary *prev = (ast_unary*)((ast_unary*)expr)->operand;
 
         /* Handle for double negation */
         ast_unary *prev = (ast_unary*)((ast_unary*)expr)->operand;
 
         /* Handle for double negation */
-        if ((((ast_unary*)expr)->op == VINSTR_NEG_V && op == VINSTR_NEG_V) ||
-            (((ast_unary*)expr)->op == VINSTR_NEG_F && op == VINSTR_NEG_F)) {
+        if ((((ast_unary*)expr)->op == op))
             prev = (ast_unary*)((ast_unary*)expr)->operand;
             prev = (ast_unary*)((ast_unary*)expr)->operand;
-        }
 
         if (ast_istype(prev, ast_unary)) {
             ast_expression_delete((ast_expression*)self);
 
         if (ast_istype(prev, ast_unary)) {
             ast_expression_delete((ast_expression*)self);
diff --git a/exec.c b/exec.c
index ebbfa903f217cab55a179fcde2ebe66972697a1a..43d1980ed1a12895b516a2c29cbf776def1ff710 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -914,7 +914,7 @@ int main(int argc, char **argv) {
 
     if (argc < 2) {
         usage();
 
     if (argc < 2) {
         usage();
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     while (argc > 1) {
     }
 
     while (argc > 1) {
@@ -923,7 +923,7 @@ int main(int argc, char **argv) {
             !strcmp(argv[1], "--help"))
         {
             usage();
             !strcmp(argv[1], "--help"))
         {
             usage();
-            exit(0);
+            exit(EXIT_SUCCESS);
         }
         else if (!strcmp(argv[1], "-v")) {
             ++opts_v;
         }
         else if (!strcmp(argv[1], "-v")) {
             ++opts_v;
@@ -937,7 +937,7 @@ int main(int argc, char **argv) {
                     ++opts_v;
                 else {
                     usage();
                     ++opts_v;
                 else {
                     usage();
-                    exit(1);
+                    exit(EXIT_FAILURE);
                 }
             }
             --argc;
                 }
             }
             --argc;
@@ -947,7 +947,7 @@ int main(int argc, char **argv) {
                  !strcmp(argv[1], "--version"))
         {
             version();
                  !strcmp(argv[1], "--version"))
         {
             version();
-            exit(0);
+            exit(EXIT_SUCCESS);
         }
         else if (!strcmp(argv[1], "-trace")) {
             --argc;
         }
         else if (!strcmp(argv[1], "-trace")) {
             --argc;
@@ -976,7 +976,7 @@ int main(int argc, char **argv) {
             ++argv;
             if (argc <= 1) {
                 usage();
             ++argv;
             if (argc <= 1) {
                 usage();
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             vec_push(dis_list, argv[1]);
             --argc;
             }
             vec_push(dis_list, argv[1]);
             --argc;
@@ -1019,7 +1019,7 @@ int main(int argc, char **argv) {
             ++argv;
             if (argc < 2) {
                 usage();
             ++argv;
             if (argc < 2) {
                 usage();
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             p.value = argv[1];
 
             }
             p.value = argv[1];
 
@@ -1036,7 +1036,7 @@ int main(int argc, char **argv) {
             if (progsfile) {
                 fprintf(stderr, "only 1 program file may be specified\n");
                 usage();
             if (progsfile) {
                 fprintf(stderr, "only 1 program file may be specified\n");
                 usage();
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             progsfile = argv[1];
             --argc;
             }
             progsfile = argv[1];
             --argc;
@@ -1046,7 +1046,7 @@ int main(int argc, char **argv) {
         {
             fprintf(stderr, "unknown parameter: %s\n", argv[1]);
             usage();
         {
             fprintf(stderr, "unknown parameter: %s\n", argv[1]);
             usage();
-            exit(1);
+            exit(EXIT_FAILURE);
         }
     }
 
         }
     }
 
@@ -1059,13 +1059,13 @@ int main(int argc, char **argv) {
     if (!progsfile) {
         fprintf(stderr, "must specify a program to execute\n");
         usage();
     if (!progsfile) {
         fprintf(stderr, "must specify a program to execute\n");
         usage();
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     prog = prog_load(progsfile, noexec);
     if (!prog) {
         fprintf(stderr, "failed to load program '%s'\n", progsfile);
     }
 
     prog = prog_load(progsfile, noexec);
     if (!prog) {
         fprintf(stderr, "failed to load program '%s'\n", progsfile);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     prog->builtins       = qc_builtins;
     }
 
     prog->builtins       = qc_builtins;
@@ -1155,7 +1155,7 @@ int main(int argc, char **argv) {
     if (opts_printfuns) {
         for (i = 0; i < vec_size(prog->functions); ++i) {
             int32_t a;
     if (opts_printfuns) {
         for (i = 0; i < vec_size(prog->functions); ++i) {
             int32_t a;
-            printf("Function: %-16s taking %i parameters:(",
+            printf("Function: %-16s taking %u parameters:(",
                    prog_getstring(prog, prog->functions[i].name),
                    (unsigned int)prog->functions[i].nargs);
             for (a = 0; a < prog->functions[i].nargs; ++a) {
                    prog_getstring(prog, prog->functions[i].name),
                    (unsigned int)prog->functions[i].nargs);
             for (a = 0; a < prog->functions[i].nargs; ++a) {
index d664fb65bd7124e142412dd6275476cb484a9645..2bc2a839a339161f796b9721ccddb5dec6b1d11b 100644 (file)
@@ -55,6 +55,7 @@ FFMPEGFLAGS=                  \
 
 #splint flags
 SPLINTFLAGS =                 \
 
 #splint flags
 SPLINTFLAGS =                 \
+    -preproc                  \
     -redef                    \
     -noeffect                 \
     -nullderef                \
     -redef                    \
     -noeffect                 \
     -nullderef                \
diff --git a/msvc.c b/msvc.c
index e6e925631f9b6ce3659cc02e4fc98186c14d0bea..2851cbff7ba5017f7801d016a73453618bec461e 100644 (file)
--- a/msvc.c
+++ b/msvc.c
@@ -52,7 +52,7 @@ static void *platform_mem_allocate(size_t bytes) {
 }
 
 int platform_vsnprintf(char *buffer, size_t bytes, const char *format, va_list arg) {
 }
 
 int platform_vsnprintf(char *buffer, size_t bytes, const char *format, va_list arg) {
-    vsnprintf_s(buffer, bytes, bytes, format, arg);
+    return vsnprintf_s(buffer, bytes, bytes, format, arg);
 }
 
 int platform_vsscanf(const char *str, const char *format, va_list va) {
 }
 
 int platform_vsscanf(const char *str, const char *format, va_list va) {