libcsdbg  1.28
C++ exception (and generic) stack trace debug library
template<class T>
node< T > * csdbg::stack< T >::node_with ( const T *  d) const
protectedvirtual

Get the node with m_data == d.

Parameters
[in]dthe data pointer searched
Returns
the node with m_data == d or NULL if there's no such node

Definition at line 115 of file stack.hpp.

References __D_ASSERT, likely, and unlikely.

Referenced by csdbg::stack< T >::operator=().

116 {
117  __D_ASSERT(d != NULL);
118  if ( unlikely(d == NULL) )
119  return NULL;
120 
121  for (node<T> *n = m_top; likely(n != NULL); n = n->m_link)
122  if ( unlikely(n->m_data == d) )
123  return n;
124 
125  return NULL;
126 }
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
node< T > * m_top
Stack top.
Definition: stack.hpp:34
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268

+ Here is the caller graph for this function: