mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
addes auto pointer class for using with my_ functions
switch to using my_ for heap allocations ndb/include/util/NdbAutoPtr.hpp: addes auto pointer class for using with my_ functions ndb/src/mgmclient/CommandInterpreter.cpp: switch to using my_ for heap allocations
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#define __NDB_AUTO_PTR_HPP
|
||||
|
||||
#include <ndb_global.h>
|
||||
#include <my_sys.h>
|
||||
|
||||
template<typename T>
|
||||
class NdbAutoPtr {
|
||||
@ -46,4 +47,13 @@ public:
|
||||
~NdbAutoObjArrayPtr() { if (m_obj) delete[] m_obj;}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class My_auto_ptr {
|
||||
T * m_obj;
|
||||
public:
|
||||
My_auto_ptr(T * obj = 0){ m_obj = obj;}
|
||||
void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; }
|
||||
~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user