Fix compiler warnings
[babeltrace.git] / converter / babeltrace-cfg.c
index a7c5b12a6b2b6759c8c21fcbccc9d243a00b519c..a2b2ac4f8968c80f135e4807b5d696a95bd9fe77 100644 (file)
@@ -734,8 +734,7 @@ void print_legacy_usage(FILE *fp)
        fprintf(fp, "                               (default: `/usr/lib/debug`)\n");
        fprintf(fp, "  -f, --fields=NAME[,NAME]...  Print additional fields:\n");
        fprintf(fp, "                                 all, trace, trace:hostname, trace:domain,\n");
-       fprintf(fp, "                                 trace:procname, trace:vpid, loglevel, emf,\n");
-       fprintf(fp, "                                 callsite\n");
+       fprintf(fp, "                                 trace:procname, trace:vpid, loglevel, emf\n");
        fprintf(fp, "                                 (default: trace:hostname, trace:procname,\n");
        fprintf(fp, "                                           trace:vpid)\n");
        fprintf(fp, "  -n, --names=NAME[,NAME]...   Print field names:\n");
@@ -770,11 +769,13 @@ void print_usage(FILE *fp)
        fprintf(fp, "      --end-ns=NS                   Set the end timestamp of the latest source\n");
        fprintf(fp, "                                    component instance to NS\n");
        fprintf(fp, "  -l, --list                        List available plugins and their components\n");
+       fprintf(fp, "  -P, --path=PATH                   Set the `path` parameter of the latest source\n");
+       fprintf(fp, "                                    or sink component to PATH\n");
        fprintf(fp, "  -p, --params=PARAMS               Set the parameters of the latest source or\n");
        fprintf(fp, "                                    sink component instance (in command-line \n");
        fprintf(fp, "                                    order) to PARAMS (see the exact format of\n");
        fprintf(fp, "                                    PARAMS below)\n");
-       fprintf(fp, "  -P, --plugin-path=PATH[:PATH]...  Set paths from which dynamic plugins can be\n");
+       fprintf(fp, "      --plugin-path=PATH[:PATH]...  Set paths from which dynamic plugins can be\n");
        fprintf(fp, "                                    loaded to PATH\n");
        fprintf(fp, "      --reset-base-begin-ns         Reset the current base beginning timestamp\n");
        fprintf(fp, "                                    of the following source component instances\n");
@@ -2200,6 +2201,7 @@ enum {
        OPT_NO_DELTA,
        OPT_OUTPUT_FORMAT,
        OPT_OUTPUT_PATH,
+       OPT_PATH,
        OPT_PARAMS,
        OPT_PLUGIN_PATH,
        OPT_RESET_BASE_BEGIN_NS,
@@ -2240,8 +2242,9 @@ static struct poptOption long_options[] = {
        { "no-delta", '\0', POPT_ARG_NONE, NULL, OPT_NO_DELTA, NULL, NULL },
        { "output", 'w', POPT_ARG_STRING, NULL, OPT_OUTPUT_PATH, NULL, NULL },
        { "output-format", 'o', POPT_ARG_STRING, NULL, OPT_OUTPUT_FORMAT, NULL, NULL },
+       { "path", 'P', POPT_ARG_STRING, NULL, OPT_PATH, NULL, NULL },
        { "params", 'p', POPT_ARG_STRING, NULL, OPT_PARAMS, NULL, NULL },
-       { "plugin-path", 'P', POPT_ARG_STRING, NULL, OPT_PLUGIN_PATH, NULL, NULL },
+       { "plugin-path", '\0', POPT_ARG_STRING, NULL, OPT_PLUGIN_PATH, NULL, NULL },
        { "reset-base-begin-ns", '\0', POPT_ARG_NONE, NULL, OPT_RESET_BASE_BEGIN_NS, NULL, NULL },
        { "reset-base-end-ns", '\0', POPT_ARG_NONE, NULL, OPT_RESET_BASE_END_NS, NULL, NULL },
        { "reset-base-params", 'r', POPT_ARG_NONE, NULL, OPT_RESET_BASE_PARAMS, NULL, NULL },
@@ -2297,8 +2300,8 @@ struct bt_config *bt_config_from_args(int argc, char *argv[], int *exit_code)
        struct bt_config *cfg = NULL;
        poptContext pc = NULL;
        char *arg = NULL;
-       struct ctf_legacy_opts ctf_legacy_opts = { 0 };
-       struct text_legacy_opts text_legacy_opts = { 0 };
+       struct ctf_legacy_opts ctf_legacy_opts;
+       struct text_legacy_opts text_legacy_opts;
        enum legacy_input_format legacy_input_format = LEGACY_INPUT_FORMAT_NONE;
        enum legacy_output_format legacy_output_format =
                LEGACY_OUTPUT_FORMAT_NONE;
@@ -2313,6 +2316,8 @@ struct bt_config *bt_config_from_args(int argc, char *argv[], int *exit_code)
        bool cur_cfg_comp_params_set = false;
        unsigned int i;
 
+       memset(&ctf_legacy_opts, 0, sizeof(ctf_legacy_opts));
+       memset(&text_legacy_opts, 0, sizeof(text_legacy_opts));
        *exit_code = 0;
 
        if (argc <= 1) {
@@ -2461,7 +2466,12 @@ struct bt_config *bt_config_from_args(int argc, char *argv[], int *exit_code)
 
                        assert(cur_base_params);
                        bt_put(cur_cfg_comp->params);
-                       cur_cfg_comp->params = bt_get(cur_base_params);
+                       cur_cfg_comp->params = bt_value_copy(cur_base_params);
+                       if (!cur_cfg_comp) {
+                               print_err_oom();
+                               goto end;
+                       }
+
                        cur_cfg_comp->begin_ns = cur_base_begin_ns;
                        cur_cfg_comp->end_ns = cur_base_end_ns;
                        cur_cfg_comp_dest = BT_CONFIG_COMPONENT_DEST_SOURCE;
@@ -2520,7 +2530,12 @@ struct bt_config *bt_config_from_args(int argc, char *argv[], int *exit_code)
 
                        assert(cur_base_params);
                        bt_put(cur_cfg_comp->params);
-                       cur_cfg_comp->params = bt_get(cur_base_params);
+                       cur_cfg_comp->params = bt_value_copy(cur_base_params);
+                       if (!cur_cfg_comp) {
+                               print_err_oom();
+                               goto end;
+                       }
+
                        cur_cfg_comp_dest = BT_CONFIG_COMPONENT_DEST_SINK;
                        cur_cfg_comp_params_set = false;
                        break;
@@ -2562,6 +2577,20 @@ struct bt_config *bt_config_from_args(int argc, char *argv[], int *exit_code)
                        cur_cfg_comp_params_set = true;
                        break;
                }
+               case OPT_PATH:
+                       if (!cur_cfg_comp) {
+                               printf_err("--path option must follow a --source or --sink option\n");
+                               goto error;
+                       }
+
+                       assert(cur_cfg_comp->params);
+
+                       if (bt_value_map_insert_string(cur_cfg_comp->params,
+                                       "path", arg)) {
+                               print_err_oom();
+                               goto error;
+                       }
+                       break;
                case OPT_BASE_PARAMS:
                {
                        struct bt_value *params = bt_value_from_arg(arg);
This page took 0.025462 seconds and 4 git commands to generate.