X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=converter%2Fdefault-cfg.c;h=fb32543143be9afe8bc069fc6766be87a47b2619;hb=290725f719d3d1a8896b73334736d47c5c935040;hp=5368c7a0affb0bc531aaa8fbab48cc2a096835e4;hpb=00447e452fbd828a77543df627eeefc0cc57a078;p=babeltrace.git diff --git a/converter/default-cfg.c b/converter/default-cfg.c index 5368c7a0..fb325431 100644 --- a/converter/default-cfg.c +++ b/converter/default-cfg.c @@ -33,23 +33,43 @@ #ifdef BT_SET_DEFAULT_IN_TREE_CONFIGURATION -int set_default_config(struct bt_config *cfg) +struct bt_config *bt_config_from_args_with_defaults(int argc, + const char *argv[], int *retcode) { + struct bt_value *initial_plugin_paths; + struct bt_config *cfg = NULL; int ret; - cfg->omit_system_plugin_path = true; - cfg->omit_home_plugin_path = true; - ret = bt_config_append_plugin_paths(cfg->plugin_paths, + initial_plugin_paths = bt_value_array_create(); + if (!initial_plugin_paths) { + goto error; + } + + ret = bt_config_append_plugin_paths(initial_plugin_paths, CONFIG_IN_TREE_PLUGIN_PATH); - return ret; + if (ret) { + goto error; + } + + cfg = bt_config_from_args(argc, argv, retcode, true, true, + initial_plugin_paths); + goto end; + +error: + *retcode = 1; + BT_PUT(cfg); + +end: + bt_put(initial_plugin_paths); + return cfg; } #else /* BT_SET_DEFAULT_IN_TREE_CONFIGURATION */ -int set_default_config(struct bt_config *cfg) +struct bt_config *bt_config_from_args_with_defaults(int argc, + const char *argv[], int *retcode) { - /* Nothing to set. */ - return 0; + return bt_config_from_args(argc, argv, retcode, false, false, NULL); } #endif /* BT_SET_DEFAULT_IN_TREE_CONFIGURATION */