aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-03-31 14:08:20 +0200
committerMichael Mann <mmann78@netscape.net>2016-04-01 00:33:09 +0000
commitc119296504b5258f9e44e23b298ea6b6394d6d92 (patch)
tree2b5d552303cf37c7766d1bcf8821e8c75f5c6ff9 /randpkt.c
parentf4bdaf9d15c2b4a8abd6e73389356af2aaa4bf99 (diff)
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 <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'randpkt.c')
-rw-r--r--randpkt.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/randpkt.c b/randpkt.c
index fa6f467..162e692 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -22,6 +22,7 @@
*/
#include <glib.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <wsutil/ws_diag_control.h>
@@ -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");