diff options
author | Michael Mann <mmann78@netscape.net> | 2016-07-24 08:53:39 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-25 04:26:50 +0000 |
commit | 1da1f945e2988080add4923dc2021753e3b2f7c1 (patch) | |
tree | 2839b66064e34ba99a6d031778330f20497b5e93 /epan/dfilter | |
parent | ee7f9c33f63532bc69899a0750177756be53c0c1 (diff) | |
download | wireshark-1da1f945e2988080add4923dc2021753e3b2f7c1.tar.gz |
Fix checkAPI.pl warnings about printf
Many of the complaints from checkAPI.pl for use of printf are when its embedded
in an #ifdef and checkAPI isn't smart enough to figure that out.
The other (non-ifdef) use is dumping internal structures (which is a type of
debug functionality)
Add a "ws_debug_printf" macro for printf to pacify the warnings.
Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd
Reviewed-on: https://code.wireshark.org/review/16623
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dfilter')
-rw-r--r-- | epan/dfilter/dfilter-macro.c | 61 | ||||
-rw-r--r-- | epan/dfilter/dfilter.c | 8 | ||||
-rw-r--r-- | epan/dfilter/gencode.c | 2 | ||||
-rw-r--r-- | epan/dfilter/semcheck.c | 8 |
4 files changed, 43 insertions, 36 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c index 74c90e0f04..18f7b968f7 100644 --- a/epan/dfilter/dfilter-macro.c +++ b/epan/dfilter/dfilter-macro.c @@ -24,6 +24,7 @@ #ifdef DUMP_DFILTER_MACRO #include <stdio.h> +#include <wsutil/ws_printf.h> /* ws_debug_printf */ #endif #include <string.h> @@ -620,69 +621,69 @@ void dfilter_macro_get_uat(uat_t **dfmu_ptr_ptr) { void dump_dfilter_macro_t(const dfilter_macro_t *m, const char *function, const char *file, int line) { - printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); + ws_debug_printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); if(m == NULL) { - printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line); - printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); + ws_debug_printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line); + ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); } - printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line); + ws_debug_printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line); - printf(" &dfilter_macro->name == %p\n", &m->name); + ws_debug_printf(" &dfilter_macro->name == %p\n", &m->name); if(m->name == NULL) { - printf(" ->name == NULL\n"); + ws_debug_printf(" ->name == NULL\n"); } else { - printf(" ->name == %p\n", m->name); - printf(" ->name == <%s>\n", m->name); + ws_debug_printf(" ->name == %p\n", m->name); + ws_debug_printf(" ->name == <%s>\n", m->name); } - printf(" &dfilter_macro->text == %p\n", &m->text); + ws_debug_printf(" &dfilter_macro->text == %p\n", &m->text); if(m->text == NULL) { - printf(" ->text == NULL\n"); + ws_debug_printf(" ->text == NULL\n"); } else { - printf(" ->text == %p\n", m->text); - printf(" ->text == <%s>\n", m->text); + ws_debug_printf(" ->text == %p\n", m->text); + ws_debug_printf(" ->text == <%s>\n", m->text); } - printf(" &dfilter_macro->usable == %p\n", &m->usable); - printf(" ->usable == %u\n", m->usable); + ws_debug_printf(" &dfilter_macro->usable == %p\n", &m->usable); + ws_debug_printf(" ->usable == %u\n", m->usable); - printf(" &dfilter_macro->parts == %p\n", &m->parts); + ws_debug_printf(" &dfilter_macro->parts == %p\n", &m->parts); if(m->parts == NULL) { - printf(" ->parts == NULL\n"); + ws_debug_printf(" ->parts == NULL\n"); } else { int i = 0; while (m->parts[i]) { - printf(" ->parts[%d] == %p\n", i, m->parts[i]); - printf(" ->parts[%d] == <%s>\n", i, m->parts[i]); + ws_debug_printf(" ->parts[%d] == %p\n", i, m->parts[i]); + ws_debug_printf(" ->parts[%d] == <%s>\n", i, m->parts[i]); i++; } - printf(" ->parts[%d] == NULL\n", i); + ws_debug_printf(" ->parts[%d] == NULL\n", i); } - printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos); + ws_debug_printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos); if(m->args_pos == NULL) { - printf(" ->args_pos == NULL\n"); + ws_debug_printf(" ->args_pos == NULL\n"); } else { - printf(" ->args_pos == %p\n", m->args_pos); - /*printf(" ->args_pos == <%?>\n", m->args_pos);*/ + ws_debug_printf(" ->args_pos == %p\n", m->args_pos); + /*ws_debug_printf(" ->args_pos == <%?>\n", m->args_pos);*/ } - printf(" &dfilter_macro->argc == %p\n", &m->argc); - printf(" ->argc == %d\n", m->argc); + ws_debug_printf(" &dfilter_macro->argc == %p\n", &m->argc); + ws_debug_printf(" ->argc == %d\n", m->argc); - printf(" &dfilter_macro->priv == %p\n", &m->priv); + ws_debug_printf(" &dfilter_macro->priv == %p\n", &m->priv); if(m->priv == NULL) { - printf(" ->priv == NULL\n"); + ws_debug_printf(" ->priv == NULL\n"); } else { - printf(" ->priv == %p\n", m->priv); - printf(" ->priv == <%s>\n", (char *)m->priv); + ws_debug_printf(" ->priv == %p\n", m->priv); + ws_debug_printf(" ->priv == <%s>\n", (char *)m->priv); } - printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); + ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); } #endif diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c index 151bb5ec7d..3e1d558828 100644 --- a/epan/dfilter/dfilter.c +++ b/epan/dfilter/dfilter.c @@ -32,6 +32,8 @@ #include "dfilter.h" #include "dfilter-macro.h" #include "scanner_lex.h" +#include <wsutil/ws_printf.h> /* ws_debug_printf */ + #define DFILTER_TOKEN_ID_OFFSET 1 @@ -447,12 +449,12 @@ dfilter_dump(dfilter_t *df) dfvm_dump(stdout, df); if (df->deprecated && df->deprecated->len) { - printf("\nDeprecated tokens: "); + ws_debug_printf("\nDeprecated tokens: "); for (i = 0; i < df->deprecated->len; i++) { - printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i)); + ws_debug_printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i)); sep = ", "; } - printf("\n"); + ws_debug_printf("\n"); } } diff --git a/epan/dfilter/gencode.c b/epan/dfilter/gencode.c index 573b05aa85..f5d1223ae7 100644 --- a/epan/dfilter/gencode.c +++ b/epan/dfilter/gencode.c @@ -385,7 +385,7 @@ gen_entity(dfwork_t *dfw, stnode_t *st_arg, dfvm_value_t **p_jmp) reg = dfw_append_function(dfw, st_arg, p_jmp); } else { - printf("sttype_id is %u\n", (unsigned)e_type); + /* printf("sttype_id is %u\n", (unsigned)e_type); */ g_assert_not_reached(); } return reg; diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index b1fb17bec3..de7057451f 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -33,6 +33,10 @@ #include <epan/exceptions.h> #include <epan/packet.h> +#ifdef DEBUG_dfilter +#include <wsutil/ws_printf.h> /* ws_debug_printf */ +#endif + #include <ftypes/ftypes-int.h> /* Enable debug logging by defining AM_CFLAGS @@ -41,8 +45,8 @@ #ifdef DEBUG_dfilter #define DebugLog(x) \ - printf("%s:%u: ", __FILE__, __LINE__); \ - printf x; \ + ws_debug_printf("%s:%u: ", __FILE__, __LINE__); \ + ws_debug_printf x; \ fflush(stdout) #else #define DebugLog(x) ; |