From: Arran Cudbard-Bell Date: Mon, 17 Apr 2017 22:50:24 +0000 (-0400) Subject: Remove #ifndef NDEBUG talloc_get_type_abort (where appropriate) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ddb484d77ddb08c9574f6846ee506512d00d53c;p=thirdparty%2Ffreeradius-server.git Remove #ifndef NDEBUG talloc_get_type_abort (where appropriate) We use TALLOC_GET_TYPE_ABORT_NOOP now, which means in many cases we don’t need to explicitly ifdef out talloc_get_type_abort. Where we have (void) talloc_get_type_abort() this should be ifdef’d out with #ifndef TALLOC_GET_TYPE_ABORT_NOOP so we don’t get self assignment errors from static analysis tools. If anyone feels like writing a new talloc_get_type_abort_void() (or whatever macro, and replacing all the #ifndef TALLOC_GET_TYPE_ABORT_NOOP talloc_get_type_abort() lines, feel free. --- diff --git a/src/lib/io/channel.c b/src/lib/io/channel.c index fcbe90b1c9f..235b3df7b2f 100644 --- a/src/lib/io/channel.c +++ b/src/lib/io/channel.c @@ -682,8 +682,8 @@ fr_channel_event_t fr_channel_service_message(fr_time_t when, fr_channel_t **p_c */ int fr_channel_service_kevent(fr_channel_t *ch, fr_control_t *c, struct kevent const *kev) { -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif if (fr_control_message_service_kevent(c, kev) == 0) { @@ -726,8 +726,8 @@ int fr_channel_signal_worker_close(fr_channel_t *ch) { fr_channel_control_t cc; -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif ch->active = false; @@ -750,8 +750,8 @@ int fr_channel_worker_ack_close(fr_channel_t *ch) { fr_channel_control_t cc; -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif ch->active = false; @@ -770,8 +770,8 @@ int fr_channel_worker_ack_close(fr_channel_t *ch) */ void fr_channel_worker_ctx_add(fr_channel_t *ch, void *ctx) { -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif ch->end[FROM_WORKER].ctx = ctx; @@ -784,8 +784,8 @@ void fr_channel_worker_ctx_add(fr_channel_t *ch, void *ctx) */ void *fr_channel_worker_ctx_get(fr_channel_t *ch) { -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif return ch->end[FROM_WORKER].ctx; @@ -799,8 +799,8 @@ void *fr_channel_worker_ctx_get(fr_channel_t *ch) */ void fr_channel_master_ctx_add(fr_channel_t *ch, void *ctx) { -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif ch->end[TO_WORKER].ctx = ctx; @@ -813,8 +813,8 @@ void fr_channel_master_ctx_add(fr_channel_t *ch, void *ctx) */ void *fr_channel_master_ctx_get(fr_channel_t *ch) { -#ifndef NDEBUG - talloc_get_type_abort(ch, fr_channel_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(ch, fr_channel_t); #endif return ch->end[TO_WORKER].ctx; diff --git a/src/lib/io/control.c b/src/lib/io/control.c index 1d3b34398cf..b10daa0a25f 100644 --- a/src/lib/io/control.c +++ b/src/lib/io/control.c @@ -188,7 +188,7 @@ int fr_control_gc(UNUSED fr_control_t *c, fr_ring_buffer_t *rb) */ void fr_control_free(fr_control_t *c) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(c, fr_control_t); #endif @@ -257,7 +257,7 @@ int fr_control_message_push(fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, { fr_control_message_t *m; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(c, fr_control_t); #endif @@ -305,7 +305,7 @@ int fr_control_message_send(fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, int rcode; struct kevent kev; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(c, fr_control_t); #endif @@ -395,7 +395,7 @@ int fr_control_message_service_kevent(UNUSED fr_control_t *c, struct kevent cons */ int fr_control_callback_add(fr_control_t *c, uint32_t id, void *ctx, fr_control_callback_t callback) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(c, fr_control_t); #endif @@ -434,7 +434,7 @@ int fr_control_callback_add(fr_control_t *c, uint32_t id, void *ctx, fr_control_ */ int fr_control_callback_delete(fr_control_t *c, uint32_t id) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(c, fr_control_t); #endif diff --git a/src/lib/io/message.c b/src/lib/io/message.c index c7ebbcc4473..7aadbcc06a3 100644 --- a/src/lib/io/message.c +++ b/src/lib/io/message.c @@ -894,7 +894,7 @@ fr_message_t *fr_message_reserve(fr_message_set_t *ms, size_t reserve_size) bool cleaned_up; fr_message_t *m; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); #endif @@ -948,7 +948,7 @@ fr_message_t *fr_message_alloc(fr_message_set_t *ms, fr_message_t *m, size_t act { uint8_t *p; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); /* m is NOT talloc'd */ @@ -1032,7 +1032,7 @@ fr_message_t *fr_message_alloc_reserve(fr_message_set_t *ms, fr_message_t *m, si uint8_t *p; fr_message_t *m2; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); /* m is NOT talloc'd */ @@ -1145,7 +1145,7 @@ fr_message_t *fr_message_alloc_aligned(fr_message_set_t *ms, fr_message_t *m, si size_t aligned_size; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); /* m is NOT talloc'd */ @@ -1220,7 +1220,7 @@ int fr_message_set_messages_used(fr_message_set_t *ms) { int i, used; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); #endif @@ -1249,7 +1249,7 @@ void fr_message_set_gc(fr_message_set_t *ms) int i; int num_cleaned; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); #endif @@ -1278,7 +1278,7 @@ void fr_message_set_debug(fr_message_set_t *ms, FILE *fp) { int i; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ms, fr_message_set_t); #endif diff --git a/src/lib/io/queue.c b/src/lib/io/queue.c index 556b26a38d3..7efa71e5125 100644 --- a/src/lib/io/queue.c +++ b/src/lib/io/queue.c @@ -84,7 +84,7 @@ fr_queue_t *fr_queue_create(TALLOC_CTX *ctx, int size) */ bool fr_queue_push(fr_queue_t *fq, void *data) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif @@ -108,7 +108,7 @@ bool fr_queue_push(fr_queue_t *fq, void *data) */ bool fr_queue_pop(fr_queue_t *fq, void **p_data) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif @@ -130,7 +130,7 @@ bool fr_queue_pop(fr_queue_t *fq, void **p_data) */ int fr_queue_size(fr_queue_t *fq) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif @@ -146,7 +146,7 @@ int fr_queue_size(fr_queue_t *fq) */ int fr_queue_num_elements(fr_queue_t *fq) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif @@ -168,7 +168,7 @@ fr_queue_t *fr_queue_resize(fr_queue_t *fq, int size) fr_queue_t *nq; TALLOC_CTX *ctx; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif @@ -234,7 +234,7 @@ int fr_queue_localize_atomic(fr_queue_t *fq, fr_atomic_queue_t *aq) void *data; int i, room; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(fq, fr_queue_t); #endif diff --git a/src/lib/io/receiver.c b/src/lib/io/receiver.c index cdf2399d99a..cdebf55dea8 100644 --- a/src/lib/io/receiver.c +++ b/src/lib/io/receiver.c @@ -171,11 +171,7 @@ static void fr_receiver_drain_input(fr_receiver_t *rc, fr_channel_t *ch, fr_chan */ static int fr_receiver_idle(void *ctx, struct timeval *wake) { - fr_receiver_t *rc = ctx; - -#ifndef NDEBUG - talloc_get_type_abort(rc, fr_receiver_t); -#endif + fr_receiver_t *rc = talloc_get_type_abort(ctx, fr_receiver_t); rad_cond_assert(rc->el != NULL); /* temporary until we actually use rc here */ @@ -257,7 +253,7 @@ static int fr_receiver_send_request(fr_receiver_t *rc, fr_channel_data_t *cd) fr_receiver_worker_t *worker; fr_channel_data_t *reply; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rc, fr_receiver_t); #endif @@ -270,7 +266,9 @@ static int fr_receiver_send_request(fr_receiver_t *rc, fr_channel_data_t *cd) return 0; } +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(worker, fr_receiver_worker_t); +#endif /* * Send the message to the channel. If we fail, recurse. @@ -474,8 +472,9 @@ static void fr_receiver_worker_callback(void *ctx, void const *data, size_t data rad_assert(data_size == sizeof(worker)); memcpy(&worker, data, data_size); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(worker, fr_worker_t); - +#endif w = talloc_zero(rc, fr_receiver_worker_t); if (!w) _exit(1); @@ -498,13 +497,9 @@ static void fr_receiver_worker_callback(void *ctx, void const *data, size_t data static void fr_receiver_evfilt_user(UNUSED int kq, struct kevent const *kev, void *ctx) { fr_time_t now; - fr_receiver_t *rc = ctx; + fr_receiver_t *rc = talloc_get_type_abort(ctx, fr_receiver_t); uint8_t data[256]; -#ifndef NDEBUG - talloc_get_type_abort(rc, fr_receiver_t); -#endif - if (!fr_control_message_service_kevent(rc->control, kev)) { fr_log(rc->log, L_DBG, "kevent not for us: ignoring"); return; @@ -647,7 +642,7 @@ int fr_receiver_destroy(fr_receiver_t *rc) fr_receiver_worker_t *worker; fr_channel_data_t *cd; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rc, fr_receiver_t); #endif @@ -770,8 +765,10 @@ int fr_receiver_socket_add(fr_receiver_t *rc, int fd, void *ctx, fr_transport_t */ int fr_receiver_worker_add(fr_receiver_t *rc, fr_worker_t *worker) { +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rc, fr_receiver_t); (void) talloc_get_type_abort(worker, fr_worker_t); +#endif return fr_control_message_send(rc->control, rc->rb, FR_CONTROL_ID_WORKER, &worker, sizeof(worker)); } diff --git a/src/lib/io/ring_buffer.c b/src/lib/io/ring_buffer.c index dd85b8c2aed..e62e20a85d1 100644 --- a/src/lib/io/ring_buffer.c +++ b/src/lib/io/ring_buffer.c @@ -97,7 +97,7 @@ fr_ring_buffer_t *fr_ring_buffer_create(TALLOC_CTX *ctx, size_t size) */ uint8_t *fr_ring_buffer_reserve(fr_ring_buffer_t *rb, size_t size) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -178,7 +178,7 @@ uint8_t *fr_ring_buffer_alloc(fr_ring_buffer_t *rb, size_t size) { uint8_t *p; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -305,7 +305,7 @@ uint8_t *fr_ring_buffer_reserve_split(fr_ring_buffer_t *dst, size_t reserve_size { uint8_t *p; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(src, fr_ring_buffer_t); (void) talloc_get_type_abort(dst, fr_ring_buffer_t); #endif @@ -365,7 +365,7 @@ int fr_ring_buffer_free(fr_ring_buffer_t *rb, size_t size_to_free) { size_t block_size; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -468,7 +468,7 @@ empty_buffer: */ int fr_ring_buffer_close(fr_ring_buffer_t *rb) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -486,7 +486,7 @@ int fr_ring_buffer_close(fr_ring_buffer_t *rb) */ size_t fr_ring_buffer_size(fr_ring_buffer_t *rb) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -504,7 +504,7 @@ size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) { size_t size; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif @@ -531,7 +531,7 @@ size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) */ int fr_ring_buffer_start(fr_ring_buffer_t *rb, uint8_t **p_start, size_t *p_size) { -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(rb, fr_ring_buffer_t); #endif diff --git a/src/lib/io/track.c b/src/lib/io/track.c index f25dbdfc969..630bbba8445 100644 --- a/src/lib/io/track.c +++ b/src/lib/io/track.c @@ -81,7 +81,7 @@ int fr_radius_tracking_entry_delete(fr_tracking_t *ft, uint8_t id) { fr_tracking_entry_t *entry; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ft, fr_tracking_t); #endif @@ -119,7 +119,7 @@ fr_tracking_status_t fr_radius_tracking_entry_insert(fr_tracking_t *ft, uint8_t { fr_tracking_entry_t *entry; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ft, fr_tracking_t); #endif @@ -175,7 +175,7 @@ int fr_radius_tracking_entry_reply(fr_tracking_t *ft, uint8_t id, { fr_tracking_entry_t *entry; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(ft, fr_tracking_t); #endif diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index 2192f921fc6..bac96a7817b 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -298,7 +298,7 @@ static void fr_worker_evfilt_user(UNUSED int kq, struct kevent const *kev, void fr_worker_t *worker = ctx; char data[256]; -#ifndef NDEBUG +#ifndef TALLOC_GET_TYPE_ABORT_NOOP talloc_get_type_abort(worker, fr_worker_t); #endif @@ -823,14 +823,11 @@ static int fr_worker_idle(void *ctx, struct timeval *wake) { bool sleeping; int i; - fr_worker_t *worker = ctx; + fr_worker_t *worker = talloc_get_type_abort(ctx, fr_worker_t); -#ifndef NDEBUG - talloc_get_type_abort(worker, fr_worker_t); rad_assert(worker->runnable != NULL); rad_assert(worker->to_decode.heap != NULL); rad_assert(worker->localized.heap != NULL); -#endif /* * The application is polling the event loop, but has @@ -1199,8 +1196,8 @@ fr_channel_t *fr_worker_channel_create(fr_worker_t const *worker, TALLOC_CTX *ct { fr_channel_t *ch; -#ifndef NDEBUG - talloc_get_type_abort(worker, fr_worker_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(worker, fr_worker_t); #endif rad_assert(worker->control != NULL); @@ -1231,8 +1228,8 @@ fr_channel_t *fr_worker_channel_create(fr_worker_t const *worker, TALLOC_CTX *ct */ void fr_worker_name(fr_worker_t *worker, char const *name) { -#ifndef NDEBUG - talloc_get_type_abort(worker, fr_worker_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(worker, fr_worker_t); #endif worker->name = talloc_strdup(worker, name); diff --git a/src/lib/util/dict.c b/src/lib/util/dict.c index 3938276c4b1..98e6bf42f42 100644 --- a/src/lib/util/dict.c +++ b/src/lib/util/dict.c @@ -4297,7 +4297,9 @@ void fr_dict_verify(char const *file, int line, fr_dict_attr_t const *da) if (!fr_cond_assert(0)) fr_exit_now(1); } +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(da, fr_dict_attr_t); +#endif 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: " @@ -4315,7 +4317,9 @@ void fr_dict_verify(char const *file, int line, fr_dict_attr_t const *da) if (!fr_cond_assert(0)) fr_exit_now(1); } +#ifndef TALLOC_GET_TYPE_ABORT_NOOP for (da_p = da; da_p; da_p = da_p->next) (void) talloc_get_type_abort(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) { diff --git a/src/lib/util/event.c b/src/lib/util/event.c index 697036aec8d..2056dadd059 100644 --- a/src/lib/util/event.c +++ b/src/lib/util/event.c @@ -424,16 +424,10 @@ int fr_event_timer_delete(fr_event_list_t *el, fr_event_timer_t **parent) return -1; } -#ifndef NDEBUG /* * Validate the event_t struct to detect memory issues early. */ ev = talloc_get_type_abort(*parent, fr_event_timer_t); - -#else - ev = *parent; -#endif - if (ev->parent) { (void)fr_cond_assert(*(ev->parent) == ev); *ev->parent = NULL; @@ -504,11 +498,7 @@ int fr_event_timer_insert(fr_event_list_t *el, fr_event_callback_t callback, voi if (*parent) { int ret; -#ifndef NDEBUG ev = talloc_get_type_abort(*parent, fr_event_timer_t); -#else - ev = *parent; -#endif ret = fr_heap_extract(el->times, ev); if (!fr_cond_assert(ret == 1)) return -1; /* events MUST be in the heap */ @@ -737,11 +727,7 @@ void fr_event_service(fr_event_list_t *el) continue; } -#ifndef NDEBUG ev = talloc_get_type_abort(el->events[i].udata, fr_event_fd_t); -#else - ev = el->events[i].udata; -#endif if (!fr_cond_assert(ev->is_registered)) continue; diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index fddf1e1644f..01b051acb6f 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2769,7 +2769,9 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) if (!fr_cond_assert(0)) fr_exit_now(1); } +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(vp, VALUE_PAIR); +#endif if (!vp->da) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR da pointer was NULL", file, line); @@ -2787,7 +2789,9 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) if (!talloc_get_type(vp->vp_ptr, uint8_t)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR \"%s\" data buffer type should be " "uint8_t but is %s\n", file, line, vp->da->name, talloc_get_name(vp->vp_ptr)); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(vp->vp_ptr, uint8_t); +#endif } len = talloc_array_length(vp->vp_octets); @@ -2816,7 +2820,9 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) if (!talloc_get_type(vp->vp_ptr, char)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: VALUE_PAIR \"%s\" data buffer type should be " "char but is %s\n", file, line, vp->da->name, talloc_get_name(vp->vp_ptr)); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(vp->vp_ptr, char); +#endif } len = (talloc_array_length(vp->vp_strvalue) - 1); @@ -2847,9 +2853,12 @@ inline void fr_pair_verify(char const *file, int line, VALUE_PAIR const *vp) break; } +#ifndef TALLOC_GET_TYPE_ABORT_NOOP if (vp->da->flags.is_unknown) { (void) talloc_get_type_abort(vp->da, fr_dict_attr_t); - } else { + } else +#endif + { fr_dict_attr_t const *da; /* diff --git a/src/lib/util/rbtree.c b/src/lib/util/rbtree.c index e39e374246f..83abb513aee 100644 --- a/src/lib/util/rbtree.c +++ b/src/lib/util/rbtree.c @@ -65,7 +65,9 @@ struct rbtree_t { */ static void free_walker(rbtree_t *tree, rbnode_t *x) { +#ifndef TALLOC_GET_TYPE_ABORT_NOOP (void) talloc_get_type_abort(x, rbnode_t); +#endif if (x->left != NIL) free_walker(tree, x->left); if (x->right != NIL) free_walker(tree, x->right); diff --git a/src/main/request.c b/src/main/request.c index c1964d01d0e..81a40a86b4b 100644 --- a/src/main/request.c +++ b/src/main/request.c @@ -315,7 +315,7 @@ int request_data_add(REQUEST *request, void const *unique_ptr, int unique_int, v this = next = NULL; for (last = &(request->data); *last != NULL; last = &((*last)->next)) { -#ifdef WITH_VERIFY_PTR +#ifndef TALLOC_GET_TYPE_ABORT_NOOP *last = talloc_get_type_abort(*last, request_data_t); #endif if (((*last)->unique_ptr == unique_ptr) && ((*last)->unique_int == unique_int)) { @@ -397,7 +397,7 @@ void *request_data_get(REQUEST *request, void const *unique_ptr, int unique_int) if (!request) return NULL; for (last = &(request->data); *last != NULL; last = &((*last)->next)) { -#ifdef WITH_VERIFY_PTR +#ifndef TALLOC_GET_TYPE_ABORT_NOOP *last = talloc_get_type_abort(*last, request_data_t); #endif if (((*last)->unique_ptr == unique_ptr) && ((*last)->unique_int == unique_int)) { @@ -437,7 +437,7 @@ int request_data_by_persistance(request_data_t **out, REQUEST *request, bool per next = &head; for (last = &(request->data); *last != NULL; last = &((*last)->next)) { -#ifdef WITH_VERIFY_PTR +#ifndef TALLOC_GET_TYPE_ABORT_NOOP *last = talloc_get_type_abort(*last, request_data_t); #endif if ((*last)->persist == persist) { @@ -478,7 +478,7 @@ void request_data_restore(REQUEST *request, request_data_t *entry) for (last = &(request->data); *last != NULL; last = &((*last)->next)) if (!(*last)->next) break; *last = entry; -#ifdef WITH_VERIFY_PTR +#ifndef TALLOC_GET_TYPE_ABORT_NOOP { request_data_t *this; diff --git a/src/main/state.c b/src/main/state.c index 93fb118b25d..77fdbd91bec 100644 --- a/src/main/state.c +++ b/src/main/state.c @@ -513,7 +513,7 @@ static fr_state_entry_t *state_entry_find(fr_state_tree_t *state, REQUEST *reque entry = rbtree_finddata(state->tree, &my_entry); -#ifdef WITH_VERIFY_PTR +#ifndef TALLOC_GET_TYPE_ABORT_NOOP if (entry) (void) talloc_get_type_abort(entry, fr_state_entry_t); #endif diff --git a/src/main/unlang_interpret.c b/src/main/unlang_interpret.c index 584a210cd91..06ef38b81b9 100644 --- a/src/main/unlang_interpret.c +++ b/src/main/unlang_interpret.c @@ -1315,11 +1315,7 @@ static int _unlang_event_free(unlang_event_t *ev) */ static void unlang_event_timeout_handler(struct timeval *now, void *ctx) { -#ifndef NDEBUG unlang_event_t *ev = talloc_get_type_abort(ctx, unlang_event_t); -#else - unlang_event_t *ev = ctx; -#endif void *mutable_ctx; void *mutable_inst; @@ -1338,11 +1334,7 @@ static void unlang_event_timeout_handler(struct timeval *now, void *ctx) */ static void unlang_event_fd_handler(UNUSED fr_event_list_t *el, int fd, void *ctx) { -#ifndef NDEBUG unlang_event_t *ev = talloc_get_type_abort(ctx, unlang_event_t); -#else - unlang_event_t *ev = ctx; -#endif void *mutable_ctx; void *mutable_inst; diff --git a/src/modules/rlm_eap/eap.c b/src/modules/rlm_eap/eap.c index 85f7b35308c..cdf96adf81f 100644 --- a/src/modules/rlm_eap/eap.c +++ b/src/modules/rlm_eap/eap.c @@ -85,16 +85,10 @@ rlm_rcode_t eap_compose(eap_session_t *eap_session) eap_packet_t *reply; int rcode; -#ifndef NDEBUG eap_session = talloc_get_type_abort(eap_session, eap_session_t); request = talloc_get_type_abort(eap_session->request, REQUEST); eap_round = talloc_get_type_abort(eap_session->this_round, eap_round_t); reply = talloc_get_type_abort(eap_round->request, eap_packet_t); -#else - request = eap_session->request; - eap_round = eap_session->this_round; - reply = eap_round->request; -#endif /* * The Id for the EAP packet to the NAS wasn't set. @@ -855,8 +849,8 @@ eap_session_t *eap_session_continue(eap_packet_raw_t **eap_packet_p, rlm_eap_t c } RDEBUG4("Got eap_session_t %p from request data", eap_session); -#ifdef WITH_VERIFY_PTR - eap_session = talloc_get_type_abort(eap_session, eap_session_t); +#ifndef TALLOC_GET_TYPE_ABORT_NOOP + (void) talloc_get_type_abort(eap_session, eap_session_t); #endif eap_session->rounds++; if (eap_session->rounds >= 50) { diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c index 981eb905f03..b66c807ffd1 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool_tool.c @@ -1691,9 +1691,7 @@ do { \ char *range = NULL; bool is_active; -#ifndef NDEBUG leases[i] = talloc_get_type_abort(leases[i], ippool_tool_lease_t); -#endif gettimeofday(&now, NULL); is_active = now.tv_sec <= leases[i]->next_event; diff --git a/src/modules/rlm_rest/io.c b/src/modules/rlm_rest/io.c index da0695287bf..ec24827aaa9 100644 --- a/src/modules/rlm_rest/io.c +++ b/src/modules/rlm_rest/io.c @@ -126,11 +126,7 @@ static void _rest_io_timer_expired(UNUSED struct timeval *now, void *ctx) { rlm_rest_thread_t *t; -#ifndef NDEBUG t = talloc_get_type_abort(ctx, rlm_rest_thread_t); -#else - t = ctx; -#endif DEBUG4("libcurl timer expired"); @@ -147,11 +143,7 @@ static void _rest_io_service_errored(UNUSED fr_event_list_t *el, int fd, void *c { rlm_rest_thread_t *t; -#ifndef NDEBUG t = talloc_get_type_abort(ctx, rlm_rest_thread_t); -#else - t = ctx; -#endif DEBUG4("libcurl fd %i errored", fd); @@ -168,11 +160,7 @@ static void _rest_io_service_writable(UNUSED fr_event_list_t *el, int fd, void * { rlm_rest_thread_t *t; -#ifndef NDEBUG t = talloc_get_type_abort(ctx, rlm_rest_thread_t); -#else - t = ctx; -#endif DEBUG4("libcurl fd %i now writable", fd); @@ -189,11 +177,7 @@ static void _rest_io_service_readable(UNUSED fr_event_list_t *el, int fd, void * { rlm_rest_thread_t *t; -#ifndef NDEBUG t = talloc_get_type_abort(ctx, rlm_rest_thread_t); -#else - t = ctx; -#endif DEBUG4("libcurl fd %i now readable", fd);