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.
*/
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) {
{
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;
{
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;
*/
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;
*/
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;
*/
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;
*/
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;
*/
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
{
fr_control_message_t *m;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(c, fr_control_t);
#endif
int rcode;
struct kevent kev;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(c, fr_control_t);
#endif
*/
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
*/
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
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
{
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 */
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 */
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 */
{
int i, used;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ms, fr_message_set_t);
#endif
int i;
int num_cleaned;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ms, fr_message_set_t);
#endif
{
int i;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ms, fr_message_set_t);
#endif
*/
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
*/
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
*/
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
*/
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
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
void *data;
int i, room;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(fq, fr_queue_t);
#endif
*/
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 */
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
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.
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);
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;
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
*/
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));
}
*/
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
{
uint8_t *p;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(rb, fr_ring_buffer_t);
#endif
{
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
{
size_t block_size;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(rb, fr_ring_buffer_t);
#endif
*/
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
*/
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
{
size_t size;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(rb, fr_ring_buffer_t);
#endif
*/
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
{
fr_tracking_entry_t *entry;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ft, fr_tracking_t);
#endif
{
fr_tracking_entry_t *entry;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ft, fr_tracking_t);
#endif
{
fr_tracking_entry_t *entry;
-#ifndef NDEBUG
+#ifndef TALLOC_GET_TYPE_ABORT_NOOP
(void) talloc_get_type_abort(ft, fr_tracking_t);
#endif
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
{
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
{
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);
*/
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);
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: "
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) {
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;
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 */
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;
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);
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);
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);
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;
/*
*/
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);
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)) {
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)) {
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) {
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;
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
*/
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;
*/
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;
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.
}
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) {
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;
{
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");
{
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);
{
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);
{
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);