From 2f9eddc277187e25167331ae3bde4a491fd87fa2 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 5 Oct 2022 02:05:46 +0200 Subject: [PATCH] include: Simplify glibc version dependent macro handling 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 | 3 ++- include/bsd/string.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h index 2bee974..f7bcbd0 100644 --- a/include/bsd/stdlib.h +++ b/include/bsd/stdlib.h @@ -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); diff --git a/include/bsd/string.h b/include/bsd/string.h index f987fee..d03c755 100644 --- a/include/bsd/string.h +++ b/include/bsd/string.h @@ -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