diff options
Diffstat (limited to 'dbus/dbus-sysdeps-unix.c')
-rw-r--r-- | dbus/dbus-sysdeps-unix.c | 120 |
1 files changed, 3 insertions, 117 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index d6250bf9..7d6271ab 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -2695,120 +2695,6 @@ _dbus_read_local_machine_uuid (DBusGUID *machine_id, #define DBUS_UNIX_STANDARD_SESSION_SERVICEDIR "/dbus-1/services" -static dbus_bool_t -split_paths_and_append (DBusString *dirs, - const char *suffix, - DBusList **dir_list) -{ - /* split on colon (:) */ - int start; - int i; - int len; - char *cpath; - const DBusString file_suffix; - - start = 0; - i = 0; - - _dbus_string_init_const (&file_suffix, suffix); - - len = _dbus_string_get_length (dirs); - - while (_dbus_string_find (dirs, start, ":", &i)) - { - DBusString path; - - if (!_dbus_string_init (&path)) - goto oom; - - if (!_dbus_string_copy_len (dirs, - start, - i - start, - &path, - 0)) - { - _dbus_string_free (&path); - goto oom; - } - - _dbus_string_chop_white (&path); - - /* check for an empty path */ - if (_dbus_string_get_length (&path) == 0) - goto next; - - if (!_dbus_concat_dir_and_file (&path, - &file_suffix)) - { - _dbus_string_free (&path); - goto oom; - } - - if (!_dbus_string_copy_data(&path, &cpath)) - { - _dbus_string_free (&path); - goto oom; - } - - if (!_dbus_list_append (dir_list, cpath)) - { - _dbus_string_free (&path); - dbus_free (cpath); - goto oom; - } - - next: - _dbus_string_free (&path); - start = i + 1; - } - - if (start != len) - { - DBusString path; - - if (!_dbus_string_init (&path)) - goto oom; - - if (!_dbus_string_copy_len (dirs, - start, - len - start, - &path, - 0)) - { - _dbus_string_free (&path); - goto oom; - } - - if (!_dbus_concat_dir_and_file (&path, - &file_suffix)) - { - _dbus_string_free (&path); - goto oom; - } - - if (!_dbus_string_copy_data(&path, &cpath)) - { - _dbus_string_free (&path); - goto oom; - } - - if (!_dbus_list_append (dir_list, cpath)) - { - _dbus_string_free (&path); - dbus_free (cpath); - goto oom; - } - - _dbus_string_free (&path); - } - - return TRUE; - - oom: - _dbus_list_foreach (dir_list, (DBusForeachFunction)dbus_free, NULL); - _dbus_list_clear (dir_list); - return FALSE; -} /** * Returns the standard directories for a session bus to look for service @@ -2884,9 +2770,9 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs) goto oom; } - if (!split_paths_and_append (&servicedir_path, - DBUS_UNIX_STANDARD_SESSION_SERVICEDIR, - dirs)) + if (!_dbus_split_paths_and_append (&servicedir_path, + DBUS_UNIX_STANDARD_SESSION_SERVICEDIR, + dirs)) goto oom; _dbus_string_free (&servicedir_path); |