Commit 58785e0b authored by Rusty Russell's avatar Rusty Russell

Fix !HAVE_TYPEOF case by using new typesafe_cb.

parent df4e8e9d
...@@ -94,8 +94,10 @@ int main(int argc, char *argv[]) ...@@ -94,8 +94,10 @@ int main(int argc, char *argv[])
if (argc != 2) if (argc != 2)
return 1; return 1;
if (strcmp(argv[1], "depends") == 0) if (strcmp(argv[1], "depends") == 0) {
printf("typesafe_cb\n");
return 0; return 0;
}
return 1; return 1;
} }
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "config.h" #include "config.h"
#include "typesafe_cb/typesafe_cb.h"
/* /*
this uses a little trick to allow __LINE__ to be stringified this uses a little trick to allow __LINE__ to be stringified
...@@ -171,10 +172,7 @@ int talloc_free(void *ptr); ...@@ -171,10 +172,7 @@ int talloc_free(void *ptr);
* talloc, talloc_free * talloc, talloc_free
*/ */
#define talloc_set_destructor(ptr, function) \ #define talloc_set_destructor(ptr, function) \
do { \ _talloc_set_destructor((ptr), typesafe_cb(int, (function), (ptr)))
int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \
_talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \
} while(0)
/** /**
* talloc_zero - allocate zeroed dynamic memory for a type * talloc_zero - allocate zeroed dynamic memory for a type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment