From c119296504b5258f9e44e23b298ea6b6394d6d92 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Thu, 31 Mar 2016 14:08:20 +0200 Subject: randpkt: restyle the list generation to get rid of the const compiler warning. Change-Id: Id7c62ef18f919ba8a476898bc88c02fd3b6bf5a1 Reviewed-on: https://code.wireshark.org/review/14730 Petri-Dish: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- randpkt.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'randpkt.c') diff --git a/randpkt.c b/randpkt.c index fa6f467eba..162e692e66 100644 --- a/randpkt.c +++ b/randpkt.c @@ -22,6 +22,7 @@ */ #include + #include #include #include @@ -63,10 +64,9 @@ static void usage(gboolean is_error) { FILE *output; - const char** abbrev_list; - const char** longname_list; - unsigned list_num; - unsigned i; + char** abbrev_list; + char** longname_list; + unsigned i = 0; if (!is_error) { output = stdout; @@ -83,12 +83,14 @@ usage(gboolean is_error) fprintf(output, "Types:\n"); /* Get the examples list */ - randpkt_example_list(&abbrev_list, &longname_list, &list_num); - for (i = 0; i < list_num; i++) { + randpkt_example_list(&abbrev_list, &longname_list); + while (abbrev_list[i] && longname_list[i]) { fprintf(output, "\t%-16s%s\n", abbrev_list[i], longname_list[i]); + i++; } - g_free((char**)abbrev_list); - g_free((char**)longname_list); + + g_strfreev(abbrev_list); + g_strfreev(longname_list); fprintf(output, "\nIf type is not specified, a random packet will be chosen\n\n"); -- cgit v1.2.3