@@ -5,11 +5,6 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#include <unistd.h>
-#include <errno.h>
-
-#include <ell/util.h>
-
#define align_len(len, boundary) (((len)+(boundary)-1) & ~((boundary)-1))
#define likely(x) __builtin_expect(!!(x), 1)
@@ -70,15 +65,6 @@ static inline unsigned char bit_field(const unsigned char oct,
#define _auto_(func) \
__AUTODESTRUCT(func)
-/* Enables declaring _auto_(close) int fd = <-1 or L_TFR(open(...))>; */
-inline __attribute__((always_inline)) void close_cleanup(void *p)
-{
- int fd = *(int *) p;
-
- if (fd >= 0)
- L_TFR(close(fd));
-}
-
/*
* Trick the compiler into thinking that var might be changed somehow by
* the asm
@@ -14,6 +14,8 @@
#include <inttypes.h>
#include <endian.h>
#include <byteswap.h>
+#include <unistd.h>
+#include <errno.h>
#include <sys/uio.h>
#include <ell/cleanup.h>
@@ -314,6 +316,15 @@ const char *l_util_get_debugfs_path(void);
while (__result == -1L && errno == EINTR); \
__result; }))
+/* Enables declaring _auto_(close) int fd = <-1 or L_TFR(open(...))>; */
+inline __attribute__((always_inline)) void close_cleanup(void *p)
+{
+ int fd = *(int *) p;
+
+ if (fd >= 0)
+ L_TFR(close(fd));
+}
+
#define _L_IN_SET_CMP(val, type, cmp, ...) __extension__ ({ \
const type __v = (val); \
const typeof(__v) __elems[] = {__VA_ARGS__}; \