]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Return from process_main_options instead of exiting
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 15 Aug 2021 19:29:40 +0000 (21:29 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 16 Aug 2021 18:12:03 +0000 (20:12 +0200)
src/core/mainoptions.cpp

index 3b61eaa8c402d07a6227f5b02a3561b53743678a..5bd02986e6014a936cbe28167e94cf27dcbee3e9 100644 (file)
@@ -452,7 +452,7 @@ process_main_options(int argc, const char* const* argv)
 
     case 'h': // --help
       PRINT(stdout, USAGE_TEXT, CCACHE_NAME, CCACHE_NAME);
-      exit(EXIT_SUCCESS);
+      return EXIT_SUCCESS;
 
     case 'k': // --get-config
       PRINT(stdout, "{}\n", config.get_string_value(arg));
@@ -532,7 +532,7 @@ process_main_options(int argc, const char* const* argv)
 
     case 'V': // --version
       PRINT_RAW(stdout, get_version_text());
-      exit(EXIT_SUCCESS);
+      break;
 
     case 'x': // --show-compression
     {
@@ -570,11 +570,11 @@ process_main_options(int argc, const char* const* argv)
 
     default:
       PRINT(stderr, USAGE_TEXT, CCACHE_NAME, CCACHE_NAME);
-      exit(EXIT_FAILURE);
+      return EXIT_FAILURE;
     }
   }
 
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 } // namespace core