]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove xfr->end
authorAram Sargsyan <aram@isc.org>
Fri, 22 Sep 2023 15:59:32 +0000 (15:59 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Tue, 26 Sep 2023 12:23:10 +0000 (12:23 +0000)
The structure member is populated only moments before its
destruction, and is not used anywhere, except for the
destructor. Use a local variable instead.

lib/dns/xfrin.c

index 2560e229b11f3a10677a28b2a24c6ee946903577..d818aca33eb66fd663ff5a1acec5e13dc34517a4 100644 (file)
@@ -152,7 +152,6 @@ struct dns_xfrin {
        unsigned int nrecs; /*%< Number of records recvd */
        uint64_t nbytes;    /*%< Number of bytes received */
        isc_time_t start;   /*%< Start time of the transfer */
-       isc_time_t end;     /*%< End time of the transfer */
        dns_transport_type_t soa_transport_type;
        uint32_t end_serial;
 
@@ -1878,6 +1877,7 @@ failure:
 static void
 xfrin_destroy(dns_xfrin_t *xfr) {
        uint64_t msecs, persec;
+       isc_time_t now = isc_time_now();
 
        REQUIRE(VALID_XFRIN(xfr));
        REQUIRE(dns_zone_gettid(xfr->zone) == isc_tid());
@@ -1900,8 +1900,7 @@ xfrin_destroy(dns_xfrin_t *xfr) {
         * and print a log message with the bytes and rate.
         */
        LOCK(&xfr->statslock);
-       xfr->end = isc_time_now();
-       msecs = isc_time_microdiff(&xfr->end, &xfr->start) / 1000;
+       msecs = isc_time_microdiff(&now, &xfr->start) / 1000;
        if (msecs == 0) {
                msecs = 1;
        }