mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix clang-tidy modernize-return-braced-init-list warnings in headers
This commit is contained in:
parent
157c488b9d
commit
ed202b36b2
4 changed files with 7 additions and 7 deletions
|
@ -96,7 +96,7 @@ public:
|
|||
// For the current iteration, returns the corresponding value.
|
||||
ZVal IterValue() {
|
||||
auto tev = (*tbl_iter)->value;
|
||||
return ZVal(tev->GetVal(), value_var_type);
|
||||
return {tev->GetVal(), value_var_type};
|
||||
}
|
||||
|
||||
// Called upon finishing the iteration.
|
||||
|
|
|
@ -32,6 +32,6 @@ inline bool operator==(const PortRange& a, const PortRange& b) {
|
|||
|
||||
inline bool operator!=(const PortRange& a, const PortRange& b) { return ! (a == b); }
|
||||
|
||||
inline PortRange make_port_range(hilti::rt::Port begin, hilti::rt::Port end) { return PortRange(begin, end); }
|
||||
inline PortRange make_port_range(hilti::rt::Port begin, hilti::rt::Port end) { return {begin, end}; }
|
||||
|
||||
} // namespace zeek::spicy::rt
|
||||
|
|
|
@ -549,7 +549,7 @@ inline ::hilti::rt::Address as_address(const ValPtr& v) {
|
|||
/** Converts a Zeek `bool` value to its Spicy equivalent. Throws on error. */
|
||||
inline ::hilti::rt::Bool as_bool(const ValPtr& v) {
|
||||
detail::check_type(v, TYPE_BOOL, "bool");
|
||||
return ::hilti::rt::Bool(v->AsBool());
|
||||
return {v->AsBool()};
|
||||
}
|
||||
|
||||
/** Converts a Zeek `count` value to its Spicy equivalent. Throws on error. */
|
||||
|
@ -592,7 +592,7 @@ inline ::hilti::rt::Port as_port(const ValPtr& v) {
|
|||
auto p = v->AsPortVal();
|
||||
// Wrap port number into safe integer to catch any overflows (Zeek returns
|
||||
// an uint32, while HILTI wants an uint16).
|
||||
return ::hilti::rt::Port(hilti::rt::integer::safe<uint16_t>(p->Port()), p->PortType());
|
||||
return {hilti::rt::integer::safe<uint16_t>(p->Port()), p->PortType()};
|
||||
}
|
||||
|
||||
/** Converts a Zeek `record` value to its Spicy equivalent. Throws on error. */
|
||||
|
@ -615,14 +615,14 @@ inline ValSetPtr as_set(const ValPtr& v) {
|
|||
inline hilti::rt::Bytes as_string(const ValPtr& v) {
|
||||
detail::check_type(v, TYPE_STRING, "string");
|
||||
auto str = v->AsString();
|
||||
return hilti::rt::Bytes(reinterpret_cast<const char*>(str->Bytes()), str->Len());
|
||||
return {reinterpret_cast<const char*>(str->Bytes()), static_cast<size_t>(str->Len())};
|
||||
}
|
||||
|
||||
/** Converts a Zeek `subnet` value to its Spicy equivalent. Throws on error. */
|
||||
inline ::hilti::rt::Network as_subnet(const ValPtr& v) {
|
||||
detail::check_type(v, TYPE_SUBNET, "subnet");
|
||||
auto subnet = v->AsSubNet();
|
||||
return ::hilti::rt::Network(subnet.Prefix(), subnet.Length());
|
||||
return {subnet.Prefix(), subnet.Length()};
|
||||
}
|
||||
|
||||
/** Converts a Zeek `table` value to its Spicy equivalent. Throws on error. */
|
||||
|
|
|
@ -29,7 +29,7 @@ static inline void add_path(std::string& old_path, const path& new_path) {
|
|||
static path get_env_path_or(const char* name, const char* default_) {
|
||||
assert(std::strlen(default_) != 0);
|
||||
if ( auto p = hilti::rt::getenv(name); p && ! p->empty() )
|
||||
return path(*p);
|
||||
return {*p};
|
||||
else
|
||||
return default_;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue