diff options
-rw-r--r-- | ChangeLog-97a | 26 | ||||
-rw-r--r-- | ace/Containers.cpp | 60 | ||||
-rw-r--r-- | ace/Containers.h | 3 | ||||
-rw-r--r-- | tests/Conn_Test.cpp | 54 | ||||
-rw-r--r-- | tests/Conn_Test.h | 40 | ||||
-rw-r--r-- | tests/TSS_Test_Errno.h | 18 |
6 files changed, 113 insertions, 88 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index b1f0785e9e2..2e4b6424b2e 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,9 +1,3 @@ -Tue May 06 11:31:49 1997 David L. Levine <levine@cs.wustl.edu> - - * ace/OS.cpp (mktime): added time_t cast of -1 (error) return to avoid compiler warning. - - * ace/config-vxworks-ghs-1.8.h: added ACE_LACKS_SIGNED_CHAR. - Tue May 6 07:39:25 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> * examples/IPC_SAP/SOCK_SAP/CPP-inserver-poll.cpp (main): @@ -15,7 +9,25 @@ Tue May 6 07:39:25 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> a1 == a2 to a1 != a2 since this appears to be what is needed. We need to improve the comments here! -Tue May 06 07:43:29 1997 David L. Levine <levine@cs.wustl.edu> + * tests/Conn_Test.cpp: Split the definition of the Svc_Handler + template into its own Conn_Test.h file to work around "features" + with AIX C++. Thanks to Chris Lahey for reporting this. + + * ace/Containers.cpp: Fixed a bug in the set() method for + ACE_Unbounded_Queue. Again, thank goodness for cs242! + + * ace/Containers.cpp: Fixed a bug in the enqueue_head() logic for + ACE_Unbounded_Queue. Thank goodness for cs242 ;-). + + * ace/Containers.cpp: Added a destructor for ACE_Node to keep the + compilers happy. + +Tue May 06 11:31:49 1997 David L. Levine <levine@cs.wustl.edu> + + * ace/OS.cpp (mktime): added time_t cast of -1 (error) return + to avoid compiler warning. + + * ace/config-vxworks-ghs-1.8.h: added ACE_LACKS_SIGNED_CHAR. * ace/Containers.cpp (dequeue_head): fixed typos in variable names. diff --git a/ace/Containers.cpp b/ace/Containers.cpp index b8dce3c7546..005138df79e 100644 --- a/ace/Containers.cpp +++ b/ace/Containers.cpp @@ -347,7 +347,7 @@ ACE_Unbounded_Queue<T>::enqueue_head (const T &new_item) ACE_Node<T> *temp; // Create a new node that points to the original head. - ACE_NEW_RETURN (temp, ACE_Node<T> (new_item, this->head_->next_->next_), -1); + ACE_NEW_RETURN (temp, ACE_Node<T> (new_item, this->head_->next_), -1); // Link this pointer into the front of the list. this->head_->next_ = temp; @@ -439,28 +439,43 @@ ACE_Unbounded_Queue<T>::set (const T &item, ACE_Node<T> *curr = this->head_->next_; - int result = 1; size_t i; - for (i = 0; i <= index; i++) - { - if (i == this->cur_size_) - { - // We need to expand the list. + for (i = 0; + i < index && i < this->cur_size_; + i++) + curr = curr->next_; - result = 0; + if (i < this->cur_size_) + { + // We're in range, so everything's cool. + curr->item_ = item; + return 1; + } + else + { + // We need to expand the list. - // A common case will be increasing the set size by 1. - // Therefore, we'll optimize for this case. - if (i + i == index) - // Try to expand the size of the set by 1. - return this->enqueue_tail (item); + // A common case will be increasing the set size by 1. + // Therefore, we'll optimize for this case. + if (i == index) + { + // Try to expand the size of the set by 1. + if (this->enqueue_tail (item) == -1) + return -1; else - { - T dummy; + return 0; + } + else + { + T dummy; + // We need to expand the list by multiple (dummy) items. + for (; i < index; i++) + { // This head points to the existing dummy node, which is - // about to be overwritten when we add the new dummy node. + // about to be overwritten when we add the new dummy + // node. curr = this->head_; // Try to expand the size of the set by 1, but don't @@ -468,13 +483,11 @@ ACE_Unbounded_Queue<T>::set (const T &item, if (this->enqueue_tail (dummy) == -1) return -1; } + + curr->item_ = item; + return 0; } - else - curr = curr->next_; } - - curr->item_ = item; - return result; } template <class T> void @@ -936,6 +949,11 @@ ACE_Bounded_Set_Iterator<T>::next (T *&item) ACE_ALLOC_HOOK_DEFINE(ACE_Node) template <class T> +ACE_Node<T>::~ACE_Node (void) +{ +} + +template <class T> ACE_Node<T>::ACE_Node (const T &i, ACE_Node<T> *n) : next_ (n), item_ (i) diff --git a/ace/Containers.h b/ace/Containers.h index a763a016abf..ed5174a6709 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -172,6 +172,9 @@ private: ACE_Node (ACE_Node<T> *n = 0, int MS_SUCKS = 0); ACE_Node (const ACE_Node<T> &n); + ~ACE_Node (void); + // This isn't necessary, but it keeps the compiler happy. + ACE_Node<T> *next_; // Pointer to next element in the list of <ACE_Node>s. diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index 698142338cf..94ab58b02bd 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -21,67 +21,17 @@ // // ============================================================================ -// THE FOLLOWING ARE ONLY FOR DEBUGGING PURPOSES AND SHOULD BE USED -// WITH EXTREME CAUTION!!!! - -#define private public -#define protected public -#include "ace/OS.h" -#include "ace/Thread.h" -#include "ace/Service_Config.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Handle_Set.h" #include "ace/Connector.h" #include "ace/Strategies.h" -#include "ace/Strategies_T.h" -#undef private -#undef protected #include "test_config.h" -#define private public -#define protected public - -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ +#include "Conn_Test.h" // **************************************** -class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> - // = TITLE - // This class is the product created by both <ACE_Connector> - // and <ACE_Acceptor> objects. -{ -public: - Svc_Handler (ACE_Thread_Manager * = 0); - // Do-nothing constructor. - - virtual int open (void *); - // Initialization hook. - - void send_data (void); - // Send data to server. - - void recv_data (void); - // Recv data from client. - - int close (u_long = 0); - // Shutdown the <Svc_Handler>. - - void in_use (int); - // Set the use flag (i.e., 1 means "in use", 0 means "not in use"). - - int in_use (void); - // Returns the current use flag. - -private: - int in_use_; - // Are we currently in use? -}; - Svc_Handler::Svc_Handler (ACE_Thread_Manager *) : in_use_ (0) { @@ -297,6 +247,7 @@ typedef ACE_Hash_Addr<ACE_INET_Addr, Svc_Handler> EXT_ID; typedef Svc_Handler *INT_ID; typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> MAP_ENTRY; +#if 0 static void dump_map (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex> &hashmap) { @@ -338,6 +289,7 @@ dump (STRAT_CONNECTOR &con) dump_map (csp->connection_cache_); } +#endif /* 0 */ // This function runs the more sophisticated tests involving the // Caching_Connect_Strategy. diff --git a/tests/Conn_Test.h b/tests/Conn_Test.h new file mode 100644 index 00000000000..a2ad30a1d30 --- /dev/null +++ b/tests/Conn_Test.h @@ -0,0 +1,40 @@ +#include "ace/Service_Config.h" +#include "ace/Svc_Handler.h" + +class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> + // = TITLE + // This class is the product created by both <ACE_Connector> + // and <ACE_Acceptor> objects. + // + // = DESCRIPTION + // This class gets its own header file to work around AIX C++ + // compiler "features" related to template instantiation... It is + // only used by Conn_Test.cpp. +{ +public: + Svc_Handler (ACE_Thread_Manager * = 0); + // Do-nothing constructor. + + virtual int open (void *); + // Initialization hook. + + void send_data (void); + // Send data to server. + + void recv_data (void); + // Recv data from client. + + int close (u_long = 0); + // Shutdown the <Svc_Handler>. + + void in_use (int); + // Set the use flag (i.e., 1 means "in use", 0 means "not in use"). + + int in_use (void); + // Returns the current use flag. + +private: + int in_use_; + // Are we currently in use? +}; + diff --git a/tests/TSS_Test_Errno.h b/tests/TSS_Test_Errno.h index 09aeec79f4d..c72d7d1855d 100644 --- a/tests/TSS_Test_Errno.h +++ b/tests/TSS_Test_Errno.h @@ -1,13 +1,13 @@ class Errno -// ============================================================================ -// = TITLE -// Define a simple Errno abstraction -// -// = DESCRIPTION -// This class gets its own header file to work around AIX C++ -// compiler "features" related to template instantiation... It is -// only used by TSS_Test.cpp -// ============================================================================ + // ============================================================================ + // = TITLE + // Define a simple Errno abstraction + // + // = DESCRIPTION + // This class gets its own header file to work around AIX C++ + // compiler "features" related to template instantiation... It is + // only used by TSS_Test.cpp. + // ============================================================================ { public: int error (void) { return this->errno_; } |