libcsdbg  1.28
C++ exception (and generic) stack trace debug library
i32 csdbg::util::va_size ( const i8 fmt,
va_list  args 
)
static

Compute the size of a printf-style format string expanded with the values of a variable argument list.

Parameters
[in]fmta printf-style format string
[in]argsa variable argument list (as a va_list variable)
Returns
the computed size (not including the trailing '\0')
Exceptions
csdbg::exception

Definition at line 489 of file util.cpp.

References unlikely.

Referenced by csdbg::string::format(), and va_format().

490 {
491  if ( unlikely(fmt == NULL) ) {
492  va_end(args);
493  throw exception("invalid argument: fmt (=%p)", fmt);
494  }
495 
496  i32 retval = vsnprintf(NULL, 0, fmt, args);
497  va_end(args);
498  if ( unlikely(retval < 0) )
499  throw exception("vsnprintf failed with retval %d", retval);
500 
501  return retval;
502 }
int i32
32-bit signed integer
Definition: config.hpp:82
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349

+ Here is the caller graph for this function: