]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove unnecessary x_exit function
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 31 Jul 2020 17:35:53 +0000 (19:35 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 31 Jul 2020 18:31:54 +0000 (20:31 +0200)
It’s no longer necessary to use it after
91aa70754c3816537b080fef1c6630313b400721.

src/ccache.cpp
src/execute.cpp
src/legacy_util.cpp
src/legacy_util.hpp
src/logging.cpp

index 8d58ef7b514900ad160def209e6c31f63e912d23..b09e7411bd989061d0864d5206c9f67a12355a2b 100644 (file)
@@ -2294,7 +2294,7 @@ handle_main_options(int argc, const char* const* argv)
 
     case 'h': // --help
       fmt::print(stdout, USAGE_TEXT, MYNAME, MYNAME);
-      x_exit(0);
+      exit(EXIT_SUCCESS);
 
     case 'k': // --get-config
       fmt::print("{}\n", ctx.config.get_string_value(arg));
@@ -2348,7 +2348,7 @@ handle_main_options(int argc, const char* const* argv)
 
     case 'V': // --version
       fprintf(stdout, VERSION_TEXT, MYNAME, CCACHE_VERSION);
-      x_exit(0);
+      exit(EXIT_SUCCESS);
 
     case 'x': // --show-compression
     {
@@ -2386,7 +2386,7 @@ handle_main_options(int argc, const char* const* argv)
 
     default:
       fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME);
-      x_exit(1);
+      exit(EXIT_FAILURE);
     }
 
     // Some of the above switches might have changed config settings, so run the
@@ -2408,7 +2408,7 @@ ccache_main(int argc, const char* const* argv)
     if (Util::same_program_name(program_name, MYNAME)) {
       if (argc < 2) {
         fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME);
-        x_exit(1);
+        exit(EXIT_FAILURE);
       }
       // If the first argument isn't an option, then assume we are being passed
       // a compiler name and options.
index f17e52e9d346645ca13fa46e1fdd0f2ae15a36f3..72e08cbd68da2014827afe4504867b89628b1fab 100644 (file)
@@ -145,7 +145,7 @@ win32execute(const char* path,
   CloseHandle(pi.hProcess);
   CloseHandle(pi.hThread);
   if (!doreturn) {
-    x_exit(exitcode);
+    exit(exitcode);
   }
   return exitcode;
 }
@@ -174,7 +174,7 @@ execute(const char* const* argv, Fd&& fd_out, Fd&& fd_err, pid_t* pid)
     fd_out.close();
     dup2(*fd_err, STDERR_FILENO);
     fd_err.close();
-    x_exit(execv(argv[0], const_cast<char* const*>(argv)));
+    exit(execv(argv[0], const_cast<char* const*>(argv)));
   }
 
   fd_out.close();
index d736f4b3be25f5c687f6a72a64a18cb5f1d48925..f8f5ef4d670acc9d1599dfaa70683c005680f15c 100644 (file)
 #  include <sys/time.h>
 #endif
 
-// If exit() already has been called, call _exit(), otherwise exit(). This is
-// used to avoid calling exit() inside an atexit handler.
-void
-x_exit(int status)
-{
-  static bool first_time = true;
-  if (first_time) {
-    first_time = false;
-    exit(status);
-  } else {
-    _exit(status);
-  }
-}
-
 // Rename oldpath to newpath (deleting newpath).
 int
 x_rename(const char* oldpath, const char* newpath)
index d032a1531a06cf9d96ac231d38ac3d12add7aad5..2de2d15862811c79a94ea357d890e9e2ab7c6fb5 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <string>
 
-void x_exit(int status) ATTR_NORETURN;
 int x_rename(const char* oldpath, const char* newpath);
 void set_cloexec_flag(int fd);
 double time_seconds();
index 94e55a4d02ec6e89bbc9c28a824cf527cd4f2bb7..2ed326b3c63c19e72a1946f7c6382b1c42f66ad8 100644 (file)
@@ -143,7 +143,7 @@ warn_log_fail()
           "ccache: error: Failed to write to %s: %s\n",
           logfile_path.c_str(),
           strerror(errno));
-  x_exit(EXIT_FAILURE);
+  exit(EXIT_FAILURE);
 }
 
 static void