Commit d419d5c9 authored by Rusty Russell's avatar Rusty Russell

talloc_free() should take a const void *, a-la free().

parent 3c81225f
...@@ -819,12 +819,12 @@ void *talloc_named_const(const void *context, size_t size, const char *name) ...@@ -819,12 +819,12 @@ void *talloc_named_const(const void *context, size_t size, const char *name)
will not be freed if the ref_count is > 1 or the destructor (if will not be freed if the ref_count is > 1 or the destructor (if
any) returns non-zero any) returns non-zero
*/ */
int talloc_free(void *ptr) int talloc_free(const void *ptr)
{ {
int saved_errno = errno, ret; int saved_errno = errno, ret;
lock(ptr); lock(ptr);
ret = _talloc_free(ptr); ret = _talloc_free(discard_const_p(void, ptr));
unlock(); unlock();
if (ret == 0) if (ret == 0)
errno = saved_errno; errno = saved_errno;
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
* See Also: * See Also:
* talloc_set_destructor, talloc_unlink * talloc_set_destructor, talloc_unlink
*/ */
int talloc_free(void *ptr); int talloc_free(const void *ptr);
/** /**
* talloc_set_destructor: set a destructor for when this pointer is freed * talloc_set_destructor: set a destructor for when this pointer is freed
......
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