return new;
}
-/** Free const'd memory
- *
- * @param[in] ptr to free.
- */
-int talloc_const_free(void const *ptr)
-{
- void *tmp;
-
- if (!ptr) return 0;
-
- memcpy(&tmp, &ptr, sizeof(tmp));
- return talloc_free(tmp);
-}
-
/** Callback to free the autofree ctx on thread exit
*
*/
void **talloc_array_null_strip(void **array);
-int talloc_const_free(void const *ptr);
+/** Free const'd memory
+ *
+ * @param[in] ptr to free.
+ */
+static inline int talloc_const_free(void const *ptr)
+{
+ if (!ptr) return 0;
+
+ return talloc_free(UNCONST(void *, ptr));
+}
/** Free a list of talloced structures containing a next field
*
RCSID("$Id$")
#include <freeradius-devel/io/atomic_queue.h>
+#include <freeradius-devel/util/debug.h>
+#include <freeradius-devel/util/talloc.h>
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
-#include <freeradius-devel/util/debug.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
/**********************************************************************/
typedef struct request_s request_t;
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request);
-int talloc_const_free(void const *ptr);
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request)
{
}
-
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
#include <freeradius-devel/io/control.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/talloc.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
{
}
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
static void NEVER_RETURNS usage(void)
RCSID("$Id$")
#include <freeradius-devel/io/control.h>
-#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/talloc.h>
+#include <freeradius-devel/util/time.h>
#include <sys/event.h>
#include <stdio.h>
typedef struct request_s request_t;
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args);
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request);
-int talloc_const_free(void const *ptr);
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args)
{
{
}
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
static void NEVER_RETURNS usage(void)
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/hash.h>
#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/talloc.h>
#include <string.h>
#include <sys/time.h>
typedef struct request_s request_t;
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args);
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request);
-int talloc_const_free(void const *ptr);
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args)
{
{
}
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/hash.h>
#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/talloc.h>
#include <string.h>
#ifdef HAVE_GETOPT_H
typedef struct request_s request_t;
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args);
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request);
-int talloc_const_free(void const *ptr);
request_t *request_alloc(UNUSED TALLOC_CTX *ctx, UNUSED request_init_args_t const *args)
{
{
}
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
static void alloc_blocks(fr_ring_buffer_t *rb, uint32_t *seed, UNUSED int *start, int *end)
#include <freeradius-devel/io/worker.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/talloc.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
{
}
-int talloc_const_free(void const *ptr)
-{
- if (!ptr) return 0;
- return talloc_free(UNCONST(void *, ptr));
-}
/**********************************************************************/
static void NEVER_RETURNS usage(void)