]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
Makefile: ftepp.o: lexer.h
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index dfa80dde5446f1446f1ab13d0fb232e370fc434c..bf32885a19fb31a306f8c5b784eb99d4e0f1441b 100644 (file)
--- a/test.c
+++ b/test.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012
+ * Copyright (C) 2012, 2013
  *     Dale Weiler
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -121,29 +121,12 @@ FILE ** task_popen(const char *command, const char *mode) {
         close(2), dup(errhandle[1]);
 
         execvp(*argv, argv);
-        exit(1);
+        exit(EXIT_FAILURE);
     } else {
         /* fork failed */
         goto task_popen_error_3;
     }
 
-    /*
-     * clang is stupid, it doesn't understand that yes, this code
-     * is actually reachable.
-     */
-#   ifdef __clang__
-#       pragma clang diagnostic push
-#       pragma clang diagnostic ignored "-Wunreachable-code"
-#   endif
-    if (argv)
-        vec_free(argv);
-
-#   ifdef __clang__
-#    pragma clang diagnostic pop
-#   endif
-
-    return data->handles;
-
 task_popen_error_3: close(errhandle[0]), close(errhandle[1]);
 task_popen_error_2: close(outhandle[0]), close(outhandle[1]);
 task_popen_error_1: close(inhandle [0]), close(inhandle [1]);
@@ -169,12 +152,12 @@ int task_pclose(FILE **handles) {
     return status;
 }
 #else
-#  define _WIN32_LEAN_AND_MEAN
-#  define popen  _popen
-#  define pclose _pclose
-#  include <windows.h>
+#    define _WIN32_LEAN_AND_MEAN
+#    define popen  _popen
+#    define pclose _pclose
+#    include <windows.h>
 #   include <io.h>
-#  include <fcntl.h>
+#    include <fcntl.h>
     /*
      * Bidirectional piping implementation for windows using CreatePipe and DuplicateHandle +
      * other hacks.
@@ -199,10 +182,10 @@ int task_pclose(FILE **handles) {
         return;
     }
 
-#  ifdef __MINGW32__
+#    ifdef __MINGW32__
         /* mingw32 has dirent.h */
-#    include <dirent.h>
-#  elif defined (_MSC_VER)
+#        include <dirent.h>
+#    elif defined (_MSC_VER)
         /* 
          * visual studio lacks dirent.h it's a posix thing
          * so we emulate it with the WinAPI.
@@ -280,9 +263,9 @@ int task_pclose(FILE **handles) {
          * Visual studio also lacks S_ISDIR for sys/stat.h, so we emulate this as well
          * which is not hard at all.
          */
-#    undef  S_ISDIR /* undef just incase */
-#    define S_ISDIR(X) ((X)&_S_IFDIR)
-#  endif
+#        undef  S_ISDIR /* undef just incase */
+#        define S_ISDIR(X) ((X)&_S_IFDIR)
+#    endif
 #endif
 
 #define TASK_COMPILE 0