1
0
Fork 0

Merging upstream version 2.6.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:24:54 +01:00
parent 52cbdbff70
commit 407776cd14
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
262 changed files with 7434 additions and 3024 deletions

View file

@ -2,6 +2,9 @@
#ifndef __CLEANUP_H
#define __CLEANUP_H
#include <unistd.h>
#include <stdlib.h>
#define __cleanup__(fn) __attribute__((cleanup(fn)))
#define DECLARE_CLEANUP_FUNC(name, type) \
@ -16,4 +19,17 @@ DECLARE_CLEANUP_FUNC(name, type) \
DECLARE_CLEANUP_FUNC(cleanup_charp, char *);
static inline void freep(void *p)
{
free(*(void**) p);
}
#define _cleanup_free_ __cleanup__(freep)
static inline void close_file(int *f)
{
if (*f >= 0)
close(*f);
}
#define _cleanup_file_ __cleanup__(close_file)
#endif