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

Set the style name.

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

Definition at line 134 of file style.cpp.

References m_name, and unlikely.

Referenced by csdbg::parser::on_lib_load(), and operator=().

135 {
136  if ( unlikely(nm == NULL) )
137  throw exception("invalid argument: nm (=%p)", nm);
138 
139  u32 len = strlen(nm);
140  if (len > strlen(m_name)) {
141  delete[] m_name;
142  m_name = NULL;
143  m_name = new i8[len + 1];
144  }
145 
146  strcpy(m_name, nm);
147  return *this;
148 }
char i8
8-bit signed integer
Definition: config.hpp:72
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
i8 * m_name
Style name.
Definition: style.hpp:26

+ Here is the caller graph for this function: