mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +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
|
|
@ -46,8 +46,8 @@ class SqlStatement : public SqlOperation
|
|||
private:
|
||||
const char *m_sql;
|
||||
public:
|
||||
SqlStatement(const char *sql) : m_sql(strdup(sql)){}
|
||||
~SqlStatement() { void* tofree = const_cast<char*>(m_sql); free(tofree); }
|
||||
SqlStatement(const char *sql) : m_sql(mangos_strdup(sql)){}
|
||||
~SqlStatement() { void* tofree = const_cast<char*>(m_sql); delete [] tofree; }
|
||||
void Execute(Database *db);
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ class SqlTransaction : public SqlOperation
|
|||
std::queue<const char *> m_queue;
|
||||
public:
|
||||
SqlTransaction() {}
|
||||
void DelayExecute(const char *sql) { m_queue.push(strdup(sql)); }
|
||||
void DelayExecute(const char *sql) { m_queue.push(mangos_strdup(sql)); }
|
||||
void Execute(Database *db);
|
||||
};
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ class SqlQuery : public SqlOperation
|
|||
SqlResultQueue * m_queue;
|
||||
public:
|
||||
SqlQuery(const char *sql, MaNGOS::IQueryCallback * callback, SqlResultQueue * queue)
|
||||
: m_sql(strdup(sql)), m_callback(callback), m_queue(queue) {}
|
||||
~SqlQuery() { void* tofree = const_cast<char*>(m_sql); free(tofree); }
|
||||
: m_sql(mangos_strdup(sql)), m_callback(callback), m_queue(queue) {}
|
||||
~SqlQuery() { void* tofree = const_cast<char*>(m_sql); delete [] tofree; }
|
||||
void Execute(Database *db);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue