]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
shared: Move cleanup attribute
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Sat, 9 Nov 2024 22:20:18 +0000 (16:20 -0600)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 12 Nov 2024 00:11:11 +0000 (18:11 -0600)
Move to macro.h where other attributes are located. The inline helper
function can also move along as we don't need to keep it separate.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/233
shared/macro.h
shared/util.h

index 62876b050b4406d4c6a93ecbc9cac1a911389737..28ec61af64b4431969f8b15167a9fbf684799be5 100644 (file)
 #define _must_check_ __attribute__((warn_unused_result))
 #define _printf_format_(a, b) __attribute__((format(printf, a, b)))
 #define _always_inline_ __inline__ __attribute__((always_inline))
-#define _cleanup_(x) __attribute__((cleanup(x)))
 #define _nonnull_(...) __attribute__((nonnull(__VA_ARGS__)))
 #define _nonnull_all_ __attribute__((nonnull))
 
+#define _cleanup_(x) __attribute__((cleanup(x)))
+
+static inline void freep(void *p)
+{
+       free(*(void **)p);
+}
+#define _cleanup_free_ _cleanup_(freep)
+
 /* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
  * compiler versions */
 #ifndef noreturn
index a9ce00a30cb0e9661320e8c7ca44614c1e98afb8..65d90dba743fb03aded837d806d80a2c95aff6a2 100644 (file)
@@ -87,11 +87,6 @@ static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u)
 
 /* misc                                                                     */
 /* ************************************************************************ */
-static inline void freep(void *p)
-{
-       free(*(void **)p);
-}
-#define _cleanup_free_ _cleanup_(freep)
 
 static inline bool uadd32_overflow(uint32_t a, uint32_t b, uint32_t *res)
 {