1
0
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:
unknown
2004-10-04 06:58:33 +00:00
parent 341d8aaee3
commit 77fd668ef4
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