[8736] operator new[] based version of strdup() function to get bonuses from Intel Memory allocator mainly in DB code

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2009-10-26 01:05:08 +02:00
parent a2ed351365
commit b0ea8848a5
7 changed files with 29 additions and 19 deletions

View file

@ -184,6 +184,16 @@ enum LocaleConstant
extern char const* localeNames[MAX_LOCALE];
LocaleConstant GetLocaleByName(const std::string& name);
//operator new[] based version of strdup() function! Release memory by using operator delete[] !
inline char * mangos_strdup(const char * source)
{
const size_t length = strlen(source);
char * dest = new char[length + 1];
//set terminating end-of-string symbol
dest[length] = 0;
strcpy(dest, source);
return dest;
}
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
#ifdef max