conf: drop all the _get_value() functions and remove the fallback from _get_section()

We do not use these APIs, so there's no point in keeping them.

Realistically, every component that needs a section just does its
own parsing on it, so the _get_value() functions are not needed.

The fallback in _get_section() is also not needed, as we always
pass NULL and then test for it. In Lua, however, it seems we are
using the fallback to return an empty object, so that getting
a section does not expand to multiple lines of code. For that reason,
I have kept the syntax there and implemented it in the bindings layer.
This commit is contained in:
George Kiagiadakis
2024-02-28 18:58:57 +02:00
parent 4596b7162e
commit c841ec97a8
7 changed files with 45 additions and 527 deletions

View File

@@ -752,24 +752,27 @@ wp_internal_comp_loader_load (WpComponentLoader * self, WpCore * core,
/* component name is the profile name;
component list and profile features are loaded from config */
g_autoptr (WpConf) conf = wp_core_get_conf (core);
g_autoptr (WpSpaJson) profile_json = NULL;
g_autoptr (WpSpaJson) all_profiles_j = NULL;
g_autoptr (WpSpaJson) profile_j = NULL;
const gchar *profile_name = component;
profile_json =
wp_conf_get_value (conf, "wireplumber.profiles", component, NULL);
if (!profile_json) {
all_profiles_j = wp_conf_get_section (conf, "wireplumber.profiles");
if (all_profiles_j)
wp_spa_json_object_get (all_profiles_j, profile_name, "J", &profile_j, NULL);
if (!profile_j) {
g_autoptr (GTask) task = g_task_new (self, cancellable, callback, data);
g_task_set_source_tag (task, wp_internal_comp_loader_load);
g_task_return_new_error (G_TASK (task), WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_INVALID_ARGUMENT,
"profile '%s' not found in configuration", component);
"profile '%s' not found in configuration", profile_name);
return;
}
wp_properties_update_from_json (profile, profile_json);
wp_properties_update_from_json (profile, profile_j);
components = wp_conf_get_section (conf, "wireplumber.components", NULL);
rules = wp_conf_get_section (conf, "wireplumber.components.rules", NULL);
components = wp_conf_get_section (conf, "wireplumber.components");
rules = wp_conf_get_section (conf, "wireplumber.components.rules");
}
else {
/* component list is retrieved from args; profile features are empty */