From c3255fbc1c4396b7d4a4420b861b605eaedf9bdd Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 22 Feb 2024 15:06:53 +0100 Subject: [PATCH] os: drop unneeded DDXOSVERRORF conditional This conditional practically only controls whether we have an pointer, where DDX can plug in it's own VErrorF() handler (currently only xwin doing that). The cost of having it even when DDX doesn't use it, is really negligible: it's just one pointer and an extra non-null check on it per VErrorF() call - a very cold path. Strangely, xwin has extra Getting rid of this unnecessary complexity that really hasn't any practical gain. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- hw/xwin/InitOutput.c | 2 -- hw/xwin/win.h | 2 -- hw/xwin/winerror.c | 2 -- hw/xwin/winprocarg.c | 2 -- include/meson.build | 1 - include/os.h | 2 -- os/log.c | 6 ------ 7 files changed, 17 deletions(-) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 5a42f43bb..5ce717b29 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -623,10 +623,8 @@ OsVendorInit(void) winFixupPaths(); -#ifdef DDXOSVERRORF if (!OsVendorVErrorFProc) OsVendorVErrorFProc = OsVendorVErrorF; -#endif if (!g_fLogInited) { /* keep this order. If LogInit fails it calls Abort which then calls diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 3aa158e91..61e36384c 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -740,11 +740,9 @@ void * winerror.c */ -#ifdef DDXOSVERRORF void OsVendorVErrorF(const char *pszFormat, va_list va_args) _X_ATTRIBUTE_PRINTF(1, 0); -#endif void winMessageBoxF(const char *pszError, UINT uType, ...) diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index 784772f5f..c8ad9c969 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -35,7 +35,6 @@ #include <../xfree86/common/xorgVersion.h> #include "win.h" -#ifdef DDXOSVERRORF void OsVendorVErrorF(const char *pszFormat, va_list va_args) { @@ -52,7 +51,6 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args) /* Unlock the printing mutex */ pthread_mutex_unlock(&s_pmPrinting); } -#endif /* * os/log.c:FatalError () calls our vendor ErrorF, so the message diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 66023f335..e8990cc10 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -221,13 +221,11 @@ ddxProcessArgument(int argc, char *argv[], int i) /* Initialize once */ if (!s_fBeenHere) { -#ifdef DDXOSVERRORF /* * This initialises our hook into VErrorF () for catching log messages * that are generated before OsInit () is called. */ OsVendorVErrorFProc = OsVendorVErrorF; -#endif s_fBeenHere = TRUE; diff --git a/include/meson.build b/include/meson.build index a3146ffa9..a7c398468 100644 --- a/include/meson.build +++ b/include/meson.build @@ -251,7 +251,6 @@ conf_data.set('HAVE_LIBUNWIND', get_option('libunwind')) conf_data.set('HAVE_APM', (build_apm or build_acpi) ? '1' : false) conf_data.set('HAVE_ACPI', build_acpi ? '1' : false) -conf_data.set('DDXOSVERRORF', build_xwin ? '1' : false) conf_data.set('DDXBEFORERESET', build_xwin ? '1' : false) enable_debugging = get_option('buildtype') == 'debug' conf_data.set('DEBUG', enable_debugging ? '1' : false) diff --git a/include/os.h b/include/os.h index fef7a1719..7b252562e 100644 --- a/include/os.h +++ b/include/os.h @@ -90,11 +90,9 @@ typedef struct _NewClientRec *NewClientPtr; extern void ddxBeforeReset(void); #endif -#ifdef DDXOSVERRORF extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args) _X_ATTRIBUTE_PRINTF(1, 0); -#endif extern _X_EXPORT Bool WaitForSomething(Bool clients_are_ready); diff --git a/os/log.c b/os/log.c index ab7c252a4..189ab355b 100644 --- a/os/log.c +++ b/os/log.c @@ -104,9 +104,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #pragma clang diagnostic ignored "-Wformat-nonliteral" #endif -#ifdef DDXOSVERRORF void (*OsVendorVErrorFProc) (const char *, va_list args) = NULL; -#endif /* Default logging parameters. */ #ifndef DEFAULT_LOG_VERBOSITY @@ -1036,14 +1034,10 @@ FatalError(const char *f, ...) void VErrorF(const char *f, va_list args) { -#ifdef DDXOSVERRORF if (OsVendorVErrorFProc) OsVendorVErrorFProc(f, args); else LogVWrite(-1, f, args); -#else - LogVWrite(-1, f, args); -#endif } void