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.

(cherry picked from commit 222f404928)
This commit is contained in:
Thomas Haller 2022-05-04 22:00:16 +02:00 committed by Beniamino Galvani
parent fa4fcf6142
commit 01bcde8ab0

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);