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

Assignment operator.

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

Definition at line 105 of file symbol.cpp.

References m_addr, m_name, and unlikely.

Referenced by csdbg::call::operator=().

106 {
107  if ( unlikely(this == &rval) )
108  return *this;
109 
110  m_addr = rval.m_addr;
111 
112  i8 *buf = rval.m_name;
113  if ( unlikely(buf == NULL) ) {
114  delete[] m_name;
115  m_name = NULL;
116  return *this;
117  }
118 
119  u32 len = strlen(buf);
120  if ( unlikely(m_name == NULL || len > strlen(m_name)) ) {
121  delete[] m_name;
122  m_name = NULL;
123  m_name = new i8[len + 1];
124  }
125 
126  strcpy(m_name, buf);
127  return *this;
128 }
char i8
8-bit signed integer
Definition: config.hpp:72
mem_addr_t m_addr
Symbol address.
Definition: symbol.hpp:23
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
i8 * m_name
Symbol name.
Definition: symbol.hpp:25
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349

+ Here is the caller graph for this function: