mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
glib-aux: add nm_ref_string_reset() helper
This commit is contained in:
parent
a1adfccf8a
commit
0b6a9e2c88
|
@ -93,6 +93,23 @@ nm_ref_string_unref(NMRefString *rstr)
|
|||
NM_AUTO_DEFINE_FCN_VOID(NMRefString *, _nm_auto_ref_string, nm_ref_string_unref);
|
||||
#define nm_auto_ref_string nm_auto(_nm_auto_ref_string)
|
||||
|
||||
static inline gboolean
|
||||
nm_ref_string_reset(NMRefString **ptr, NMRefString *str)
|
||||
{
|
||||
NMRefString *rstr;
|
||||
|
||||
nm_assert(ptr);
|
||||
|
||||
rstr = *ptr;
|
||||
|
||||
if (rstr == str)
|
||||
return FALSE;
|
||||
|
||||
*ptr = nm_ref_string_ref(str);
|
||||
nm_ref_string_unref(rstr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline const char *
|
||||
|
|
Loading…
Reference in a new issue