return 0;
}
-static int merge_by_names(Unit **u, Set *names, const char *id) {
+static int merge_by_names(Unit *u, Set *names, const char *id) {
char *k;
int r;
assert(u);
- assert(*u);
/* Let's try to add in all names that are aliases of this unit */
while ((k = set_steal_first(names))) {
_cleanup_free_ _unused_ char *free_k = k;
/* First try to merge in the other name into our unit */
- r = unit_merge_by_name(*u, k);
+ r = unit_merge_by_name(u, k);
if (r < 0) {
Unit *other;
/* Hmm, we couldn't merge the other unit into ours? Then let's try it the other way
* round. */
- other = manager_get_unit((*u)->manager, k);
+ other = manager_get_unit(u->manager, k);
if (!other)
return r; /* return previous failure */
- r = unit_merge(other, *u);
+ r = unit_merge(other, u);
if (r < 0)
return r;
- *u = other;
- return merge_by_names(u, names, NULL);
+ return merge_by_names(other, names, NULL);
}
if (streq_ptr(id, k))
- unit_choose_id(*u, id);
+ unit_choose_id(u, id);
}
return 0;
}
}
- Unit *merged = u;
- r = merge_by_names(&merged, names, id);
- if (r < 0)
- return r;
-
- if (merged != u)
- u->load_state = UNIT_MERGED;
-
- return 0;
+ return merge_by_names(u, names, id);
}
void unit_dump_config_items(FILE *f) {