]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: define free_func_t
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Nov 2018 07:33:28 +0000 (16:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 2 Dec 2018 05:34:25 +0000 (06:34 +0100)
src/basic/alloc-util.h
src/basic/static-destruct.h

index 2a6deb12ca0936b3ef996b2855ff75b553135e64..7d237720b985f08692e8f948281b2b4f5669d7a8 100644 (file)
@@ -8,6 +8,8 @@
 
 #include "macro.h"
 
+typedef void (*free_func_t)(void *p);
+
 #define new(t, n) ((t*) malloc_multiply(sizeof(t), (n)))
 
 #define new0(t, n) ((t*) calloc((n), sizeof(t)))
index cad838083fa7b1d792d4863354669d46643d660e..4a9a40a83500ffc2a8fb17f050abe1be7a4c44d5 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include "alloc-util.h"
 #include "macro.h"
 
 /* A framework for registering static variables that shall be freed on shutdown of a process. It's a bit like gcc's
@@ -9,7 +10,7 @@
 
 typedef struct StaticDestructor {
         void *data;
-        void (*destroy)(void *p);
+        free_func_t destroy;
 } StaticDestructor;
 
 #define STATIC_DESTRUCTOR_REGISTER(variable, func) \