From: Yu Watanabe Date: Tue, 27 Nov 2018 07:33:28 +0000 (+0900) Subject: util: define free_func_t X-Git-Tag: v240~151^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e30f9c972b789152d67ff34fd3bda294d20d1f51;p=thirdparty%2Fsystemd.git util: define free_func_t --- diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h index 2a6deb12ca0..7d237720b98 100644 --- a/src/basic/alloc-util.h +++ b/src/basic/alloc-util.h @@ -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))) diff --git a/src/basic/static-destruct.h b/src/basic/static-destruct.h index cad838083fa..4a9a40a8350 100644 --- a/src/basic/static-destruct.h +++ b/src/basic/static-destruct.h @@ -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) \