From 5b6f2292a30267b6242cdbb7332f84a375b0684a Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 10 Feb 2025 11:19:28 +0100 Subject: [PATCH] os: drop win32-only System() function Not used anymore, so it can be dropped. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- os/osdep.h | 2 -- os/utils.c | 43 ------------------------------------------- 2 files changed, 45 deletions(-) diff --git a/os/osdep.h b/os/osdep.h index b6d432874..86e1f6486 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -153,13 +153,11 @@ static inline void uname(struct utsname *uts) { const char *Win32TempDir(void); -int System(const char *cmdline); static inline void Fclose(void *f) { fclose(f); } static inline void *Fopen(const char *a, const char *b) { return fopen(a,b); } #else /* WIN32 */ -int System(const char *); void *Popen(const char *, const char *); void *Fopen(const char *, const char *); int Fclose(void *f); diff --git a/os/utils.c b/os/utils.c index afd4cef14..f0b706b8d 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1241,49 +1241,6 @@ Win32TempDir(void) else return "/tmp"; } - -int -System(const char *cmdline) -{ - STARTUPINFO si = (STARTUPINFO) { - .cb = sizeof(si), - }; - PROCESS_INFORMATION pi = (PROCESS_INFORMATION){0}; - DWORD dwExitCode; - char *cmd = strdup(cmdline); - - if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { - LPVOID buffer; - - if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buffer, 0, NULL)) { - ErrorF("[xkb] Starting '%s' failed!\n", cmdline); - } - else { - ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *) buffer); - LocalFree(buffer); - } - - free(cmd); - return -1; - } - /* Wait until child process exits. */ - WaitForSingleObject(pi.hProcess, INFINITE); - - GetExitCodeProcess(pi.hProcess, &dwExitCode); - - /* Close process and thread handles. */ - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - free(cmd); - - return dwExitCode; -} #endif Bool