ext/include/iv/alloc.h in iv-phonic-0.0.3 vs ext/include/iv/alloc.h in iv-phonic-0.0.5

- old
+ new

@@ -115,16 +115,15 @@ public: Space() : arena_(&init_arenas_[0]), start_malloced_(NULL), malloced_() { - unsigned int c = 0; - for (; c < kInitArenas-1; ++c) { + for (std::size_t c = 0; c < N-1; ++c) { init_arenas_[c].SetNext(&init_arenas_[c+1]); } } - virtual ~Space() { + ~Space() { if (start_malloced_) { Arena *now = start_malloced_, *next = start_malloced_; while (now) { next = now->Next(); delete now; @@ -159,11 +158,11 @@ malloced_.push_back(result); return result; } } - virtual inline void Clear() { + inline void Clear() { arena_ = init_arenas_; std::for_each(malloced_.begin(), malloced_.end(), &Malloced::Delete); malloced_.clear(); } @@ -193,8 +192,16 @@ Arena init_arenas_[kInitArenas]; Arena* arena_; Arena* start_malloced_; std::vector<void*>malloced_; }; + +// surpress compiler warning +template<> +inline Space<1>::Space() + : arena_(&init_arenas_[0]), + start_malloced_(NULL), + malloced_() { +} } } // namespace iv::core #endif // _IV_ALLOC_H_