X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Foption.c;h=c5046ef861a2100dd10d115373e0cec20ea58efa;hb=6601bf27d85f3a9bad9926432f2044363f420b9d;hp=4a42f747531fb54158504b1d9a0fc1f8625b5b3e;hpb=1cab092869b7303fa4390119160d4457bc60bc35;p=lttv.git diff --git a/ltt/branches/poly/lttv/option.c b/ltt/branches/poly/lttv/option.c index 4a42f747..c5046ef8 100644 --- a/ltt/branches/poly/lttv/option.c +++ b/ltt/branches/poly/lttv/option.c @@ -1,8 +1,8 @@ #include -#include "lttv.h" -#include "option.h" -#include "hook.h" +#include +#include +#include /* Extensible array of popt command line options. Modules add options as they are loaded and initialized. */ @@ -63,6 +63,17 @@ void lttv_option_init(int argc, char **argv) { void lttv_option_destroy() { + struct poptOption *poption; + + int i; + + for(i=0; i < lttv_options_command_popt->len ; i++) { + poption = &g_array_index (lttv_options_command_popt, struct poptOption, i); + + g_free((gpointer)poption->longName); + g_free((gpointer)poption->descrip); + g_free((gpointer)poption->argDescrip); + } g_array_free(lttv_options_command_popt,TRUE) ; g_array_free(lttv_options_command,TRUE) ; @@ -83,18 +94,19 @@ static int poptToLTT[] = { }; -void lttv_option_add(char *long_name, char char_name, char *description, - char *argDescription, lttv_option_type t, void *p, - lttv_option_hook h, void *hook_data) +void lttv_option_add(const char *long_name, const char char_name, + const char *description, const char *argDescription, + const lttv_option_type t, void *p, + const lttv_option_hook h, void *hook_data) { struct poptOption poption; lttv_option option; - poption.longName = long_name; + poption.longName = (char *)g_strdup(long_name); poption.shortName = char_name; - poption.descrip = description; - poption.argDescrip = argDescription; + poption.descrip = (char *)g_strdup(description); + poption.argDescrip = (char *)g_strdup(argDescription); poption.argInfo = poptToLTT[t]; poption.arg = p; poption.val = lttv_options_command->len + 1;