# # # patch "botan/mem_pool.cpp" # from [351d44cf69340cd62f950c5b03b9793ffcd0fb8d] # to [48fe6a0021988c2c9a858db08e12f99909f13958] # # patch "botan/mem_pool.h" # from [b932cab50b9ce759b8becb0d03d9fb7dd50deb4e] # to [8da5c9610df19a389a0188bae97da53a0023cc0d] # ============================================================ --- botan/mem_pool.cpp 351d44cf69340cd62f950c5b03b9793ffcd0fb8d +++ botan/mem_pool.cpp 48fe6a0021988c2c9a858db08e12f99909f13958 @@ -213,7 +213,7 @@ void Pooling_Allocator::deallocate(void* const u32bit block_no = round_up(n, BLOCK_SIZE) / BLOCK_SIZE; std::vector::iterator i = - std::lower_bound(blocks.begin(), blocks.end(), ptr); + std::lower_bound(blocks.begin(), blocks.end(), ptr, diff_less()); if(i != blocks.end() && i->contains((byte*)ptr, block_no)) i->free(ptr, block_no); @@ -278,7 +278,7 @@ void Pooling_Allocator::get_more_core(u3 } std::sort(blocks.begin(), blocks.end()); - last_used = std::lower_bound(blocks.begin(), blocks.end(), ptr); + last_used = std::lower_bound(blocks.begin(), blocks.end(), ptr, diff_less()); } } ============================================================ --- botan/mem_pool.h b932cab50b9ce759b8becb0d03d9fb7dd50deb4e +++ botan/mem_pool.h 8da5c9610df19a389a0188bae97da53a0023cc0d @@ -11,6 +11,7 @@ #include #include #include +#include namespace Botan { @@ -56,6 +57,12 @@ class Pooling_Allocator : public Allocat u32bit block_size; }; +template +struct diff_less : public std::binary_function<_first,_second,bool> +{ + bool operator()(const _first& __x, const _second& __y) const { return __x < __y; } +}; + const u32bit PREF_SIZE, BLOCK_SIZE; std::vector blocks;