]> git.ozlabs.org Git - ccan/commitdiff
talloc_free() should take a const void *, a-la free().
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 18 Jul 2009 08:13:33 +0000 (17:43 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Sat, 18 Jul 2009 08:13:33 +0000 (17:43 +0930)
ccan/talloc/talloc.c
ccan/talloc/talloc.h

index 1424748eef7fa9a5b49caabd9fb095914b51cd50..7a2dfab11bd1b7eb493f0ad437bef72b42ac4a97 100644 (file)
@@ -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
    any) returns non-zero
 */
    will not be freed if the ref_count is > 1 or the destructor (if
    any) returns non-zero
 */
-int talloc_free(void *ptr)
+int talloc_free(const void *ptr)
 {
        int saved_errno = errno, ret;
 
        lock(ptr);
 {
        int saved_errno = errno, ret;
 
        lock(ptr);
-       ret = _talloc_free(ptr);
+       ret = _talloc_free(discard_const_p(void, ptr));
        unlock();
        if (ret == 0)
                errno = saved_errno;
        unlock();
        if (ret == 0)
                errno = saved_errno;
index 791c98a2bbd88c6e0e0d5571f6af341f07e007a3..e38d05b8095ca9d55abdbd8e9ac833e31ca08c0c 100644 (file)
  * See Also:
  *     talloc_set_destructor, talloc_unlink
  */
  * See Also:
  *     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