mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 20:00:23 +01:00
shared: add nm_utils_gbytes_to_variant_ay() util
This commit is contained in:
parent
cd79a22d18
commit
c06a55958b
2 changed files with 21 additions and 0 deletions
|
|
@ -117,6 +117,23 @@ nm_utils_strbuf_append (char **buf, gsize *len, const char *format, ...)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
GVariant *
|
||||
nm_utils_gbytes_to_variant_ay (GBytes *bytes)
|
||||
{
|
||||
const guint8 *p;
|
||||
gsize l;
|
||||
|
||||
if (!bytes) {
|
||||
/* for convenience, accept NULL to return an empty variant */
|
||||
return g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0);
|
||||
}
|
||||
|
||||
p = g_bytes_get_data (bytes, &l);
|
||||
return g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, p, l, 1);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_strquote:
|
||||
* @buf: the output buffer of where to write the quoted @str argument.
|
||||
|
|
|
|||
|
|
@ -202,6 +202,10 @@ nm_utils_is_separator (const char c)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
GVariant *nm_utils_gbytes_to_variant_ay (GBytes *bytes);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *nm_utils_dbus_path_get_last_component (const char *dbus_path);
|
||||
|
||||
int nm_utils_dbus_path_cmp (const char *dbus_path_a, const char *dbus_path_b);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue