mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2025-06-12 08:08:56 +02:00
72 lines
3.1 KiB
Diff
72 lines
3.1 KiB
Diff
https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/32d2abdf34c987df24ba3b073159ea4eee2edf73
|
|
|
|
From 32d2abdf34c987df24ba3b073159ea4eee2edf73 Mon Sep 17 00:00:00 2001
|
|
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
|
|
Date: Thu, 13 Feb 2025 16:06:29 +0200
|
|
Subject: [PATCH] internal-comp-loader: generate a "provides" for components
|
|
that don't have one
|
|
|
|
It is valid for components not to have a "provides" field, but it
|
|
prevents them from being able to have "before" and "after" dependencies.
|
|
With this patch, we generate a hidden "provides" field so that the
|
|
dependencies sorting algorithm can work without issues.
|
|
|
|
Fixes: #771
|
|
---
|
|
lib/wp/private/internal-comp-loader.c | 13 ++++++-------
|
|
1 file changed, 6 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/lib/wp/private/internal-comp-loader.c b/lib/wp/private/internal-comp-loader.c
|
|
index 45877eb7..842c6934 100644
|
|
--- a/lib/wp/private/internal-comp-loader.c
|
|
+++ b/lib/wp/private/internal-comp-loader.c
|
|
@@ -28,7 +28,7 @@ struct _ComponentData
|
|
grefcount ref;
|
|
/* an identifier for this component that is understandable by the end user */
|
|
gchar *printable_id;
|
|
- /* the provided feature name or NULL */
|
|
+ /* the provided feature name */
|
|
gchar *provides;
|
|
/* the original state of the feature (required / optional / disabled) */
|
|
FeatureState state;
|
|
@@ -205,7 +205,7 @@ component_data_new_from_json (WpSpaJson * json, WpProperties * features,
|
|
comp->printable_id = g_strdup_printf ("%s [%s]", comp->provides, comp->type);
|
|
}
|
|
} else {
|
|
- comp->provides = NULL;
|
|
+ comp->provides = g_strdup_printf ("__anonymous_%p", comp);
|
|
comp->state = FEATURE_STATE_REQUIRED;
|
|
comp->printable_id = g_strdup_printf ("[%s: %s]", comp->type, comp->name);
|
|
}
|
|
@@ -328,7 +328,7 @@ wp_component_array_load_task_get_next_step (WpTransition * transition, guint ste
|
|
static gboolean
|
|
component_equals (const ComponentData * comp, const gchar * provides)
|
|
{
|
|
- return (comp->provides && g_str_equal (provides, comp->provides));
|
|
+ return g_str_equal (provides, comp->provides);
|
|
}
|
|
|
|
static inline gboolean
|
|
@@ -358,7 +358,7 @@ sort_components_before_after (WpComponentArrayLoadTask * self, GError ** error)
|
|
gchar *target_provides = g_ptr_array_index (comp->before, j);
|
|
for (guint k = 0; k < self->components->len; k++) {
|
|
ComponentData *target = g_ptr_array_index (self->components, k);
|
|
- if (target->provides && g_str_equal (target_provides, target->provides)) {
|
|
+ if (g_str_equal (target_provides, target->provides)) {
|
|
g_ptr_array_insert (target->after, -1, g_strdup (comp->provides));
|
|
}
|
|
}
|
|
@@ -531,9 +531,8 @@ parse_components (WpComponentArrayLoadTask * self, GError ** error)
|
|
if (comp->state == FEATURE_STATE_REQUIRED)
|
|
g_ptr_array_add (required_components, component_data_ref (comp));
|
|
|
|
- if (comp->provides)
|
|
- g_hash_table_insert (self->feat_components, comp->provides,
|
|
- component_data_ref (comp));
|
|
+ g_hash_table_insert (self->feat_components, comp->provides,
|
|
+ component_data_ref (comp));
|
|
}
|
|
|
|
/* topological sorting based on depth-first search */
|
|
--
|
|
GitLab
|