glib-aux: add nm_g_bytes_ref() helper

g_bytes_ref() does not accept NULL. But doing so can be convenient,
add a helper for that.

Note that g_bytes_unref() does accept NULL, so there is no corresponding
helper.
This commit is contained in:
Thomas Haller 2022-05-04 22:00:16 +02:00
parent 7d1a9b898d
commit 222f404928
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -623,6 +623,16 @@ nm_utils_is_separator(const char c)
/*****************************************************************************/
static inline GBytes *
nm_g_bytes_ref(GBytes *b)
{
if (b)
g_bytes_ref(b);
return b;
}
/*****************************************************************************/
GBytes *nm_g_bytes_get_empty(void);
GBytes *nm_g_bytes_new_from_str(const char *str);