aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2024-02-01 09:15:42 -0600
committerDenis Kenzior <denkenz@gmail.com>2024-02-01 09:15:42 -0600
commita94c9eb8301b606aa3df716c82e02cfff3566f7e (patch)
tree899d7e531daeb762e0e52c60f3812914d75d8d4c
parent55336c2fe445edf94862f8a408d0e2f4a97fbfb2 (diff)
cleanup: Use _l_ preffix for all cleanup functions
Also while here, move the __AUTODESTRUCT macro to cleanup.h and prefix it with _L
-rw-r--r--ell/cleanup.h5
-rw-r--r--ell/useful.h5
-rw-r--r--ell/util.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/ell/cleanup.h b/ell/cleanup.h
index 337c8ad5..ac9f5a89 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 8a4bf2ce..ab88f525 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 db86bfe2..4ae03095 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;