Commit 0cde94ec authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Add dbus string convenience function _dbus_string_init_from_string().

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272

Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 6c8b5ed0
......@@ -233,6 +233,23 @@ _dbus_string_init_const_len (DBusString *str,
*/
}
/**
* Initializes a string from another string. The
* string must eventually be freed with _dbus_string_free().
*
* @param str memory to hold the string
* @param from instance from which the string is initialized
* @returns #TRUE on success, #FALSE if no memory
*/
dbus_bool_t
_dbus_string_init_from_string(DBusString *str,
const DBusString *from)
{
if (!_dbus_string_init (str))
return FALSE;
return _dbus_string_append (str, _dbus_string_get_const_data (from));
}
/**
* Frees a string created by _dbus_string_init().
*
......
......@@ -75,6 +75,9 @@ void _dbus_string_init_const_len (DBusString *str,
int len);
dbus_bool_t _dbus_string_init_preallocated (DBusString *str,
int allocate_size);
dbus_bool_t _dbus_string_init_from_string (DBusString *str,
const DBusString *from);
void _dbus_string_free (DBusString *str);
void _dbus_string_lock (DBusString *str);
dbus_bool_t _dbus_string_compact (DBusString *str,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment