mirror of
https://github.com/AuxXxilium/kmod.git
synced 2025-01-23 07:09:40 +07:00
util: Add cleanup attribute
This commit is contained in:
parent
807c601df2
commit
d7aa6e23fc
@ -3,6 +3,7 @@
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -56,3 +57,9 @@ static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u)
|
||||
{
|
||||
return 1 << ((sizeof(u) * 8) - __builtin_clz(u - 1));
|
||||
}
|
||||
|
||||
static inline void freep(void *p) {
|
||||
free(*(void**) p);
|
||||
}
|
||||
|
||||
#define _cleanup_free_ _cleanup_(freep)
|
||||
|
@ -57,3 +57,4 @@
|
||||
#define _printf_format_(a,b) __attribute__((format (printf, a, b)))
|
||||
#define _unused_ __attribute__((unused))
|
||||
#define _always_inline_ __inline__ __attribute__((always_inline))
|
||||
#define _cleanup_(x) __attribute__((cleanup(x)))
|
||||
|
Loading…
Reference in New Issue
Block a user