openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/dbus/1.12.16-r0/dbus-1.12.16/dbus/dbus-sysdeps-unix.c
dbus_bool_t _dbus_concat_dir_and_file(DBusString* dir,
                                      const DBusString* next_component)
{
    dbus_bool_t dir_ends_in_slash;
    dbus_bool_t file_starts_with_slash;

    if (_dbus_string_get_length(dir) == 0 ||
        _dbus_string_get_length(next_component) == 0)
        return TRUE;

    dir_ends_in_slash =
        '/' == _dbus_string_get_byte(dir, _dbus_string_get_length(dir) - 1);

    file_starts_with_slash = '/' == _dbus_string_get_byte(next_component, 0);

    if (dir_ends_in_slash && file_starts_with_slash)
    {
        _dbus_string_shorten(dir, 1);
    }
    else if (!(dir_ends_in_slash || file_starts_with_slash))
    {
        if (!_dbus_string_append_byte(dir, '/'))
            return FALSE;
    }

    return _dbus_string_copy(next_component, 0, dir,
                             _dbus_string_get_length(dir));
}
/**
 * Appends the given filename to the given directory.
 *
 * @todo it might be cute to collapse multiple '/' such as "foo//"
 * concat "//bar"
 *
 * @param dir the directory name
 * @param next_component the filename
 * @returns #TRUE on success
 */
Appends the given filename to the given directory.

@param dir the directory name
@param next_component the filename
@returns #TRUE on success
Appends the given filename to the given directory . @param dir the directory name @param next_component the filename @returns #TRUE on success
dbus_bool_t _dbus_concat_dir_and_file(DBusString* dir,
                                      const DBusString* next_component)
{
    dbus_bool_t dir_ends_in_slash;
    dbus_bool_t file_starts_with_slash;
    if (_dbus_string_get_length(dir) == 0 ||
        _dbus_string_get_length(next_component) == 0)
        return TRUE;
    dir_ends_in_slash =
        '/' == _dbus_string_get_byte(dir, _dbus_string_get_length(dir) - 1);
    file_starts_with_slash = '/' == _dbus_string_get_byte(next_component, 0);
    if (dir_ends_in_slash && file_starts_with_slash)
    {
        _dbus_string_shorten(dir, 1);
    }
    else if (!(dir_ends_in_slash || file_starts_with_slash))
    {
        if (!_dbus_string_append_byte(dir, '/'))
            return FALSE;
    }
    return _dbus_string_copy(next_component, 0, dir,
                             _dbus_string_get_length(dir));
}
dbus_bool_t _dbus_concat_dir_and_file ( DBusString * dir , const DBusString * next_component ) { dbus_bool_t dir_ends_in_slash ; dbus_bool_t file_starts_with_slash ; if ( _dbus_string_get_length ( dir ) == 0 || _dbus_string_get_length ( next_component ) == 0 ) return TRUE ; dir_ends_in_slash = ' ' == _dbus_string_get_byte ( dir , _dbus_string_get_length ( dir ) - 1 ) ; file_starts_with_slash = ' ' == _dbus_string_get_byte ( next_component , 0 ) ; if ( dir_ends_in_slash && file_starts_with_slash ) { _dbus_string_shorten ( dir , 1 ) ; } else if ( ! ( dir_ends_in_slash || file_starts_with_slash ) ) { if ( ! _dbus_string_append_byte ( dir , ' ' ) ) return FALSE ; } return _dbus_string_copy ( next_component , 0 , dir , _dbus_string_get_length ( dir ) ) ; }
Appends the given filename to the given directory.
Appends the given filename to the given directory .