mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 13:37:01 +00:00
[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:
parent
a2ed351365
commit
b0ea8848a5
7 changed files with 29 additions and 19 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue