diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-05-26 02:25:13 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-05-26 02:25:13 +0000 |
commit | 347e7a0052fe0610ec105de34efe935c727fd3ce (patch) | |
tree | 53fd93c58d394cdf6782babb1b96014b926a8509 /epan/proto.c | |
parent | 7da29cfe69d37b0e601d13546fd667739f581dbe (diff) |
More <stdarg.h> cleanup; some are real bugs, some are just "don't do
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).
svn path=/trunk/; revision=32963
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/epan/proto.c b/epan/proto.c index 3864ae994e..81a1a57223 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1080,9 +1080,12 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format, ...) 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"); @@ -3634,8 +3637,6 @@ proto_item_append_text(proto_item *pi, const char *format, ...) } if (!PROTO_ITEM_IS_HIDDEN(pi)) { - va_start(ap, format); - /* * If we don't already have a representation, * generate the default representation. @@ -3647,10 +3648,11 @@ proto_item_append_text(proto_item *pi, const char *format, ...) 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); } } |