]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
unit1307: tidy up Apple OS detection
authorViktor Szakats <commit@vsz.me>
Wed, 30 Oct 2024 20:09:06 +0000 (21:09 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 31 Oct 2024 08:09:01 +0000 (09:09 +0100)
Use `__APPLE__` macro to detect Apple OS instead of relying on
the string in `CURL_OS`.

This also fixes detection with default CMake builds where `CURL_OS` is
`Darwin`. The code before this patch was expecting this substring in
lowercase.

Closes #15461

tests/unit/unit1307.c

index 203cdd2ee3e8b093b6fad73cd76bbd192e4b6f18..08faa339033142384ee95480a9ed206ea4be2668 100644 (file)
@@ -280,11 +280,11 @@ UNITTEST_START
   enum system machine;
 
 #ifdef HAVE_FNMATCH
-  if(strstr(CURL_OS, "apple") || strstr(CURL_OS, "darwin")) {
-    machine = SYSTEM_MACOS;
-  }
-  else
-    machine = SYSTEM_LINUX;
+#ifdef __APPLE__
+  machine = SYSTEM_MACOS;
+#else
+  machine = SYSTEM_LINUX;
+#endif
   printf("Tested with system fnmatch(), %s-style\n",
          machine == SYSTEM_LINUX ? "linux" : "mac");
 #else