Commit c06a5595 authored by Thomas Haller's avatar Thomas Haller

shared: add nm_utils_gbytes_to_variant_ay() util

parent cd79a22d
......@@ -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);
......
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