]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move to struct initialization
authorAlan T. DeKok <aland@freeradius.org>
Thu, 23 May 2024 11:45:43 +0000 (07:45 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 3 Jun 2024 12:43:42 +0000 (08:43 -0400)
to ensure that all fields are initialized

src/lib/bio/retry.c

index fa9951bd21f6669dd2c10c318d1078fe2a48fffc..bacedaf5ba2c0c8f96f8e7bce8d3a89f90b29582 100644 (file)
@@ -178,10 +178,6 @@ static void fr_bio_retry_release(fr_bio_retry_t *my, fr_bio_retry_entry_t *item,
                (void) fr_bio_retry_reset_timer(my);
        }
 
-#ifndef NDEBUG
-       item->buffer = NULL;
-#endif
-       item->uctx = NULL;
        item->packet_ctx = NULL;
 
        fr_assert(my->first != item);
@@ -361,10 +357,6 @@ static ssize_t fr_bio_retry_write_partial(fr_bio_t *bio, void *packet_ctx, const
        if (item->cancelled) {
                (void) fr_rb_remove_by_inline_node(&my->rb, &item->node);
 
-#ifndef NDEBUG
-               item->buffer = NULL;
-#endif
-               item->uctx = NULL;
                item->packet_ctx = NULL;
 
                fr_bio_retry_list_insert_head(&my->free, item);
@@ -642,11 +634,13 @@ static ssize_t fr_bio_retry_write(fr_bio_t *bio, void *packet_ctx, void const *b
        fr_assert(item != NULL);
 
        fr_assert(item->my == my);
-       item->retry.config = NULL;
-       item->retry.start = fr_time();
-       item->packet_ctx = packet_ctx;
-       item->buffer = buffer;
-       item->size = size;
+       *item = (fr_bio_retry_entry_t) {
+               .my = my,
+               .retry.start = fr_time(),
+               .packet_ctx = packet_ctx,
+               .buffer = buffer,
+               .size = size,
+       };
 
        /*
         *      Tell the application that we've saved the packet.  The "item" pointer allows the application