[PATCH 2/2] cleanup: Use _l_ preffix for all cleanup functions

Denis Kenzior <[email protected]> Thu, 1 Feb 2024 09:17:34 -0600
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Also while here, move the __AUTODESTRUCT macro to cleanup.h and prefix
it with _L
---
 ell/cleanup.h | 5 ++++-
 ell/useful.h  | 5 +----
 ell/util.h    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ell/cleanup.h b/ell/cleanup.h
index 337c8ad5d753..ac9f5a894b24 100644
--- a/ell/cleanup.h
+++ b/ell/cleanup.h
@@ -7,6 +7,9 @@
 
 #pragma once
 
+#define __L_AUTODESTRUCT(func)				\
+	__attribute((cleanup(_l_ ## func ## _cleanup)))
+
 #define DEFINE_CLEANUP_FUNC(func)			\
 	inline __attribute__((always_inline))		\
-	void func ## _cleanup(void *p) { func(*(void **) p); }
+	void _l_ ## func ## _cleanup(void *p) { func(*(void **) p); }
diff --git a/ell/useful.h b/ell/useful.h
index 8a4bf2ce70c9..ab88f52556f5 100644
--- a/ell/useful.h
+++ b/ell/useful.h
@@ -59,11 +59,8 @@ static inline unsigned char bit_field(const unsigned char oct,
 	_x / _d;					\
 })
 
-#define __AUTODESTRUCT(func)				\
-	__attribute((cleanup(func ## _cleanup)))
-
 #define _auto_(func)					\
-	__AUTODESTRUCT(func)
+	__L_AUTODESTRUCT(func)
 
 /*
  * Trick the compiler into thinking that var might be changed somehow by
diff --git a/ell/util.h b/ell/util.h
index db86bfe278ea..4ae03095d013 100644
--- a/ell/util.h
+++ b/ell/util.h
@@ -317,7 +317,7 @@ const char *l_util_get_debugfs_path(void);
        __result; }))
 
 /* Enables declaring _auto_(close) int fd = <-1 or L_TFR(open(...))>; */
-inline __attribute__((always_inline)) void close_cleanup(void *p)
+inline __attribute__((always_inline)) void _l_close_cleanup(void *p)
 {
 	int fd = *(int *) p;
 
-- 
2.43.0