]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
c.h: consolidate THREAD_LOCAL.
authorKarel Zak <kzak@redhat.com>
Mon, 27 Jan 2025 12:40:23 +0000 (13:40 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 27 Jan 2025 12:40:23 +0000 (13:40 +0100)
Let's define this macro in one place only.

Signed-off-by: Karel Zak <kzak@redhat.com>
include/c.h
lib/randutils.c
libuuid/src/gen_uuid.c

index d87521be0c9592a735322d30a92326efdf064469..ec2d32c386b7375cf35adbeb9bd1eeb118a08da2 100644 (file)
@@ -604,4 +604,15 @@ static inline void ul_reset_errno(int *saved_errno) {
 
 #define UL_PROTECT_ERRNO __attribute__((__cleanup__(ul_reset_errno))) \
                          __attribute__((__unused__)) int __ul_saved_errno = errno
+
+
+/*
+ * thread-local storage
+ */
+#ifdef HAVE_TLS
+# define THREAD_LOCAL static __thread
+#else
+# define THREAD_LOCAL static
+#endif
+
 #endif /* UTIL_LINUX_C_H */
index 1b03234a410ae0b0d4c01b46670ccfc459557223..a486426a3ebbea73a706be3b73714343cddaf46a 100644 (file)
 #include "randutils.h"
 #include "nls.h"
 
-#ifdef HAVE_TLS
-#define THREAD_LOCAL static __thread
-#else
-#define THREAD_LOCAL static
-#endif
 
 #ifdef HAVE_GETRANDOM
 # include <sys/random.h>
index fca7e96e2587b5b3ead7af5a4af3d51850d10a81..106af95f6c7ca64ae5a7795a67fc572764c390d2 100644 (file)
@@ -93,7 +93,6 @@
 #include "sha1.h"
 #include "timeutils.h"
 
-#define THREAD_LOCAL static __thread
 
 #ifdef _WIN32
 static void gettimeofday (struct timeval *tv, void *dummy)