# # patch "ChangeLog" # from [f7b8ef83cee58105d6d487a8efeb68c3897a994a] # to [46d9833f18fd069bb84c73e52bdb213eee9b8049] # # patch "botan/allocate.cpp" # from [bf95f795b13f03947041d16bae44b936d914f30d] # to [8222a5340314265755a2b79469a367158fc2f99b] # # patch "monotone.cc" # from [eb094c5de51330e85c983f50a0f93ad8dce047eb] # to [3db5da40dab63271ab49a64bb685823a9f2920e9] # ======================================================================== --- ChangeLog f7b8ef83cee58105d6d487a8efeb68c3897a994a +++ ChangeLog 46d9833f18fd069bb84c73e52bdb213eee9b8049 @@ -1,3 +1,9 @@ +2005-08-30 Matt Johnston + + * botan/allocate.cpp: avoid string comparison when looking up the + default allocator + * monotone.cc (cpp_main): set a default allocator + 2005-08-28 Nathaniel Smith * tests/t_attributes.at: Delete checkout dir in between ======================================================================== --- botan/allocate.cpp bf95f795b13f03947041d16bae44b936d914f30d +++ botan/allocate.cpp 8222a5340314265755a2b79469a367158fc2f99b @@ -21,6 +21,7 @@ { public: Allocator* get(const std::string&) const; + Allocator* get_default() const; void add(const std::string&, Allocator*); std::string set_default_allocator(const std::string&); @@ -49,6 +50,21 @@ } /************************************************* +* Get the default allocator from the factory * +*************************************************/ +Allocator* AllocatorFactory::get_default() const + { + Mutex_Holder lock(factory_lock); + + std::map::const_iterator iter; + iter = alloc.find(default_allocator); + + if(iter == alloc.end()) + return 0; + return iter->second; + } + +/************************************************* * Make a new type available to the factory * *************************************************/ void AllocatorFactory::add(const std::string& type, Allocator* allocator) @@ -101,13 +117,13 @@ Allocator* alloc = 0; - if(type != "") + if(!type.empty()) { alloc = factory->get(type); if(alloc) return alloc; } - alloc = factory->get("default"); + alloc = factory->get_default(); if(alloc) return alloc; alloc = factory->get("locking"); ======================================================================== --- monotone.cc eb094c5de51330e85c983f50a0f93ad8dce047eb +++ monotone.cc 3db5da40dab63271ab49a64bb685823a9f2920e9 @@ -263,6 +263,7 @@ // Set up secure memory allocation etc Botan::Init::initialize(); + Botan::set_default_allocator("malloc"); // decode all argv values into a UTF-8 array