]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
include: Simplify glibc version dependent macro handling
authorGuillem Jover <guillem@hadrons.org>
Wed, 5 Oct 2022 00:05:46 +0000 (02:05 +0200)
committerGuillem Jover <guillem@hadrons.org>
Wed, 5 Oct 2022 10:12:34 +0000 (12:12 +0200)
We test once whether __GLIBC__ is not defined, so we do not need to test
whether it is on the OR branch afterwards. We decouple the glibc version
restriction check from the _*_SOURCE variable, as that contains an
implicit opposite version check.

include/bsd/stdlib.h
include/bsd/string.h

index 2bee974a512d57a14cdca08ca9cc1b30b510de9c..f7bcbd0913d8e6d31d99644414f797f4cb7a012b 100644 (file)
@@ -72,7 +72,8 @@ int sradixsort(const unsigned char **base, int nmemb,
 
 void *reallocf(void *ptr, size_t size);
 #if !defined(__GLIBC__) || \
-    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 26) || !defined(_GNU_SOURCE)))
+    !__GLIBC_PREREQ(2, 26) || \
+    !defined(_GNU_SOURCE)
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #endif
 void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
index f987fee3ed3c6c2ad0e5ec9aba1fcb2897a45f9f..d03c7550f0e74babb816a8df1db771bd0d06464d 100644 (file)
@@ -47,7 +47,8 @@ char *strnstr(const char *str, const char *find, size_t str_len);
 void strmode(mode_t mode, char *str);
 
 #if !defined(__GLIBC__) || \
-    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
+    !__GLIBC_PREREQ(2, 25) || \
+    !defined(_GNU_SOURCE)
 void explicit_bzero(void *buf, size_t len);
 #endif
 __END_DECLS