use auto_ptr or unique_ptr
This commit is contained in:
@@ -153,13 +153,13 @@ ca_client_context::ca_client_context ( bool enablePreemptiveCallback ) :
|
||||
this->localPort = htons ( tmpAddr.ia.sin_port );
|
||||
}
|
||||
|
||||
std::auto_ptr < CallbackGuard > pCBGuard;
|
||||
ca::auto_ptr < CallbackGuard > pCBGuard;
|
||||
if ( ! enablePreemptiveCallback ) {
|
||||
pCBGuard.reset ( new CallbackGuard ( this->cbMutex ) );
|
||||
}
|
||||
|
||||
// multiple steps ensure exception safety
|
||||
this->pCallbackGuard = pCBGuard;
|
||||
this->pCallbackGuard = PTRMOVE(pCBGuard);
|
||||
}
|
||||
|
||||
ca_client_context::~ca_client_context ()
|
||||
|
||||
@@ -38,6 +38,17 @@
|
||||
#include "cadef.h"
|
||||
#include "syncGroup.h"
|
||||
|
||||
namespace ca {
|
||||
#if __cplusplus>=201103L
|
||||
template<typename T>
|
||||
using auto_ptr = std::unique_ptr<T>;
|
||||
#define PTRMOVE(AUTO) std::move(AUTO)
|
||||
#else
|
||||
using std::auto_ptr;
|
||||
#define PTRMOVE(AUTO) (AUTO)
|
||||
#endif
|
||||
}
|
||||
|
||||
struct oldChannelNotify : private cacChannelNotify {
|
||||
public:
|
||||
oldChannelNotify (
|
||||
@@ -393,8 +404,8 @@ private:
|
||||
epicsEvent ioDone;
|
||||
epicsEvent callbackThreadActivityComplete;
|
||||
epicsThreadId createdByThread;
|
||||
std::auto_ptr < CallbackGuard > pCallbackGuard;
|
||||
std::auto_ptr < cacContext > pServiceContext;
|
||||
ca::auto_ptr < CallbackGuard > pCallbackGuard;
|
||||
ca::auto_ptr < cacContext > pServiceContext;
|
||||
caExceptionHandler * ca_exception_func;
|
||||
void * ca_exception_arg;
|
||||
caPrintfFunc * pVPrintfFunc;
|
||||
|
||||
@@ -40,6 +40,17 @@
|
||||
#include "repeaterSubscribeTimer.h"
|
||||
#include "SearchDest.h"
|
||||
|
||||
namespace ca {
|
||||
#if __cplusplus>=201103L
|
||||
template<typename T>
|
||||
using auto_ptr = std::unique_ptr<T>;
|
||||
#define PTRMOVE(AUTO) std::move(AUTO)
|
||||
#else
|
||||
using std::auto_ptr;
|
||||
#define PTRMOVE(AUTO) (AUTO)
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" void cacRecvThreadUDP ( void *pParam );
|
||||
|
||||
LIBCA_API void epicsStdCall caStartRepeaterIfNotInstalled (
|
||||
@@ -161,7 +172,7 @@ private:
|
||||
epicsMutex & cacMutex;
|
||||
const unsigned nTimers;
|
||||
struct SearchArray {
|
||||
typedef std::auto_ptr <searchTimer> value_type;
|
||||
typedef ca::auto_ptr <searchTimer> value_type;
|
||||
value_type *arr;
|
||||
SearchArray(size_t n) : arr(new value_type[n]) {}
|
||||
~SearchArray() { delete[] arr; }
|
||||
|
||||
Reference in New Issue
Block a user