void **talloc_array_null_strip(void **array);
+/*
+ * talloc portability issues. 'const' is not part of the talloc
+ * type, but it is part of the pointer type. But only if
+ * talloc_get_type_abort() is just a cast.
+ */
+#ifndef NDEBUG
+#define talloc_get_type_abort_const talloc_get_type_abort
+#else
+#define talloc_get_type_abort_const(ptr, type) (const type *)(ptr)
+#endif
+
#endif
if (!fr_cond_assert(0)) fr_exit_now(1);
}
-#ifndef NDEBUG
- (void) talloc_get_type_abort(da, fr_dict_attr_t);
-#endif
+ (void) talloc_get_type_abort_const(da, fr_dict_attr_t);
if ((!da->flags.is_root) && (da->depth == 0)) {
FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t %s vendor: %i, attr %i: "
if (!fr_cond_assert(0)) fr_exit_now(1);
}
-#ifndef NDEBUG
for (da_p = da; da_p; da_p = da_p->next) {
- (void) talloc_get_type_abort(da_p, fr_dict_attr_t);
+ (void) talloc_get_type_abort_const(da_p, fr_dict_attr_t);
}
-#endif
for (i = da->depth, da_p = da; (i >= 0) && da; i--, da_p = da_p->parent) {
if (i != (int)da_p->depth) {
if (!fr_cond_assert(0)) fr_exit_now(1);
}
-#ifndef NDEBUG
- (void) talloc_get_type_abort(vp, VALUE_PAIR);
-#endif
+ (void) talloc_get_type_abort_const(vp, VALUE_PAIR);
if (!vp->da) {
FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR da pointer was NULL", file, line);
}
if (vp->da->flags.is_unknown) {
-#ifndef NDEBUG
- (void) talloc_get_type_abort(vp->da, fr_dict_attr_t);
-#endif
+ (void) talloc_get_type_abort_const(vp->da, fr_dict_attr_t);
} else {
fr_dict_attr_t const *da;
{
size_t len;
-#ifndef NDEBUG
- (void) talloc_get_type_abort(src, char);
-#endif
+ (void) talloc_get_type_abort_const(src, char);
len = talloc_array_length(src);
if ((len == 1) || (src[len - 1] != '\0')) {
{
uint8_t const *bin;
-#ifndef NDEBUG
- (void) talloc_get_type_abort(src, uint8_t);
-#endif
+ (void) talloc_get_type_abort_const(src, uint8_t);
bin = talloc_steal(ctx, src);
if (!bin) {
*/
static int mod_decode(void const *instance, REQUEST *request, uint8_t *const data, size_t data_len)
{
- proto_radius_t const *inst = talloc_get_type_abort(instance, proto_radius_t);
+ proto_radius_t const *inst = talloc_get_type_abort_const(instance, proto_radius_t);
RADCLIENT *client;
rad_assert(data[0] < FR_MAX_PACKET_CODE);
{
size_t len;
- proto_radius_t const *inst = talloc_get_type_abort(instance, proto_radius_t);
+ proto_radius_t const *inst = talloc_get_type_abort_const(instance, proto_radius_t);
RADCLIENT *client;
/*
static void mod_process_set(void const *instance, REQUEST *request)
{
- proto_radius_t const *inst = talloc_get_type_abort(instance, proto_radius_t);
+ proto_radius_t const *inst = talloc_get_type_abort_const(instance, proto_radius_t);
fr_io_process_t process;
rad_assert(request->packet->code != 0);
* Bootstrap the process modules
*/
while ((cp = cf_pair_find_next(conf, cp, "type"))) {
- dl_t const *module = talloc_get_type_abort(inst->process_submodule[i]->module, dl_t);
+ dl_t const *module = talloc_get_type_abort_const(inst->process_submodule[i]->module, dl_t);
fr_app_process_t const *app_process = (fr_app_process_t const *)module->common;
if (app_process->bootstrap && (app_process->bootstrap(inst->process_submodule[i]->data,
static ssize_t mod_read(void const *instance, void **packet_ctx, fr_time_t **recv_time, uint8_t *buffer, size_t buffer_len, size_t *leftover, uint32_t *priority)
{
- proto_radius_udp_t const *inst = talloc_get_type_abort(instance, proto_radius_udp_t);
+ proto_radius_udp_t const *inst = talloc_get_type_abort_const(instance, proto_radius_udp_t);
ssize_t data_size;
size_t packet_len;
static void mod_radius_signal(REQUEST *request, void *instance, void *thread, void *ctx,
fr_state_action_t action)
{
- rlm_radius_t const *inst = talloc_get_type_abort(instance, rlm_radius_t);
+ rlm_radius_t const *inst = talloc_get_type_abort_const(instance, rlm_radius_t);
rlm_radius_thread_t *t = talloc_get_type_abort(thread, rlm_radius_thread_t);
rlm_radius_link_t *link = talloc_get_type_abort(ctx, rlm_radius_link_t);
static int conn_cmp(void const *one, void const *two)
{
- rlm_radius_udp_connection_t const *a = talloc_get_type_abort(one, rlm_radius_udp_connection_t);
- rlm_radius_udp_connection_t const *b = talloc_get_type_abort(two, rlm_radius_udp_connection_t);
+ rlm_radius_udp_connection_t const *a = talloc_get_type_abort_const(one, rlm_radius_udp_connection_t);
+ rlm_radius_udp_connection_t const *b = talloc_get_type_abort_const(two, rlm_radius_udp_connection_t);
if (timercmp(&a->mrs_time, &b->mrs_time, <)) return -1;
if (timercmp(&a->mrs_time, &b->mrs_time, >)) return +1;