libcsdbg  1.28
C++ exception (and generic) stack trace debug library
tcpsockbuf & csdbg::tcpsockbuf::operator= ( const tcpsockbuf rval)
virtual

Assignment operator.

Parameters
[in]rvalthe assigned object
Returns
*this
Exceptions
std::bad_alloc
csdbg::exception

Definition at line 138 of file tcpsockbuf.cpp.

References m_address, m_port, csdbg::streambuf::operator=(), and unlikely.

139 {
140  if ( unlikely(this == &rval) )
141  return *this;
142 
143  /* Copy the buffer and duplicate the stream descriptor */
144  streambuf::operator=(rval);
145 
146  u32 len = strlen(rval.m_address);
147  if (len > strlen(m_address)) {
148  delete[] m_address;
149  m_address = NULL;
150  m_address = new i8[len + 1];
151  }
152 
153  strcpy(m_address, rval.m_address);
154  m_port = rval.m_port;
155  return *this;
156 }
char i8
8-bit signed integer
Definition: config.hpp:72
i8 * m_address
Peer IP address (numerical, IPv4)
Definition: tcpsockbuf.hpp:40
i32 m_port
Peer TCP port.
Definition: tcpsockbuf.hpp:42
virtual streambuf & operator=(const streambuf &)
Assignment operator.
Definition: streambuf.cpp:96
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349

+ Here is the call graph for this function: