X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Foption.c;h=f4b34275af4f9097bc74c9a0d7fd09fb6c80dc44;hb=00e74b693f28b3f543d8ec18ae631abab8023d5c;hp=54af7932a531d3cf8e5c63c1b2522a97d5964591;hpb=cf74a6f1dc8fdeb7f7216d1c22f89fff405f9df1;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/option.c b/ltt/branches/poly/lttv/lttv/option.c index 54af7932..f4b34275 100644 --- a/ltt/branches/poly/lttv/lttv/option.c +++ b/ltt/branches/poly/lttv/lttv/option.c @@ -107,7 +107,7 @@ static int poptToLTT[] = { POPT_ARG_NONE, POPT_ARG_STRING, POPT_ARG_INT, POPT_ARG_LONG }; -static struct poptOption endOption = { NULL, '\0', 0, NULL, 0}; +static struct poptOption endOption = { NULL, '\0', 0, NULL, 0, NULL, NULL }; static void @@ -134,15 +134,15 @@ build_popts(GPtrArray **plist, struct poptOption **ppopts, poptContext *pc, /* add the options in the reverse order, so last additions are parsed first */ for(i = 0 ; i < list->len ; i++) { - guint index = list->len-1-i; + guint reverse_i = list->len-1-i; option = (LttvOption *)list->pdata[i]; - popts[index].longName = option->long_name; - popts[index].shortName = option->char_name; - popts[index].descrip = option->description; - popts[index].argDescrip = option->arg_description; - popts[index].argInfo = poptToLTT[option->t]; - popts[index].arg = option->p; - popts[index].val = option->val; + popts[reverse_i].longName = option->long_name; + popts[reverse_i].shortName = option->char_name; + popts[reverse_i].descrip = option->description; + popts[reverse_i].argDescrip = option->arg_description; + popts[reverse_i].argInfo = poptToLTT[option->t]; + popts[reverse_i].arg = option->p; + popts[reverse_i].val = option->val; } /* Terminate the array for popt and create the context */ @@ -271,11 +271,9 @@ static void show_help(LttvOption *option) void lttv_option_show_help(void) { - LttvOption option; - GPtrArray *list = g_ptr_array_new(); - int i; + guint i; g_hash_table_foreach(options, list_options, list); @@ -286,8 +284,6 @@ void lttv_option_show_help(void) show_help((LttvOption *)list->pdata[i]); } g_ptr_array_free(list, TRUE); - - } static void init() @@ -299,11 +295,9 @@ static void init() static void destroy() { - LttvOption option; - GPtrArray *list = g_ptr_array_new(); - int i; + guint i; g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Destroy option.c"); g_hash_table_foreach(options, list_options, list);