temporary fix for the portability issues...

...in the config pre-allocation code from 2006-07-29T19:34:46Z!dominic.bolin@exong.net
This commit is contained in:
Patrick Parker 2006-08-01 07:28:20 +00:00
parent d75e869251
commit 55d0414419
2 changed files with 5 additions and 0 deletions

View file

@ -54,6 +54,7 @@ config& config::operator=(const config& cfg)
return *this;
}
#ifndef _MSC_VER
namespace {
config* pre_allocated_configs[200000];
int n_pre_allocated = 0;
@ -71,6 +72,7 @@ void* config::operator new(size_t) throw(std::bad_alloc)
config* res = pre_allocated_configs[--n_pre_allocated];
return res;
}
#endif
// Note this isn't a real copy. The children are still in both config trees
// and updating them will affect both trees.

View file

@ -42,7 +42,10 @@ public:
~config();
config& operator=(const config& cfg);
#ifndef _MSC_VER
void* operator new(size_t) throw(std::bad_alloc);
#endif
typedef std::vector<config*> child_list;
typedef std::map<std::string,child_list> child_map;