libcsdbg  1.28
C++ exception (and generic) stack trace debug library
dictionary & csdbg::dictionary::set_name ( const i8 nm)
virtual

Set the name.

Parameters
[in]nmthe new name
Returns
*this
Exceptions
std::bad_alloc
csdbg::exception

Definition at line 123 of file dictionary.cpp.

References m_name, and unlikely.

Referenced by operator=().

124 {
125  if ( unlikely(nm == NULL) )
126  throw exception("invalid argument: nm (=%p)", nm);
127 
128  u32 len = strlen(nm);
129  if (len > strlen(m_name)) {
130  delete[] m_name;
131  m_name = NULL;
132  m_name = new i8[len + 1];
133  }
134 
135  strcpy(m_name, nm);
136  return *this;
137 }
char i8
8-bit signed integer
Definition: config.hpp:72
i8 * m_name
Dictionary name.
Definition: dictionary.hpp:38
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 caller graph for this function: