diff mbox series

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

Message ID 20240201151751.880279-2-denkenz@gmail.com (mailing list archive)
State New
Headers show
Series [1/2] useful: Move close cleanup into ell/util.h | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

Denis Kenzior Feb. 1, 2024, 3:17 p.m. UTC
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 mbox series

Patch

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;