This file is indexed.

/usr/include/memtailor/ArenaVector.h is in libmemtailor-dev 1.0~git20160302-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Copyright (C) 2011 Bjarke Hammersholt Roune (www.broune.com)
   MemTailor is distributed under the Modified BSD License. See license.txt. */
#ifndef MEMT_ARENA_VECTOR_GUARD
#define MEMT_ARENA_VECTOR_GUARD

#include "stdinc.h"
#include "Arena.h"

namespace memt {
  /** Works as std::vector, except it cannot grow its capacity
      and the memory is taken from an Arena.

      Only frees its memory on destruction if FreeMemory
      is true. In that case that memory must be the top allocation
      on the Arena.

      Always calls the destructors of contained entries even
      when FreeMemory is false. */
  template<class T, bool FreeMemory>
  class ArenaVector {
  public:
    typedef T* iterator;
    typedef const T* const_iterator;
    typedef T& reference;
    typedef const T& const_reference;
    typedef T value_type;

    ArenaVector(Arena& arena, size_t capacity);
    ~ArenaVector() {
      clear();
      if (FreeMemory)
        _arena->freeTop(_begin);
    }

    bool empty() const {return _begin == _end;}
    size_t size() const {return _end - _begin;}
    T* begin() {return _begin;}
    const T* begin() const {return _begin;}
    T* end() {return _end;}
    const T* end() const {return _end;}

    void push_back(const T& t) {
      MEMT_ASSERT_NO_ASSUME(_end != _capacityEndDebug);
      new (_end) T(t);
      ++_end;
    }
    void pop_back() {
      MEMT_ASSERT(!empty());
      --_end;
      _end->~T();
    }
    void clear() {
      while (!empty())
        pop_back();
    }

  private:
    T* _begin;
    T* _end;
    Arena* _arena; /// @todo: only store if freeing memory
#ifdef MEMT_DEBUG
    T* _capacityEndDebug;
#endif
  };

  template<class T, bool DM>
  ArenaVector<T, DM>::ArenaVector(Arena& arena, size_t capacity) {
    _begin = arena.allocArrayNoCon<T>(capacity).first;
    _end = _begin;
    _arena = &arena;
#ifdef MEMT_DEBUG
    _capacityEndDebug = _begin + capacity;
#endif
  }
}

#endif