1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-16 20:23:18 +03:00

addes auto pointer class for using with my_ functions

switch to using my_ for heap allocations
This commit is contained in:
tomas@poseidon.ndb.mysql.com
2004-10-04 06:58:33 +00:00
parent 673dc109b4
commit c7cadf6575
2 changed files with 42 additions and 47 deletions

View File

@@ -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