@@ -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); }
@@ -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
@@ -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;