This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0e3357b77b Fix uninitialized variables in test and benchmark code
(#12981)
0e3357b77b is described below
commit 0e3357b77b67c05a1a345c62bccc78f7ce564e89
Author: Bryan Call <[email protected]>
AuthorDate: Wed Mar 18 13:34:30 2026 -0700
Fix uninitialized variables in test and benchmark code (#12981)
Add default member initializers using brace initialization:
- AIO_Device: path, fd, id, buf, time_start, time_end, seq_reads,
seq_writes, rand_reads, mode (CID 1523656)
- StartDNS: is_callback (CID 1587260)
- PluginDebugObject: input_ih, fail (CID 1497312)
---
src/iocore/aio/test_AIO.cc | 28 ++++++++++------------
src/iocore/hostdb/benchmark_HostDB.cc | 2 +-
.../http/remap/unit-tests/plugin_testing_common.h | 4 ++--
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/iocore/aio/test_AIO.cc b/src/iocore/aio/test_AIO.cc
index 0cff8b35c4..3ae808bbd1 100644
--- a/src/iocore/aio/test_AIO.cc
+++ b/src/iocore/aio/test_AIO.cc
@@ -93,23 +93,19 @@ int seq_write_size = 0;
int rand_read_size = 0;
struct AIO_Device : public Continuation {
- char *path;
- int fd;
- int id;
- char *buf;
- ink_hrtime time_start, time_end;
- int seq_reads;
- int seq_writes;
- int rand_reads;
- int hotset_idx;
- int mode;
+ char *path{nullptr};
+ int fd{-1};
+ int id{0};
+ char *buf{nullptr};
+ ink_hrtime time_start{0};
+ ink_hrtime time_end{0};
+ int seq_reads{0};
+ int seq_writes{0};
+ int rand_reads{0};
+ int hotset_idx{0};
+ int mode{0};
std::unique_ptr<AIOCallback> io;
- AIO_Device(ProxyMutex *m) : Continuation(m), io{new_AIOCallback()}
- {
- hotset_idx = 0;
- time_start = 0;
- SET_HANDLER(&AIO_Device::do_hotset);
- }
+ AIO_Device(ProxyMutex *m) : Continuation(m), io{new_AIOCallback()} {
SET_HANDLER(&AIO_Device::do_hotset); }
int
select_mode(double p)
{
diff --git a/src/iocore/hostdb/benchmark_HostDB.cc
b/src/iocore/hostdb/benchmark_HostDB.cc
index d11c5b03ea..f1f41a1c4d 100644
--- a/src/iocore/hostdb/benchmark_HostDB.cc
+++ b/src/iocore/hostdb/benchmark_HostDB.cc
@@ -149,7 +149,7 @@ struct StartDNS : Continuation {
HostList::iterator it;
ResultList results;
Clock::time_point start_time;
- bool is_callback;
+ bool is_callback{false};
StartDNS(const std::vector<std::string> &hlist, int id, latch &l)
: Continuation(new_ProxyMutex()), hostlist(hlist), id(id), done_latch(l)
diff --git a/src/proxy/http/remap/unit-tests/plugin_testing_common.h
b/src/proxy/http/remap/unit-tests/plugin_testing_common.h
index fe01a4bcdf..b4b163a1f5 100644
--- a/src/proxy/http/remap/unit-tests/plugin_testing_common.h
+++ b/src/proxy/http/remap/unit-tests/plugin_testing_common.h
@@ -65,8 +65,8 @@ public:
}
/* Input fields used to set the test behavior of the plugin call-backs */
- bool fail = false; /* tell the plugin call-back to fail for testing
purposuses */
- void *input_ih; /* the value to be returned by the plugin instance init
function */
+ bool fail{false}; /* tell the plugin call-back to fail for testing
purposes */
+ void *input_ih{nullptr}; /* the value to be returned by the plugin instance
init function */
/* Output fields showing what happend during the test */
const PluginThreadContext *contextInit = nullptr;
/* plugin initialization context */