This is an automated email from the ASF dual-hosted git repository.
dmeden 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 5f07bf5320 Some sort of "fix" to mute coverity. (#10451)
5f07bf5320 is described below
commit 5f07bf53206dd23289915bfb505f48c147d2d98c
Author: Damian Meden <[email protected]>
AuthorDate: Tue Sep 19 10:14:28 2023 +0200
Some sort of "fix" to mute coverity. (#10451)
---
src/traffic_ctl/CtrlCommands.cc | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/traffic_ctl/CtrlCommands.cc b/src/traffic_ctl/CtrlCommands.cc
index 0164373aa5..1120ba1ba0 100644
--- a/src/traffic_ctl/CtrlCommands.cc
+++ b/src/traffic_ctl/CtrlCommands.cc
@@ -39,7 +39,8 @@ namespace
/// We use yamlcpp as codec implementation.
using Codec = yamlcpp_json_emitter;
-const std::unordered_map<std::string_view, BasePrinter::Options::OutputFormat>
_Fmt_str_to_enum = {
+using StringToOutputFormatMap =
std::unordered_map<std::string_view, BasePrinter::Options::OutputFormat>;
+const StringToOutputFormatMap _Fmt_str_to_enum = {
{"json", BasePrinter::Options::OutputFormat::JSON},
{"rpc", BasePrinter::Options::OutputFormat::RPC }
};
@@ -55,8 +56,8 @@ parse_format(ts::Arguments *args)
BasePrinter::Options::OutputFormat
val{BasePrinter::Options::OutputFormat::NOT_SET};
if (auto data = args->get("format"); data) {
- swoc::TextView fmt{data.value()};
- if (auto search = _Fmt_str_to_enum.find(fmt); search !=
std::end(_Fmt_str_to_enum)) {
+ StringToOutputFormatMap::const_iterator search =
_Fmt_str_to_enum.find({data.value()});
+ if (search != std::end(_Fmt_str_to_enum)) {
val = search->second;
}
}