xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 10 17:03:51 UTC 2024


 os/log.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit d43d346541faa4dbb04c43283e03adaa19d11011
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Wed Sep 11 11:58:27 2024 +0200

    os: log: use localtime_r() on mingw builds
    
    MingW also provides localtime_r(), but needs _POSIX_THREAD_SAFE_FUNCTIONS
    symbol before including anything, in order for the prototype being defined.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1685>

diff --git a/os/log.c b/os/log.c
index a1e9cad55..e258cc62f 100644
--- a/os/log.c
+++ b/os/log.c
@@ -75,6 +75,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
  * authorization from the copyright holder(s) and author(s).
  */
 
+#define _POSIX_THREAD_SAFE_FUNCTIONS // for localtime_r on mingw32
+
 #include <dix-config.h>
 
 #include <errno.h>
@@ -592,11 +594,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
                 struct tm tm;
                 char fmt_tm[32];
 
-#ifdef WIN32
-                localtime_s(&tm, &t);
-#else
                 localtime_r(&t, &tm);
-#endif
                 strftime(fmt_tm, sizeof(fmt_tm) - 1, "%Y-%m-%d %H:%M:%S", &tm);
 
                 fprintf(logFile, "[%s] ", fmt_tm);


More information about the xorg-commit mailing list