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

Assignment operator.

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

Definition at line 192 of file sttybuf.cpp.

References m_baud, m_devnode, csdbg::streambuf::operator=(), set_baud(), and unlikely.

193 {
194  if ( unlikely(this == &rval) )
195  return *this;
196 
197  /* Copy the buffer and duplicate the stream descriptor */
198  streambuf::operator=(rval);
199 
200  u32 len = strlen(rval.m_devnode);
201  if (len > strlen(m_devnode)) {
202  delete[] m_devnode;
203  m_devnode = NULL;
204  m_devnode = new i8[len + 1];
205  }
206 
207  strcpy(m_devnode, rval.m_devnode);
208  return set_baud(rval.m_baud);
209 }
char i8
8-bit signed integer
Definition: config.hpp:72
virtual streambuf & operator=(const streambuf &)
Assignment operator.
Definition: streambuf.cpp:96
i8 * m_devnode
Device node file (devfs)
Definition: sttybuf.hpp:34
virtual sttybuf & set_baud(u32)
Set the baud rate.
Definition: sttybuf.cpp:169
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: