|
@@ -707,6 +707,14 @@ struct perf_config_set *perf_config_set__new(void)
|
|
|
return set;
|
|
|
}
|
|
|
|
|
|
+static int perf_config__init(void)
|
|
|
+{
|
|
|
+ if (config_set == NULL)
|
|
|
+ config_set = perf_config_set__new();
|
|
|
+
|
|
|
+ return config_set == NULL;
|
|
|
+}
|
|
|
+
|
|
|
int perf_config(config_fn_t fn, void *data)
|
|
|
{
|
|
|
int ret = 0;
|
|
@@ -714,7 +722,7 @@ int perf_config(config_fn_t fn, void *data)
|
|
|
struct perf_config_section *section;
|
|
|
struct perf_config_item *item;
|
|
|
|
|
|
- if (config_set == NULL)
|
|
|
+ if (config_set == NULL && perf_config__init())
|
|
|
return -1;
|
|
|
|
|
|
perf_config_set__for_each_entry(config_set, section, item) {
|
|
@@ -735,12 +743,6 @@ int perf_config(config_fn_t fn, void *data)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-void perf_config__init(void)
|
|
|
-{
|
|
|
- if (config_set == NULL)
|
|
|
- config_set = perf_config_set__new();
|
|
|
-}
|
|
|
-
|
|
|
void perf_config__exit(void)
|
|
|
{
|
|
|
perf_config_set__delete(config_set);
|