diff options
-rw-r--r-- | ChangeLog | 42 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 42 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 42 | ||||
-rw-r--r-- | ace/ACE.i | 10 | ||||
-rw-r--r-- | ace/ATM_Stream.cpp | 3 | ||||
-rw-r--r-- | ace/Activation_Queue.cpp | 3 | ||||
-rw-r--r-- | ace/Bound_Ptr.i | 14 | ||||
-rw-r--r-- | ace/Configuration.cpp | 13 | ||||
-rw-r--r-- | ace/Configuration_Import_Export.cpp | 5 | ||||
-rw-r--r-- | ace/Containers_T.cpp | 18 | ||||
-rw-r--r-- | ace/Future.cpp | 7 | ||||
-rw-r--r-- | ace/Local_Tokens.i | 48 | ||||
-rw-r--r-- | ace/MEM_SAP.i | 14 | ||||
-rw-r--r-- | ace/Map_T.i | 144 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 46 | ||||
-rw-r--r-- | ace/OS_Errno.cpp | 3 | ||||
-rw-r--r-- | ace/Object_Manager.cpp | 5 | ||||
-rw-r--r-- | ace/Obstack_T.cpp | 20 | ||||
-rw-r--r-- | ace/Refcounted_Auto_Ptr.i | 6 | ||||
-rw-r--r-- | ace/Remote_Tokens.i | 48 | ||||
-rw-r--r-- | ace/Strategies_T.cpp | 13 | ||||
-rw-r--r-- | ace/Stream.cpp | 52 | ||||
-rw-r--r-- | ace/Svc_Handler.cpp | 6 | ||||
-rw-r--r-- | ace/Synch_T.cpp | 6 | ||||
-rw-r--r-- | ace/TLI.cpp | 3 | ||||
-rw-r--r-- | ace/Timer_Hash_T.cpp | 9 | ||||
-rw-r--r-- | ace/Timer_Queue_T.cpp | 16 | ||||
-rw-r--r-- | ace/Unbounded_Queue.cpp | 13 | ||||
-rw-r--r-- | ace/Unbounded_Set.cpp | 3 |
29 files changed, 510 insertions, 144 deletions
diff --git a/ChangeLog b/ChangeLog index a44c53ab038..039e3762150 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +Sun Oct 28 13:15:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> + + * ace/ACE.i + * ace/ATM_Stream.cpp + * ace/Activation_Queue.cpp + * ace/Bound_Ptr.i + * ace/Configuration.cpp + * ace/Configuration_Import_Export.cpp + * ace/Containers_T.cpp + * ace/Future.cpp + * ace/Handle_Gobbler.h + * ace/Local_Tokens.i + * ace/MEM_SAP.i + * ace/Map_T.i + * ace/Message_Block.cpp + * ace/OS_Errno.cpp + * ace/Object_Manager.cpp + * ace/Obstack_T.cpp + * ace/Refcounted_Auto_Ptr.i + * ace/Remote_Tokens.i + * ace/Strategies_T.cpp + * ace/Stream.cpp + * ace/Svc_Handler.cpp + * ace/Synch_T.cpp + * ace/TLI.cpp + * ace/Timer_Hash_T.cpp + * ace/Timer_Queue_T.cpp + * ace/Unbounded_Queue.cpp + * ace/Unbounded_Set.cpp + + Changed almost all direct usages of operator new in ACE to use + ACE_NEW_RETURN (Exceptions is Dump_T.h). + In one case in Stream.cpp the semantics changed slightly if + operator new would have been overloaded, see the "@@ Michael" + comment. + + When new got used with placement most of the usages + got replaced with ACE_NEW_MALLOC_RETURN. In some cases as in + Malloc_T.cpp, Map_Manager.cpp, PI_Malloc.i, Array_Base.cpp special + cases exist, where the macros would have incurred different semantics + and performance penalties. + Fri Oct 26 07:37:43 2001 Balachandran Natarajan <bala@cs.wustl.edu> * bin/auto_run_tests.lst: Quoter example will not run in diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index a44c53ab038..039e3762150 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,45 @@ +Sun Oct 28 13:15:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> + + * ace/ACE.i + * ace/ATM_Stream.cpp + * ace/Activation_Queue.cpp + * ace/Bound_Ptr.i + * ace/Configuration.cpp + * ace/Configuration_Import_Export.cpp + * ace/Containers_T.cpp + * ace/Future.cpp + * ace/Handle_Gobbler.h + * ace/Local_Tokens.i + * ace/MEM_SAP.i + * ace/Map_T.i + * ace/Message_Block.cpp + * ace/OS_Errno.cpp + * ace/Object_Manager.cpp + * ace/Obstack_T.cpp + * ace/Refcounted_Auto_Ptr.i + * ace/Remote_Tokens.i + * ace/Strategies_T.cpp + * ace/Stream.cpp + * ace/Svc_Handler.cpp + * ace/Synch_T.cpp + * ace/TLI.cpp + * ace/Timer_Hash_T.cpp + * ace/Timer_Queue_T.cpp + * ace/Unbounded_Queue.cpp + * ace/Unbounded_Set.cpp + + Changed almost all direct usages of operator new in ACE to use + ACE_NEW_RETURN (Exceptions is Dump_T.h). + In one case in Stream.cpp the semantics changed slightly if + operator new would have been overloaded, see the "@@ Michael" + comment. + + When new got used with placement most of the usages + got replaced with ACE_NEW_MALLOC_RETURN. In some cases as in + Malloc_T.cpp, Map_Manager.cpp, PI_Malloc.i, Array_Base.cpp special + cases exist, where the macros would have incurred different semantics + and performance penalties. + Fri Oct 26 07:37:43 2001 Balachandran Natarajan <bala@cs.wustl.edu> * bin/auto_run_tests.lst: Quoter example will not run in diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index a44c53ab038..039e3762150 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,45 @@ +Sun Oct 28 13:15:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> + + * ace/ACE.i + * ace/ATM_Stream.cpp + * ace/Activation_Queue.cpp + * ace/Bound_Ptr.i + * ace/Configuration.cpp + * ace/Configuration_Import_Export.cpp + * ace/Containers_T.cpp + * ace/Future.cpp + * ace/Handle_Gobbler.h + * ace/Local_Tokens.i + * ace/MEM_SAP.i + * ace/Map_T.i + * ace/Message_Block.cpp + * ace/OS_Errno.cpp + * ace/Object_Manager.cpp + * ace/Obstack_T.cpp + * ace/Refcounted_Auto_Ptr.i + * ace/Remote_Tokens.i + * ace/Strategies_T.cpp + * ace/Stream.cpp + * ace/Svc_Handler.cpp + * ace/Synch_T.cpp + * ace/TLI.cpp + * ace/Timer_Hash_T.cpp + * ace/Timer_Queue_T.cpp + * ace/Unbounded_Queue.cpp + * ace/Unbounded_Set.cpp + + Changed almost all direct usages of operator new in ACE to use + ACE_NEW_RETURN (Exceptions is Dump_T.h). + In one case in Stream.cpp the semantics changed slightly if + operator new would have been overloaded, see the "@@ Michael" + comment. + + When new got used with placement most of the usages + got replaced with ACE_NEW_MALLOC_RETURN. In some cases as in + Malloc_T.cpp, Map_Manager.cpp, PI_Malloc.i, Array_Base.cpp special + cases exist, where the macros would have incurred different semantics + and performance penalties. + Fri Oct 26 07:37:43 2001 Balachandran Natarajan <bala@cs.wustl.edu> * bin/auto_run_tests.lst: Quoter example will not run in diff --git a/ace/ACE.i b/ace/ACE.i index d58ab35463c..889bdab9701 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -314,7 +314,10 @@ ACE::debug (char c) ASYS_INLINE char * ACE::strnew (const char *s) { - char *t = new char [::strlen(s) + 1]; + char *t = 0; + ACE_NEW_RETURN (t, + char [::strlen(s) + 1], + 0); if (t == 0) return 0; else @@ -325,7 +328,10 @@ ACE::strnew (const char *s) ASYS_INLINE wchar_t * ACE::strnew (const wchar_t *s) { - wchar_t *t = new wchar_t[ACE_OS_String::strlen (s) + 1]; + wchar_t *t = 0; + ACE_NEW_RETURN (t, + wchar_t[ACE_OS_String::strlen (s) + 1], + 0); if (t == 0) return 0; else diff --git a/ace/ATM_Stream.cpp b/ace/ATM_Stream.cpp index 6ab6fc84261..f0778eb6f5d 100644 --- a/ace/ATM_Stream.cpp +++ b/ace/ATM_Stream.cpp @@ -90,7 +90,8 @@ ACE_ATM_Stream::get_peer_name (void) const // Find the host address in the ATM hosts file and return the // host name char line[256]; - char *host_ptr, *host_name = new char[256]; + char *host_ptr, *host_name = 0; + ACE_NEW_RETURN (host_name, char[256], 0); while (!atm_hosts.eof()) { atm_hosts.getline(line, 256); // Convert the line to lower case to ease comparison diff --git a/ace/Activation_Queue.cpp b/ace/Activation_Queue.cpp index f326db53f01..d0ebe4a133e 100644 --- a/ace/Activation_Queue.cpp +++ b/ace/Activation_Queue.cpp @@ -81,7 +81,8 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, // correctly. Since we also pass <mr> note that no unnecessary // memory is actually allocated -- just the size field is set. ACE_NEW_MALLOC_RETURN (mb, - (ACE_Message_Block *) this->allocator_->malloc (sizeof (ACE_Message_Block)), + ACE_static_cast(ACE_Message_Block *, + this->allocator_->malloc (sizeof (ACE_Message_Block))), ACE_Message_Block (sizeof (*mr), // size ACE_Message_Block::MB_DATA, // type 0, // cont diff --git a/ace/Bound_Ptr.i b/ace/Bound_Ptr.i index d8d95433aa3..8bacc270309 100644 --- a/ace/Bound_Ptr.i +++ b/ace/Bound_Ptr.i @@ -9,7 +9,12 @@ template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> * ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void) { // Set initial object reference count to 1. - return new ACE_Bound_Ptr_Counter<ACE_LOCK> (1); + + ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Bound_Ptr_Counter<ACE_LOCK> (1), + 0); + return temp; } template <class ACE_LOCK> inline int @@ -60,7 +65,12 @@ template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> * ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void) { // Set initial object reference count to 0. - return new ACE_Bound_Ptr_Counter<ACE_LOCK> (); + + ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Bound_Ptr_Counter<ACE_LOCK> (), + 0); + return temp; } template <class ACE_LOCK> inline void diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp index 5b183c46294..a3dace6b260 100644 --- a/ace/Configuration.cpp +++ b/ace/Configuration.cpp @@ -762,7 +762,12 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti if (type != REG_SZ) return -3; - ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> buffer (new ACE_TCHAR[buffer_length]); + ACE_TCHAR *temp = 0; + ACE_NEW_RETURN (temp, + ACE_TCHAR[buffer_length], + 0); + + ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> buffer (temp); if (ACE_TEXT_RegQueryValueEx (base_key, name, @@ -935,7 +940,11 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey, return 0; // recurse through the path - ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> pData (new ACE_TCHAR[ACE_OS::strlen (path) + 1]); + ACE_TCHAR *temp_path = 0; + ACE_NEW_RETURN (temp_path, + ACE_TCHAR[ACE_OS::strlen (path) + 1], + 0); + ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> pData (temp_path); ACE_OS::strcpy (pData.get (), path); ACE_Tokenizer parser (pData.get ()); parser.delimiter_replace ('\\', '\0'); diff --git a/ace/Configuration_Import_Export.cpp b/ace/Configuration_Import_Export.cpp index 22dce5dc60f..ddbd41614de 100644 --- a/ace/Configuration_Import_Export.cpp +++ b/ace/Configuration_Import_Export.cpp @@ -102,7 +102,10 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) // divide by 3 to get the actual buffer length u_int length = string_length / 3; u_int remaining = length; - u_char* data = new u_char[length]; + u_char* data = 0; + ACE_NEW_RETURN (data, + u_char[length], + -1); u_char* out = data; ACE_TCHAR* inb = end + 4; ACE_TCHAR* endptr = 0; diff --git a/ace/Containers_T.cpp b/ace/Containers_T.cpp index d87c3ad04d5..7f6d0683368 100644 --- a/ace/Containers_T.cpp +++ b/ace/Containers_T.cpp @@ -243,7 +243,8 @@ ACE_Unbounded_Stack<T>::push (const T &new_item) ACE_Node<T> *temp; ACE_NEW_MALLOC_RETURN (temp, - (ACE_Node<T> *) this->allocator_->malloc (sizeof (ACE_Node<T>)), + ACE_static_cast(ACE_Node<T> *, + this->allocator_->malloc (sizeof (ACE_Node<T>))), ACE_Node<T> (new_item, this->head_->next_), -1); this->head_->next_ = temp; @@ -838,8 +839,10 @@ ACE_Double_Linked_List<T>::copy_nodes (const ACE_Double_Linked_List<T> &c) !iter.done (); iter.advance ()) { - T* temp = (T *) this->allocator_->malloc (sizeof (T)); - new (temp) T (*iter.next ()); + T* temp = 0; + ACE_NEW_MALLOC (temp, + (T *)this->allocator_->malloc (sizeof (T)), + T (*iter.next ())); this->insert_tail (temp); } } @@ -1554,7 +1557,8 @@ ACE_Ordered_MultiSet<T>::insert_from (const T &item, ACE_DNode<T> *position, // create a new node ACE_DNode<T> *temp; ACE_NEW_MALLOC_RETURN (temp, - (ACE_DNode<T>*) this->allocator_->malloc (sizeof (ACE_DNode<T>)), + ACE_static_cast(ACE_DNode<T>*, + this->allocator_->malloc (sizeof (ACE_DNode<T>))), ACE_DNode<T> (item), -1); // obtain approximate location of the node @@ -1741,7 +1745,8 @@ ACE_DLList<T>::insert_tail (T *new_item) { ACE_DLList_Node *temp1, *temp2; ACE_NEW_MALLOC_RETURN (temp1, - (ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)), + ACE_static_cast(ACE_DLList_Node *, + this->allocator_->malloc (sizeof (ACE_DLList_Node))), ACE_DLList_Node ((void *&)new_item), 0); temp2 = ACE_DLList_Base::insert_tail (temp1); @@ -1752,8 +1757,7 @@ template <class T> T * ACE_DLList<T>::insert_head (T *new_item) { ACE_DLList_Node *temp1; - ACE_NEW_MALLOC_RETURN ( - temp1, + ACE_NEW_MALLOC_RETURN (temp1, (ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)), ACE_DLList_Node ((void *&)new_item), 0); ACE_DLList_Node *temp2 = diff --git a/ace/Future.cpp b/ace/Future.cpp index 54592d09c07..c132ba240d3 100644 --- a/ace/Future.cpp +++ b/ace/Future.cpp @@ -65,7 +65,12 @@ template <class T> ACE_Future_Rep<T> * ACE_Future_Rep<T>::create (void) { // Yes set ref count to zero. - return new ACE_Future_Rep<T> (); + + ACE_Future_Rep<T> *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Future_Rep<T> (), + 0); + return temp; } template <class T> ACE_Future_Rep<T> * diff --git a/ace/Local_Tokens.i b/ace/Local_Tokens.i index 6f9fe43fa30..d5c451cff91 100644 --- a/ace/Local_Tokens.i +++ b/ace/Local_Tokens.i @@ -321,15 +321,23 @@ ACE_Token_Name::name (void) const ACE_INLINE ACE_Token_Proxy * ACE_Local_Mutex::clone (void) const { - return new ACE_Local_Mutex (token_->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Local_Mutex (token_->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } ACE_INLINE ACE_Tokens * ACE_Local_Mutex::create_token (const ACE_TCHAR *name) { - return new ACE_Mutex_Token (name); + ACE_Tokens *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Mutex_Token (name), + 0); + return temp; } ACE_INLINE @@ -356,7 +364,11 @@ ACE_Local_RLock::~ACE_Local_RLock (void) ACE_INLINE ACE_Tokens * ACE_Local_RLock::create_token (const ACE_TCHAR *name) { - return new ACE_RW_Token (name); + ACE_Tokens *temp = 0; + ACE_NEW_RETURN (temp, + ACE_RW_Token (name), + 0); + return temp; } ACE_INLINE int @@ -368,9 +380,13 @@ ACE_Local_RLock::type (void) const ACE_INLINE ACE_Token_Proxy * ACE_Local_RLock::clone (void) const { - return new ACE_Local_RLock (token_->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Local_RLock (token_->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } // ************************************************************ @@ -392,7 +408,11 @@ ACE_Local_WLock::~ACE_Local_WLock (void) ACE_INLINE ACE_Tokens * ACE_Local_WLock::create_token (const ACE_TCHAR *name) { - return new ACE_RW_Token (name); + ACE_Tokens *temp = 0; + ACE_NEW_RETURN (temp, + ACE_RW_Token (name), + 0); + return temp; } ACE_INLINE int @@ -404,9 +424,13 @@ ACE_Local_WLock::type (void) const ACE_INLINE ACE_Token_Proxy * ACE_Local_WLock::clone (void) const { - return new ACE_Local_WLock (token_->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Local_WLock (token_->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } // ************************************************************ diff --git a/ace/MEM_SAP.i b/ace/MEM_SAP.i index d1acbf79ce4..b6a800df06b 100644 --- a/ace/MEM_SAP.i +++ b/ace/MEM_SAP.i @@ -45,14 +45,14 @@ ACE_MEM_SAP::acquire_buffer (const ssize_t size) if (this->shm_malloc_ == 0) return 0; // not initialized. - ACE_MEM_SAP_Node *buf = - ACE_reinterpret_cast (ACE_MEM_SAP_Node *, - this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) - + size)); - if (buf != 0) - return new (buf) ACE_MEM_SAP_Node (size); + ACE_MEM_SAP_Node *buf = 0; - return 0; + ACE_NEW_MALLOC_RETURN (buf, + ACE_static_cast (ACE_MEM_SAP_Node *, + this->shm_malloc_->malloc (sizeof (ACE_MEM_SAP_Node) + size)), + ACE_MEM_SAP_Node (size), + 0); + return buf; } ASYS_INLINE int diff --git a/ace/Map_T.i b/ace/Map_T.i index 602fa5220ab..9705c733e92 100644 --- a/ace/Map_T.i +++ b/ace/Map_T.i @@ -243,7 +243,11 @@ ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::~ACE_Map_Impl_Iterator_ template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Iterator_Impl<T> * ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::clone (void) const { - return new ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> (*this); + ACE_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Map_Impl_Iterator_Adapter <T, IMPLEMENTATION, ENTRY > (*this)), + 0); + return temp; } @@ -296,7 +300,11 @@ ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::~ACE_Map_Impl_R template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::clone (void) const { - return new ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> (*this); + ACE_Reverse_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> (*this)), + 0); + return temp; } @@ -499,25 +507,41 @@ ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::dum template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::begin_impl (void) { - return new iterator_impl (this->implementation_.begin ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.begin ()), + 0); + return temp; } template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::end_impl (void) { - return new iterator_impl (this->implementation_.end ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.end ()), + 0); + return temp; } template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::rbegin_impl (void) { - return new reverse_iterator_impl (this->implementation_.rbegin ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rbegin ()), + 0); + return temp; } template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY>::rend_impl (void) { - return new reverse_iterator_impl (this->implementation_.rend ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rend ()), + 0); + return temp; } template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY> ACE_INLINE IMPLEMENTATION & @@ -540,7 +564,11 @@ ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::~ACE_Active_Map_Manager_Itera template <class T, class VALUE> ACE_INLINE ACE_Iterator_Impl<T> * ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::clone (void) const { - return new ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE> (*this); + ACE_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>) (*this), + 0); + return temp; } @@ -594,7 +622,11 @@ ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::~ACE_Active_Map_Manag template <class T, class VALUE> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::clone (void) const { - return new ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE> (*this); + ACE_Reverse_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>) (*this), + 0); + return temp; } @@ -959,25 +991,41 @@ ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::dump (void) const template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::begin_impl (void) { - return new iterator_impl (this->implementation_.begin ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.begin ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::end_impl (void) { - return new iterator_impl (this->implementation_.end ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.end ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rbegin_impl (void) { - return new reverse_iterator_impl (this->implementation_.rbegin ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rbegin ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rend_impl (void) { - return new reverse_iterator_impl (this->implementation_.rend ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rend ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > & @@ -1006,7 +1054,11 @@ ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>: template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Iterator_Impl<T> * ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::clone (void) const { - return new ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> (*this); + ACE_INLINE ACE_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>) (*this), + 0); + return temp; } @@ -1060,7 +1112,11 @@ ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPAR template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::clone (void) const { - return new ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> (*this); + ACE_Reverse_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>) (*this), + 0); + return temp; } @@ -1276,25 +1332,41 @@ ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATO template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::begin_impl (void) { - return new iterator_impl (this->implementation_.begin ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.begin ()), + 0); + return temp; } template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::end_impl (void) { - return new iterator_impl (this->implementation_.end ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.end ()), + 0); + return temp; } template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rbegin_impl (void) { - return new reverse_iterator_impl (this->implementation_.rbegin ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rbegin ()), + 0); + return temp; } template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rend_impl (void) { - return new reverse_iterator_impl (this->implementation_.rend ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rend ()), + 0); + return temp; } template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> & @@ -1323,7 +1395,11 @@ ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::~ACE_Map_Manager_Iterator_Adapt template <class T, class KEY, class VALUE> ACE_INLINE ACE_Iterator_Impl<T> * ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::clone (void) const { - return new ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE> (*this); + ACE_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>) (*this), + 0); + return temp; } @@ -1377,7 +1453,11 @@ ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::~ACE_Map_Manager_Revers template <class T, class KEY, class VALUE> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::clone (void) const { - return new ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE> (*this); + ACE_Reverse_Iterator_Impl<T> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>) (*this), + 0); + return temp; } @@ -1593,25 +1673,41 @@ ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::dump (void) const template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::begin_impl (void) { - return new iterator_impl (this->implementation_.begin ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.begin ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::end_impl (void) { - return new iterator_impl (this->implementation_.end ()); + ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + iterator_impl (this->implementation_.end ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rbegin_impl (void) { - return new reverse_iterator_impl (this->implementation_.rbegin ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rbegin ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > * ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rend_impl (void) { - return new reverse_iterator_impl (this->implementation_.rend ()); + ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0; + ACE_NEW_RETURN (temp, + reverse_iterator_impl (this->implementation_.rend ()), + 0); + return temp; } template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> & diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 67f2470fbae..b0b13965ad6 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -648,8 +648,8 @@ ACE_Message_Block::init_i (size_t size, // Allocate the <ACE_Data_Block> portion, which is reference // counted. ACE_NEW_MALLOC_RETURN (db, - ACE_static_cast(ACE_Data_Block*, - data_block_allocator->malloc (sizeof (ACE_Data_Block))), + ACE_static_cast(ACE_Data_Block *, + data_block_allocator->malloc (sizeof (ACE_Data_Block))), ACE_Data_Block (size, msg_type, msg_data, @@ -954,8 +954,8 @@ ACE_Message_Block::duplicate (void) const 0); else // Otherwise, use the message_block_allocator passed in. ACE_NEW_MALLOC_RETURN (nb, - ACE_reinterpret_cast(ACE_Message_Block*, - message_block_allocator_->malloc (sizeof (ACE_Message_Block))), + ACE_static_cast(ACE_Message_Block*, + message_block_allocator_->malloc (sizeof (ACE_Message_Block))), ACE_Message_Block (0, // size ACE_Message_Type (0), // type 0, // cont @@ -1043,7 +1043,7 @@ ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask) const ACE_NEW_MALLOC_RETURN (nb, ACE_static_cast(ACE_Data_Block*, - this->data_block_allocator_->malloc (sizeof (ACE_Data_Block))), + this->data_block_allocator_->malloc (sizeof (ACE_Data_Block))), ACE_Data_Block (this->max_size_, // size this->type_, // type 0, // data @@ -1075,23 +1075,25 @@ ACE_Message_Block::clone (Message_Flags mask) const if(message_block_allocator_ == 0) { - nb = new ACE_Message_Block (0, // size - ACE_Message_Type (0), // type - 0, // cont - 0, // data - 0, // allocator - 0, // locking strategy - 0, // flags - this->priority_, // priority - ACE_EXECUTION_TIME, // execution time - ACE_DEADLINE_TIME, // absolute time to deadline - // Get a pointer to a - // "duplicated" <ACE_Data_Block> - // (will simply increment the - // reference count). - db, - db->data_block_allocator (), - this->message_block_allocator_); + ACE_NEW_RETURN (nb, + ACE_Message_Block (0, // size + ACE_Message_Type (0), // type + 0, // cont + 0, // data + 0, // allocator + 0, // locking strategy + 0, // flags + this->priority_, // priority + ACE_EXECUTION_TIME, // execution time + ACE_DEADLINE_TIME, // absolute time to deadline + // Get a pointer to a + // "duplicated" <ACE_Data_Block> + // (will simply increment the + // reference count). + db, + db->data_block_allocator (), + this->message_block_allocator_), + 0); } else { diff --git a/ace/OS_Errno.cpp b/ace/OS_Errno.cpp index 4d0e6af3287..4ab37ca6edb 100644 --- a/ace/OS_Errno.cpp +++ b/ace/OS_Errno.cpp @@ -17,7 +17,8 @@ DWORD ACE_CE_Errno::errno_key_ = 0xffffffff; void ACE_CE_Errno::init () { - ACE_CE_Errno::instance_ = new ACE_CE_Errno (); + ACE_NEW (ACE_CE_Errno::instance_, + ACE_CE_Errno ()); ACE_CE_Errno::errno_key_ = TlsAlloc (); } diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index ffee1fb7911..8b865c4038d 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -273,11 +273,14 @@ ACE_Object_Manager::ACE_Object_Manager (void) , ace_service_config_sig_handler_ (0) #endif /* ! ACE_LACKS_ACE_SVCCONF */ #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - , internal_lock_ (new ACE_Recursive_Thread_Mutex) , singleton_null_lock_ (0) , singleton_recursive_lock_ (0) # endif /* ACE_MT_SAFE */ { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + ACE_NEW (internal_lock_, ACE_Recursive_Thread_Mutex); +# endif /* ACE_MT_SAFE */ + // If instance_ was not 0, then another ACE_Object_Manager has // already been instantiated (it is likely to be one initialized by way // of library/DLL loading). Let this one go through construction in diff --git a/ace/Obstack_T.cpp b/ace/Obstack_T.cpp index 5bb13b7e44d..cd80fb23c66 100644 --- a/ace/Obstack_T.cpp +++ b/ace/Obstack_T.cpp @@ -95,17 +95,15 @@ ACE_Obstack_T<CHAR>::new_chunk (void) { ACE_TRACE ("ACE_Obstack_T<CHAR>::new_chunk"); - char *temp; - - ACE_ALLOCATOR_RETURN - (temp, - ACE_static_cast (char *, - this->allocator_strategy_->malloc - (sizeof (class ACE_Obchunk) - + this->size_)), - 0); - - return new (temp) ACE_Obchunk (this->size_); + ACE_Obchunk *temp; + + ACE_NEW_MALLOC_RETURN (temp, + ACE_static_cast (ACE_Obchunk *, + this->allocator_strategy_->malloc + (sizeof (class ACE_Obchunk) + this->size_)), + ACE_Obchunk (this->size_), + 0); + return temp; } template <class CHAR> diff --git a/ace/Refcounted_Auto_Ptr.i b/ace/Refcounted_Auto_Ptr.i index 34ff9fcc10f..e927cdd4b66 100644 --- a/ace/Refcounted_Auto_Ptr.i +++ b/ace/Refcounted_Auto_Ptr.i @@ -24,7 +24,11 @@ template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOC ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p) { // Yes set ref count to zero. - return new ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> (p); + ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = 0; + ACE_NEW_RETURN (temp, + (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>) (p), + 0); + return temp; } template <class X, class ACE_LOCK> inline ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> * diff --git a/ace/Remote_Tokens.i b/ace/Remote_Tokens.i index 01fee89af45..f0cc90e5105 100644 --- a/ace/Remote_Tokens.i +++ b/ace/Remote_Tokens.i @@ -21,15 +21,23 @@ ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name, ACE_INLINE ACE_Token_Proxy * ACE_Remote_Mutex::clone (void) const { - return new ACE_Remote_Mutex (this->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp; + ACE_NEW_RETURN (temp, + ACE_Remote_Mutex (this->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } ACE_INLINE ACE_Tokens * ACE_Remote_Mutex::create_token (const ACE_TCHAR *name) { - return new ACE_Mutex_Token (name); + ACE_Tokens *temp; + ACE_NEW_RETURN (temp, + ACE_Mutex_Token (name), + 0); + return temp; } // ************************************************************ @@ -46,7 +54,11 @@ ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name, ACE_INLINE ACE_Tokens * ACE_Remote_RLock::create_token (const ACE_TCHAR *name) { - return new ACE_RW_Token (name); + ACE_Tokens *temp = 0; + ACE_NEW_RETURN (temp, + ACE_RW_Token (name), + 0); + return temp; } ACE_INLINE int @@ -58,9 +70,13 @@ ACE_Remote_RLock::type (void) const ACE_INLINE ACE_Token_Proxy * ACE_Remote_RLock::clone (void) const { - return new ACE_Remote_RLock (this->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Remote_RLock (this->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } // ************************************************************ @@ -78,7 +94,11 @@ ACE_Remote_WLock::ACE_Remote_WLock (const ACE_TCHAR *token_name, ACE_INLINE ACE_Tokens * ACE_Remote_WLock::create_token (const ACE_TCHAR *name) { - return new ACE_RW_Token (name); + ACE_Tokens *temp = 0; + ACE_NEW_RETURN (temp, + ACE_RW_Token (name), + 0); + return temp; } ACE_INLINE int @@ -90,9 +110,13 @@ ACE_Remote_WLock::type (void) const ACE_INLINE ACE_Token_Proxy * ACE_Remote_WLock::clone (void) const { - return new ACE_Remote_WLock (this->name (), - ignore_deadlock_, - debug_); + ACE_Token_Proxy *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Remote_WLock (this->name (), + ignore_deadlock_, + debug_), + 0); + return temp; } #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index 2439c532ea9..70924c3bc31 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -96,11 +96,14 @@ ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) this->svc_name_), -1); - ACE_Service_Type *srp = - new ACE_Service_Type (this->svc_name_, - stp, - handle, - 1); + ACE_Service_Type *srp = 0; + + ACE_NEW_RETURN (srp, + ACE_Service_Type (this->svc_name_, + stp, + handle, + 1), + -1); if (srp == 0) { delete stp; diff --git a/ace/Stream.cpp b/ace/Stream.cpp index 58582200059..f72ebd4acfb 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -327,22 +327,34 @@ ACE_Stream<ACE_SYNCH_USE>::open (void *a, if (head == 0) { - h1 = new ACE_Stream_Head<ACE_SYNCH_USE>; - h2 = new ACE_Stream_Head<ACE_SYNCH_USE>; - head = new ACE_Module<ACE_SYNCH_USE> (ACE_LIB_TEXT ("ACE_Stream_Head"), - h1, h2, - a, - M_DELETE); + ACE_NEW_RETURN (h1, + ACE_Stream_Head<ACE_SYNCH_USE>, + -1); + ACE_NEW_RETURN (h2, + ACE_Stream_Head<ACE_SYNCH_USE>, + -1); + ACE_NEW_RETURN (head, + ACE_Module<ACE_SYNCH_USE> (ACE_LIB_TEXT ("ACE_Stream_Head"), + h1, h2, + a, + M_DELETE), + -1); } if (tail == 0) { - t1 = new ACE_Stream_Tail<ACE_SYNCH_USE>; - t2 = new ACE_Stream_Tail<ACE_SYNCH_USE>; - tail = new ACE_Module<ACE_SYNCH_USE> (ACE_LIB_TEXT ("ACE_Stream_Tail"), - t1, t2, - a, - M_DELETE); + ACE_NEW_RETURN (t1, + ACE_Stream_Tail<ACE_SYNCH_USE>, + -1); + ACE_NEW_RETURN (t2, + ACE_Stream_Tail<ACE_SYNCH_USE>, + -1); + ACE_NEW_RETURN (tail, + ACE_Module<ACE_SYNCH_USE> (ACE_LIB_TEXT ("ACE_Stream_Tail"), + t1, t2, + a, + M_DELETE), + -1); } // Make sure *all* the allocation succeeded! @@ -431,11 +443,17 @@ ACE_Stream<ACE_SYNCH_USE>::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, // Try to create a control block <cb> that contains the control // field and a pointer to the data block <db> in <cb>'s continuation // field. - ACE_Message_Block *cb = - new ACE_Message_Block (sizeof ioc, - ACE_Message_Block::MB_IOCTL, - db, - (char *) &ioc); + ACE_Message_Block *cb = 0; + + ACE_NEW_RETURN (cb, + ACE_Message_Block (sizeof ioc, + ACE_Message_Block::MB_IOCTL, + db, + (char *) &ioc), + -1); + // @@ Michael: The old semantic assumed that cb returns == 0 + // if no memory was available. We will now return immediately + // without release (errno is set to ENOMEM by the macro). // If we can't allocate <cb> then we need to delete db and return // -1. diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index bba9693cca0..0f7dc81d88d 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -59,7 +59,11 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator new (size_t n) // storage, depending on config flags). dynamic_instance->set (); - return ::new char[n]; + char *temp = 0; + ACE_NEW_RETURN (temp, + char[n], + 0); + return temp; } } diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index fed6d3dfd0a..1abcca4a6db 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -300,7 +300,11 @@ ACE_TSS<TYPE>::operator TYPE *(void) const template <class TYPE> TYPE * ACE_TSS<TYPE>::make_TSS_TYPE (void) const { - return new TYPE; + TYPE *temp = 0; + ACE_NEW_RETURN (temp, + TYPE, + 0); + return temp; } template <class TYPE> void diff --git a/ace/TLI.cpp b/ace/TLI.cpp index e2ce3bad46c..66b782621a3 100644 --- a/ace/TLI.cpp +++ b/ace/TLI.cpp @@ -35,7 +35,8 @@ ACE_TLI::ACE_TLI (void) char[this->so_opt_req.opt.maxlen]); this->so_opt_ret.opt.maxlen = sizeof (opthdr) + sizeof (long); - this->so_opt_ret.opt.buf = new char[this->so_opt_ret.opt.maxlen]; + ACE_NEW (this->so_opt_ret.opt.buf, + char[this->so_opt_ret.opt.maxlen]); if (this->so_opt_ret.opt.buf == 0) { diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp index fc52e0ff6f4..97d29a31fd5 100644 --- a/ace/Timer_Hash_T.cpp +++ b/ace/Timer_Hash_T.cpp @@ -206,13 +206,15 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T (size_t tabl ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) : ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> (upcall_functor, freelist), size_ (0), - table_ (new BUCKET *[table_size]), table_size_ (table_size), table_functor_ (this), earliest_position_ (0) { ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); + ACE_NEW (table_, + BUCKET *[table_size])); + this->gettimeofday (ACE_OS::gettimeofday); for (size_t i = 0; @@ -235,13 +237,16 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T (FUNCTOR *up ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) : ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> (upcall_functor, freelist), size_ (0), - table_ (new BUCKET *[ACE_DEFAULT_TIMER_HASH_TABLE_SIZE]), table_size_ (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE), table_functor_ (this), earliest_position_ (0) { ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); + ACE_NEW (table_, + BUCKET *[ACE_DEFAULT_TIMER_HASH_TABLE_SIZE]); + + this->gettimeofday (ACE_OS::gettimeofday); for (size_t i = 0; diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index 326ab9a7f75..166e35c60e6 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -158,14 +158,24 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : free_list_ (freelist == 0 ? new ACE_Locked_Free_List<ACE_Timer_Node_T <TYPE>, ACE_Null_Mutex> : freelist), - gettimeofday_ (ACE_OS::gettimeofday), - upcall_functor_ (upcall_functor == 0 ? new FUNCTOR : upcall_functor), + : gettimeofday_ (ACE_OS::gettimeofday), delete_upcall_functor_ (upcall_functor == 0), delete_free_list_ (freelist == 0), timer_skew_ (0, ACE_TIMER_SKEW) { ACE_TRACE ("ACE_Timer_Queue_T::ACE_Timer_Queue_T"); + + if (!freelist) + ACE_NEW (free_list_, + (ACE_Locked_Free_List<ACE_Timer_Node_T<TYPE>,ACE_Null_Mutex>)); + else + free_list_ = freelist; + + if (!upcall_functor) + ACE_NEW (upcall_functor_, + FUNCTOR); + else + upcall_functor_ = upcall_functor; } template <class TYPE, class FUNCTOR, class ACE_LOCK> diff --git a/ace/Unbounded_Queue.cpp b/ace/Unbounded_Queue.cpp index dd0f81d5079..4413c51f6f9 100644 --- a/ace/Unbounded_Queue.cpp +++ b/ace/Unbounded_Queue.cpp @@ -162,7 +162,8 @@ ACE_Unbounded_Queue<T>::enqueue_head (const T &new_item) // Create a new node that points to the original head. ACE_NEW_MALLOC_RETURN (temp, - (ACE_Node<T> *) this->allocator_->malloc (sizeof (ACE_Node<T>)), + ACE_static_cast(ACE_Node<T> *, + this->allocator_->malloc (sizeof (ACE_Node<T>))), ACE_Node<T> (new_item, this->head_->next_), -1); // Link this pointer into the front of the list. Note that the @@ -179,17 +180,19 @@ ACE_Unbounded_Queue<T>::enqueue_tail (const T &new_item) { // ACE_TRACE ("ACE_Unbounded_Queue<T>::enqueue_tail"); - ACE_Node<T> *temp; - // Insert <item> into the old dummy node location. Note that this // isn't actually the "head" item in the queue, it's a dummy node at // the "tail" of the queue... this->head_->item_ = new_item; + ACE_Node<T> *temp; + // Create a new dummy node. ACE_NEW_MALLOC_RETURN (temp, - (ACE_Node<T> *) this->allocator_->malloc (sizeof (ACE_Node<T>)), - ACE_Node<T> (this->head_->next_), -1); + ACE_static_cast(ACE_Node<T> *, + this->allocator_->malloc (sizeof (ACE_Node<T>))), + ACE_Node<T> (this->head_->next_), + -1); // Link this dummy pointer into the list. this->head_->next_ = temp; diff --git a/ace/Unbounded_Set.cpp b/ace/Unbounded_Set.cpp index a8c5a1d5aed..e1cf0708e6a 100644 --- a/ace/Unbounded_Set.cpp +++ b/ace/Unbounded_Set.cpp @@ -37,7 +37,8 @@ ACE_Unbounded_Set<T>::insert_tail (const T &item) // Create a new dummy node. ACE_NEW_MALLOC_RETURN (temp, - (ACE_Node<T>*) this->allocator_->malloc (sizeof (ACE_Node<T>)), + ACE_static_cast(ACE_Node<T>*, + this->allocator_->malloc (sizeof (ACE_Node<T>))), ACE_Node<T> (this->head_->next_), -1); // Link this pointer into the list. |