diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-03-31 14:08:20 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-04-01 00:33:09 +0000 |
commit | c119296504b5258f9e44e23b298ea6b6394d6d92 (patch) | |
tree | 2b5d552303cf37c7766d1bcf8821e8c75f5c6ff9 /randpkt_core | |
parent | f4bdaf9d15c2b4a8abd6e73389356af2aaa4bf99 (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_core')
-rw-r--r-- | randpkt_core/randpkt_core.c | 15 | ||||
-rw-r--r-- | randpkt_core/randpkt_core.h | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c index 21739b082a..85759afb52 100644 --- a/randpkt_core/randpkt_core.c +++ b/randpkt_core/randpkt_core.c @@ -779,15 +779,16 @@ int randpkt_parse_type(char *string) return -1; } -void randpkt_example_list(const char*** abbrev_list, const char*** longname_list, unsigned* list_num) +void randpkt_example_list(char*** abbrev_list, char*** longname_list) { unsigned i; - *list_num = randpkt_example_count(); - *abbrev_list = g_new0(const char*, *list_num); - *longname_list = g_new0(const char*, *list_num); - for (i = 0; i < *list_num; i++) { - (*abbrev_list)[i] = examples[i].abbrev; - (*longname_list)[i] = examples[i].longname; + unsigned list_num; + list_num = randpkt_example_count(); + *abbrev_list = g_new0(char*, list_num + 1); + *longname_list = g_new0(char*, list_num + 1); + for (i = 0; i < list_num; i++) { + (*abbrev_list)[i] = g_strdup(examples[i].abbrev); + (*longname_list)[i] = g_strdup(examples[i].longname); } } diff --git a/randpkt_core/randpkt_core.h b/randpkt_core/randpkt_core.h index f7633fc048..b45554f5c1 100644 --- a/randpkt_core/randpkt_core.h +++ b/randpkt_core/randpkt_core.h @@ -48,7 +48,7 @@ typedef struct { guint randpkt_example_count(void); /* Return the list of the active examples */ -void randpkt_example_list(const char*** abbrev_list, const char*** longname_list, unsigned* list_num); +void randpkt_example_list(char*** abbrev_list, char*** longname_list); /* Seed the random-number generator */ void randpkt_seed(void); |