va_start and va_end unless you're actually going to use the va_list"
(those bring the va_start and va_end closer to the use point, which
makes it a little more obvious that we're using <stdarg.h> correctly and
makes it a little harder to use it incorrectly).
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32963
f5534014-38df-0310-8fa8-
9805f1628bb7
static void FPRINTF(FILE *fh, const char *format, ...)
{
va_list args;
- va_start(args, format);
+
#ifdef IDL2WRS_DEBUG
+ va_start(args, format);
vfprintf (stderr, format, args);
+ va_end(args);
#endif
- if (fh)
+ if (fh) {
+ va_start(args, format);
vfprintf (fh, format, args);
- va_end(args);
+ va_end(args);
+ }
}
typedef struct _pointer_item_t {
pi = proto_tree_add_text_node(tree, NULL, 0, 0);
- va_start(ap, format);
- if (pi)
+ if (pi) {
+ va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
+ va_end(ap);
+ }
+ va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("\n");
}
if (!PROTO_ITEM_IS_HIDDEN(pi)) {
- va_start(ap, format);
-
/*
* If we don't already have a representation,
* generate the default representation.
curlen = strlen(fi->rep->representation);
if (ITEM_LABEL_LENGTH > curlen) {
+ va_start(ap, format);
g_vsnprintf(fi->rep->representation + curlen,
ITEM_LABEL_LENGTH - (gulong) curlen, format, ap);
+ va_end(ap);
}
- va_end(ap);
}
}
va_list ap;
int end, restart, base;
- va_start(ap, format);
/* Prepare a prefix to be prepended to every output line */
if( lineno>0 ){
sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno);
availablewidth = LINEWIDTH - prefixsize;
/* Generate the error message */
+ va_start(ap, format);
vsprintf(errmsg,format,ap);
va_end(ap);
errmsgsize = (int) strlen(errmsg);
static void dprintf(int lev, const char* fmt, ...) {
va_list ap;
- va_start(ap,fmt);
if (lev <= debug_level) {
+ va_start(ap,fmt);
vfprintf(stderr,fmt,ap);
+ va_end(ap);
fflush(stderr);
}
- va_end(ap);
}