mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-21 14:40:47 +02:00
config-parser: Eliminate duplicate functionality
We had two ways to append a path to the list of service directories. Collapse them into one. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99825 Reviewed-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
b031874106
commit
ade23fe461
1 changed files with 7 additions and 14 deletions
|
|
@ -252,17 +252,6 @@ service_dirs_find_dir (DBusList **service_dirs,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static dbus_bool_t
|
||||
service_dirs_append_unique_or_free (DBusList **service_dirs,
|
||||
char *dir)
|
||||
{
|
||||
if (!service_dirs_find_dir (service_dirs, dir))
|
||||
return _dbus_list_append (service_dirs, dir);
|
||||
|
||||
dbus_free (dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
service_dirs_append_link_unique_or_free (DBusList **service_dirs,
|
||||
DBusList *dir_link)
|
||||
|
|
@ -2601,7 +2590,8 @@ bus_config_parser_content (BusConfigParser *parser,
|
|||
{
|
||||
char *s;
|
||||
DBusString full_path;
|
||||
|
||||
DBusList *link;
|
||||
|
||||
e->had_content = TRUE;
|
||||
|
||||
if (!_dbus_string_init (&full_path))
|
||||
|
|
@ -2619,14 +2609,17 @@ bus_config_parser_content (BusConfigParser *parser,
|
|||
goto nomem;
|
||||
}
|
||||
|
||||
/* _only_ extra session directories can be specified */
|
||||
if (!service_dirs_append_unique_or_free (&parser->service_dirs, s))
|
||||
link = _dbus_list_alloc_link (s);
|
||||
|
||||
if (link == NULL)
|
||||
{
|
||||
_dbus_string_free (&full_path);
|
||||
dbus_free (s);
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
/* cannot fail */
|
||||
service_dirs_append_link_unique_or_free (&parser->service_dirs, link);
|
||||
_dbus_string_free (&full_path);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue