From a4753a530d689be86e018190d9bb0cb52007fa13 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Sun, 18 Feb 2024 12:52:52 +0100 Subject: [PATCH] os: xdmcp: add dummy functions when XDMCP not defined instead of cluttering the code with #ifdef's, just define the non-existing functions as empty dummies when XDMCP is disabled. Signed-off-by: Enrico Weigelt, metux IT consult --- os/connection.c | 2 -- os/utils.c | 4 ---- os/xdmcp.h | 11 +++++++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/os/connection.c b/os/connection.c index f50dcd574b..cd062f7a73 100644 --- a/os/connection.c +++ b/os/connection.c @@ -306,9 +306,7 @@ CreateWellKnownSockets(void) InitParentProcess(); -#ifdef XDMCP XdmcpInit(); -#endif } void diff --git a/os/utils.c b/os/utils.c index 7461ef9f87..b68bdba562 100644 --- a/os/utils.c +++ b/os/utils.c @@ -319,9 +319,7 @@ UseMsg(void) ErrorF("+extension name Enable extension\n"); ErrorF("-extension name Disable extension\n"); ListStaticExtensions(); -#ifdef XDMCP XdmcpUseMsg(); -#endif XkbUseMsg(); ddxUseMsg(); } @@ -712,11 +710,9 @@ ProcessCommandLine(int argc, char *argv[]) else if (strncmp(argv[i], "tty", 3) == 0) { /* init supplies us with this useless information */ } -#ifdef XDMCP else if ((skip = XdmcpOptions(argc, argv, i)) != i) { i = skip - 1; } -#endif else if (strcmp(argv[i], "-dumbSched") == 0) { InputThreadEnable = FALSE; #ifdef HAVE_SETITIMER diff --git a/os/xdmcp.h b/os/xdmcp.h index 5e3975c385..678c0fb091 100644 --- a/os/xdmcp.h +++ b/os/xdmcp.h @@ -11,6 +11,8 @@ typedef Bool (*AddAuthorFunc) (unsigned name_length, const char *name, unsigned data_length, char *data); /* in xdmcp.c */ +#ifdef XDMCP + void XdmcpUseMsg(void); int XdmcpOptions(int argc, char **argv, int i); void XdmcpRegisterConnection(int type, const char *address, int addrlen); @@ -30,4 +32,13 @@ void XdmcpRegisterAuthentication(const char *name, struct sockaddr_in; void XdmcpRegisterBroadcastAddress(const struct sockaddr_in *addr); +#else + +static inline void XdmcpUseMsg(void) {} +static inline XdmcpOptions(int argc, char **argv, int i) { return i; } +static inline void XdmcpInit(void) {} +static inline XdmcpReset(void) {} + +#endif /* XDMCP */ + #endif /* _XSERVER_OS_XDMCP_H */