• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 18409242756

10 Oct 2025 02:16PM UTC coverage: 19.38% (-44.8%) from 64.13%
18409242756

push

github

web-flow
Merge pull request #16245 from miodvallat/matriochka_exception

auth: yet another logic botch

3972 of 30808 branches covered (12.89%)

Branch coverage included in aggregate %.

11562 of 49346 relevant lines covered (23.43%)

3168.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.82
/pdns/noinitvector.hh
1
#pragma once
2

3
#include <cstdint>
4
#include <memory>
5
#include <new>
6
#include <utility>
7
#include <vector>
8

9
// based on boost::core::noinit_adaptor
10
// The goal is to avoid initialization of the content of a container,
11
// because setting several kB of uint8_t to 0 has a real cost if you
12
// do 100k times per second.
13
template<class Allocator>
14
struct noinit_adaptor: Allocator
15
{
16
  template<class U>
17
  struct rebind {
18
    typedef noinit_adaptor<typename std::allocator_traits<Allocator>::template
19
                           rebind_alloc<U> > other;
20
    };
21

22
  noinit_adaptor(): Allocator() { }
4,867✔
23

24
  template<class U>
25
  noinit_adaptor(U&& u) noexcept : Allocator(std::forward<U>(u)) { }
×
26

27
  template<class U>
28
  noinit_adaptor(const noinit_adaptor<U>& u) noexcept : Allocator(static_cast<const U&>(u)) { }
29

30
  template<class U>
31
  void construct(U* p) {
1,469,338✔
32
    ::new((void*)p) U;
1,469,338✔
33
  }
1,469,338✔
34

35
  template<class U, class V, class... Args>
36
  void construct(U* p, V&& v, Args&&... args) {
212,118✔
37
    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
212,118✔
38
  }
212,118✔
39

40
  template<class U>
41
  void destroy(U* p) {
1,681,456✔
42
    p->~U();
1,681,456✔
43
  }
1,681,456✔
44
};
45

46
template<class T, class U>
47
inline bool operator==(const noinit_adaptor<T>& lhs,
48
                       const noinit_adaptor<U>& rhs) noexcept
49
{
×
50
  return static_cast<const T&>(lhs) == static_cast<const U&>(rhs);
×
51
}
×
52

53
template<class T, class U>
54
inline bool operator!=(const noinit_adaptor<T>& lhs,
55
                       const noinit_adaptor<U>& rhs) noexcept
56
{
×
57
  return !(lhs == rhs);
×
58
}
×
59

60
template<class Allocator>
61
inline noinit_adaptor<Allocator> noinit_adapt(const Allocator& a) noexcept
62
{
63
  return noinit_adaptor<Allocator>(a);
64
}
65

66
template<class T> using NoInitVector = std::vector<T, noinit_adaptor<std::allocator<T>>>;
67

68
using PacketBuffer = NoInitVector<uint8_t>;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc