Merging upstream version 2.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
52cbdbff70
commit
407776cd14
262 changed files with 7434 additions and 3024 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue