From: Alejandro Colomar Date: Mon, 26 May 2025 12:17:25 +0000 (+0200) Subject: lib/, src/: Move macros to "typetraits.h" X-Git-Tag: 4.18.0-rc1~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb503351cd446c0163ed27b877b7693a0f39e6f6;p=thirdparty%2Fshadow.git lib/, src/: Move macros to "typetraits.h" The macros that remain in "must_be.h" really belong in "typetraits.h". Move them there, and remove "must_be.h". Signed-off-by: Alejandro Colomar --- diff --git a/lib/Makefile.am b/lib/Makefile.am index b492d420b..55d340397 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -124,7 +124,6 @@ libshadow_la_SOURCES = \ loginprompt.c \ mail.c \ motd.c \ - must_be.h \ myname.c \ nss.c \ nscd.c \ diff --git a/lib/must_be.h b/lib/must_be.h deleted file mode 100644 index ff9b150e5..000000000 --- a/lib/must_be.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2019-2023, Alejandro Colomar - * SPDX-License-Identifier: BSD-3-Clause - */ - - -#ifndef SHADOW_INCLUDE_LIBMISC_MUST_BE_H_ -#define SHADOW_INCLUDE_LIBMISC_MUST_BE_H_ - - -#include - - -#define is_same_type(a, b) \ -( \ - __builtin_types_compatible_p(a, b) \ -) - - -#define is_same_typeof(a, b) \ -( \ - is_same_type(typeof(a), typeof(b)) \ -) - - -#endif // include guard diff --git a/lib/search/l/lfind.h b/lib/search/l/lfind.h index 2a6f6f6ef..ddbadb1d4 100644 --- a/lib/search/l/lfind.h +++ b/lib/search/l/lfind.h @@ -11,8 +11,8 @@ #include #include -#include "must_be.h" #include "search/cmp/cmp.h" +#include "typetraits.h" #include diff --git a/lib/search/l/lsearch.h b/lib/search/l/lsearch.h index fd269cb5e..7ee4c9bfd 100644 --- a/lib/search/l/lsearch.h +++ b/lib/search/l/lsearch.h @@ -10,8 +10,8 @@ #include -#include "must_be.h" #include "search/cmp/cmp.h" +#include "typetraits.h" #include diff --git a/lib/search/sort/qsort.h b/lib/search/sort/qsort.h index 4a23506b0..962dba249 100644 --- a/lib/search/sort/qsort.h +++ b/lib/search/sort/qsort.h @@ -10,8 +10,8 @@ #include -#include "must_be.h" #include "search/cmp/cmp.h" +#include "typetraits.h" #define QSORT(a, n) do \ diff --git a/lib/typetraits.h b/lib/typetraits.h index 47bd30d94..7d3269d61 100644 --- a/lib/typetraits.h +++ b/lib/typetraits.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2019-2024, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -43,4 +43,15 @@ ) +#define is_same_type(a, b) \ +( \ + __builtin_types_compatible_p(a, b) \ +) + +#define is_same_typeof(a, b) \ +( \ + is_same_type(typeof(a), typeof(b)) \ +) + + #endif // include guard diff --git a/src/usermod.c b/src/usermod.c index e886a1531..cbae052fb 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -42,7 +42,6 @@ #include "faillog.h" #include "getdef.h" #include "groupio.h" -#include "must_be.h" #include "nscd.h" #include "prototypes.h" #include "pwauth.h" @@ -68,6 +67,7 @@ #include "string/strcmp/strprefix.h" #include "string/strdup/xstrdup.h" #include "time/day_to_str.h" +#include "typetraits.h" /*