Add missing whitespaces for Zeek coding style

This commit is contained in:
Dominik Charousset 2021-03-01 16:43:34 +01:00
parent 59d114005e
commit 83d7d2da4c
7 changed files with 21 additions and 23 deletions

View file

@ -73,20 +73,20 @@ auto opaque(NativeDblCounter* ptr)
template <class F> template <class F>
auto withNativeLabels(Span<const LabelView> xs, F continuation) auto withNativeLabels(Span<const LabelView> xs, F continuation)
{ {
if (xs.size() <= 10) if ( xs.size() <= 10 )
{ {
ct::label_view buf[10]={ ct::label_view buf[10]={
{{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}},
{{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}},
}; };
for (size_t index = 0; index < xs.size(); ++index) for ( size_t index = 0; index < xs.size(); ++index )
buf[index] = ct::label_view{xs[index].first, xs[index].second}; buf[index] = ct::label_view{xs[index].first, xs[index].second};
return continuation(Span{buf, xs.size()}); return continuation(Span{buf, xs.size()});
} }
else else
{ {
std::vector<ct::label_view> buf; std::vector<ct::label_view> buf;
for (auto x : xs) for ( auto x : xs )
buf.emplace_back(x.first, x.second); buf.emplace_back(x.first, x.second);
return continuation(Span{buf}); return continuation(Span{buf});
} }
@ -118,7 +118,6 @@ int64_t IntCounter::value() const noexcept
IntCounterFamily::IntCounterFamily(Impl* ptr) : MetricFamily(upcast(ptr)) IntCounterFamily::IntCounterFamily(Impl* ptr) : MetricFamily(upcast(ptr))
{ {
// nop
} }
IntCounter IntCounterFamily::getOrAdd(Span<const LabelView> labels) IntCounter IntCounterFamily::getOrAdd(Span<const LabelView> labels)
@ -149,7 +148,6 @@ double DblCounter::value() const noexcept
DblCounterFamily::DblCounterFamily(Impl* ptr) : MetricFamily(upcast(ptr)) DblCounterFamily::DblCounterFamily(Impl* ptr) : MetricFamily(upcast(ptr))
{ {
// nop
} }
DblCounter DblCounterFamily::getOrAdd(Span<const LabelView> labels) DblCounter DblCounterFamily::getOrAdd(Span<const LabelView> labels)

View file

@ -61,7 +61,6 @@ public:
private: private:
explicit IntCounter(Impl* ptr) noexcept : pimpl(ptr) explicit IntCounter(Impl* ptr) noexcept : pimpl(ptr)
{ {
// nop
} }
Impl* pimpl; Impl* pimpl;
@ -154,7 +153,6 @@ public:
private: private:
explicit DblCounter(Impl* ptr) noexcept : pimpl(ptr) explicit DblCounter(Impl* ptr) noexcept : pimpl(ptr)
{ {
// nop
} }
Impl* pimpl; Impl* pimpl;

View file

@ -73,20 +73,20 @@ auto opaque(NativeDblGauge* ptr)
template <class F> template <class F>
auto withNativeLabels(Span<const LabelView> xs, F continuation) auto withNativeLabels(Span<const LabelView> xs, F continuation)
{ {
if (xs.size() <= 10) if ( xs.size() <= 10 )
{ {
ct::label_view buf[10]={ ct::label_view buf[10]={
{{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}},
{{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}}, {{},{}},
}; };
for (size_t index = 0; index < xs.size(); ++index) for ( size_t index = 0; index < xs.size(); ++index )
buf[index] = ct::label_view{xs[index].first, xs[index].second}; buf[index] = ct::label_view{xs[index].first, xs[index].second};
return continuation(Span{buf, xs.size()}); return continuation(Span{buf, xs.size()});
} }
else else
{ {
std::vector<ct::label_view> buf; std::vector<ct::label_view> buf;
for (auto x : xs) for ( auto x : xs )
buf.emplace_back(x.first, x.second); buf.emplace_back(x.first, x.second);
return continuation(Span{buf}); return continuation(Span{buf});
} }
@ -133,7 +133,6 @@ int64_t IntGauge::value() const noexcept
IntGaugeFamily::IntGaugeFamily(Impl* ptr) : MetricFamily(upcast(ptr)) IntGaugeFamily::IntGaugeFamily(Impl* ptr) : MetricFamily(upcast(ptr))
{ {
// nop
} }
IntGauge IntGaugeFamily::getOrAdd(Span<const LabelView> labels) IntGauge IntGaugeFamily::getOrAdd(Span<const LabelView> labels)
@ -174,7 +173,6 @@ double DblGauge::value() const noexcept
DblGaugeFamily::DblGaugeFamily(Impl* ptr) : MetricFamily(upcast(ptr)) DblGaugeFamily::DblGaugeFamily(Impl* ptr) : MetricFamily(upcast(ptr))
{ {
// nop
} }
DblGauge DblGaugeFamily::getOrAdd(Span<const LabelView> labels) DblGauge DblGaugeFamily::getOrAdd(Span<const LabelView> labels)

View file

@ -77,7 +77,6 @@ public:
private: private:
explicit IntGauge(Impl* ptr) noexcept : pimpl(ptr) explicit IntGauge(Impl* ptr) noexcept : pimpl(ptr)
{ {
// nop
} }
Impl* pimpl; Impl* pimpl;
@ -180,7 +179,6 @@ public:
private: private:
explicit DblGauge(Impl* ptr) noexcept : pimpl(ptr) explicit DblGauge(Impl* ptr) noexcept : pimpl(ptr)
{ {
// nop
} }
Impl* pimpl; Impl* pimpl;

View file

@ -63,17 +63,17 @@ auto opaque(NativeDblGaugeFamily* ptr)
template <class F> template <class F>
auto withNative(Span<const std::string_view> xs, F continuation) auto withNative(Span<const std::string_view> xs, F continuation)
{ {
if (xs.size() <= 10) if ( xs.size() <= 10 )
{ {
caf::string_view buf[10]; caf::string_view buf[10];
for (size_t index = 0; index < xs.size(); ++index) for ( size_t index = 0; index < xs.size(); ++index )
buf[index] = xs[index]; buf[index] = xs[index];
return continuation(Span{buf, xs.size()}); return continuation(Span{buf, xs.size()});
} }
else else
{ {
std::vector<caf::string_view> buf; std::vector<caf::string_view> buf;
for (auto x : xs) for ( auto x : xs )
buf.emplace_back(x); buf.emplace_back(x);
return continuation(Span{buf}); return continuation(Span{buf});
} }
@ -81,6 +81,10 @@ auto withNative(Span<const std::string_view> xs, F continuation)
} // namespace } // namespace
Manager::~Manager()
{
}
IntCounterFamily Manager::intCounterFam(std::string_view prefix, IntCounterFamily Manager::intCounterFam(std::string_view prefix,
std::string_view name, std::string_view name,
Span<const std::string_view> labels, Span<const std::string_view> labels,
@ -150,7 +154,7 @@ template <class T>
auto toVector(zeek::Span<T> xs) auto toVector(zeek::Span<T> xs)
{ {
std::vector<std::remove_const_t<T>> result; std::vector<std::remove_const_t<T>> result;
for (auto&& x : xs) for ( auto&& x : xs )
result.emplace_back(x); result.emplace_back(x);
return result; return result;
} }

View file

@ -22,13 +22,14 @@ public:
explicit Manager(Impl* ptr) : pimpl(ptr) explicit Manager(Impl* ptr) : pimpl(ptr)
{ {
//nop
} }
Manager(const Manager&) = delete; Manager(const Manager&) = delete;
Manager& operator=(const Manager&) = delete; Manager& operator=(const Manager&) = delete;
virtual ~Manager();
/** /**
* @returns a counter metric family. Creates the family lazily if necessary. * @returns a counter metric family. Creates the family lazily if necessary.
* @param prefix The prefix (namespace) this family belongs to. * @param prefix The prefix (namespace) this family belongs to.
@ -255,14 +256,14 @@ private:
template <class F> template <class F>
static void withLabelNames(Span<const LabelView> xs, F continuation) static void withLabelNames(Span<const LabelView> xs, F continuation)
{ {
if (xs.size() <= 10) { if ( xs.size() <= 10 ) {
std::string_view buf[10]; std::string_view buf[10];
for (size_t index = 0; index < xs.size(); ++index) for ( size_t index = 0; index < xs.size(); ++index )
buf[index] = xs[index].first; buf[index] = xs[index].first;
return continuation(Span{buf, xs.size()}); return continuation(Span{buf, xs.size()});
} else { } else {
std::vector<std::string_view> buf; std::vector<std::string_view> buf;
for (auto x : xs) for ( auto x : xs )
buf.emplace_back(x.first, x.second); buf.emplace_back(x.first, x.second);
return continuation(Span{buf}); return continuation(Span{buf});
} }
@ -275,6 +276,8 @@ private:
namespace zeek { namespace zeek {
// @note for technically reasons (CAF dependency), this variable gets
// initialized in broker/Manager.cc.
extern telemetry::Manager* telemetry_mgr; extern telemetry::Manager* telemetry_mgr;
} // namespace zeek } // namespace zeek

View file

@ -68,7 +68,6 @@ public:
protected: protected:
explicit MetricFamily(Impl* ptr) : pimpl(ptr) explicit MetricFamily(Impl* ptr) : pimpl(ptr)
{ {
// nop
} }
Impl* pimpl; Impl* pimpl;