From 8e8b3608fbf1e9627e79c5f8d4ec894ccbde0e4f Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Mon, 14 Oct 2013 20:58:36 -0400 Subject: [PATCH] Cleanups --- ast.c | 4 +--- exec.c | 22 +++++++++++----------- include.mk | 1 + msvc.c | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ast.c b/ast.c index 362a06f..cf03e01 100644 --- 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 */ - 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; - } if (ast_istype(prev, ast_unary)) { ast_expression_delete((ast_expression*)self); diff --git a/exec.c b/exec.c index ebbfa90..43d1980 100644 --- a/exec.c +++ b/exec.c @@ -914,7 +914,7 @@ int main(int argc, char **argv) { if (argc < 2) { usage(); - exit(1); + exit(EXIT_FAILURE); } while (argc > 1) { @@ -923,7 +923,7 @@ int main(int argc, char **argv) { !strcmp(argv[1], "--help")) { usage(); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(argv[1], "-v")) { ++opts_v; @@ -937,7 +937,7 @@ int main(int argc, char **argv) { ++opts_v; else { usage(); - exit(1); + exit(EXIT_FAILURE); } } --argc; @@ -947,7 +947,7 @@ int main(int argc, char **argv) { !strcmp(argv[1], "--version")) { version(); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp(argv[1], "-trace")) { --argc; @@ -976,7 +976,7 @@ int main(int argc, char **argv) { ++argv; if (argc <= 1) { usage(); - exit(1); + exit(EXIT_FAILURE); } vec_push(dis_list, argv[1]); --argc; @@ -1019,7 +1019,7 @@ int main(int argc, char **argv) { ++argv; if (argc < 2) { usage(); - exit(1); + exit(EXIT_FAILURE); } 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(); - exit(1); + exit(EXIT_FAILURE); } progsfile = argv[1]; --argc; @@ -1046,7 +1046,7 @@ int main(int argc, char **argv) { { 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(); - exit(1); + exit(EXIT_FAILURE); } 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; @@ -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; - 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) { diff --git a/include.mk b/include.mk index d664fb6..2bc2a83 100644 --- a/include.mk +++ b/include.mk @@ -55,6 +55,7 @@ FFMPEGFLAGS= \ #splint flags SPLINTFLAGS = \ + -preproc \ -redef \ -noeffect \ -nullderef \ diff --git a/msvc.c b/msvc.c index e6e9256..2851cbf 100644 --- 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) { - 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) { -- 2.39.2