From aafa75bc71687a0b840f649c295fd04991091b5e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 15 Jul 2025 15:13:54 +0200 Subject: [PATCH] fixup! clar(clar_summary_testsuite): avoid thread-unsafe `localtime()` When upstreaming this patch to clar, the missing `localtime_r` symbol was addressed in a different way. For details, see https://github.com/clar-test/clar/pull/115/commits/ca0b519a. Let's use that version instead. Signed-off-by: Johannes Schindelin --- t/unit-tests/clar/clar.c | 2 ++ t/unit-tests/clar/clar/summary.h | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c index e7d142da53b2cd..08c1a395bc0faa 100644 --- a/t/unit-tests/clar/clar.c +++ b/t/unit-tests/clar/clar.c @@ -79,6 +79,8 @@ # else # define p_snprintf snprintf # endif + +# define localtime_r(timer, buf) (localtime_s(buf, timer) == 0 ? buf : NULL) #else # include /* waitpid(2) */ # include diff --git a/t/unit-tests/clar/clar/summary.h b/t/unit-tests/clar/clar/summary.h index e972831938cd44..7b85f162d8ed41 100644 --- a/t/unit-tests/clar/clar/summary.h +++ b/t/unit-tests/clar/clar/summary.h @@ -19,15 +19,6 @@ static int clar_summary_testsuites(struct clar_summary *summary) return fprintf(summary->fp, "\n"); } -#ifdef _WIN32 -static struct tm *localtime_r(const time_t *timep, struct tm *result) -{ - if (localtime_s(result, timep) == 0) - return result; - return NULL; -} -#endif - static int clar_summary_testsuite(struct clar_summary *summary, int idn, const char *name, time_t timestamp, int test_count, int fail_count, int error_count)