diff options
| author | Michael Biebl <biebl@debian.org> | 2018-06-17 14:54:10 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-06-17 14:54:10 +0200 |
| commit | 069cb5c3a525ebcc19cc2927964258acaca87b13 (patch) | |
| tree | 66ac6b21a44d630c0fc281c0df327239d491226a /shared/nm-utils/nm-macros-internal.h | |
| parent | 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (diff) | |
New upstream version 1.11.90 upstream/1.11.90
Diffstat (limited to 'shared/nm-utils/nm-macros-internal.h')
| -rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index 908b25fd..ef3039e6 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -807,8 +807,8 @@ nm_g_object_unref (gpointer obj) g_object_unref (obj); } -/* Assigns GObject @obj to destination @pdst, and takes an additional ref. - * The previous value of @pdst is unrefed. +/* Assigns GObject @obj to destination @pp, and takes an additional ref. + * The previous value of @pp is unrefed. * * It makes sure to first increase the ref-count of @obj, and handles %NULL * @obj correctly. @@ -816,22 +816,18 @@ nm_g_object_unref (gpointer obj) #define nm_g_object_ref_set(pp, obj) \ ({ \ typeof (*(pp)) *const _pp = (pp); \ - typeof (**_pp) *const _obj = (obj); \ - typeof (**_pp) *_p; \ + typeof (*_pp) const _obj = (obj); \ + typeof (*_pp) _p; \ gboolean _changed = FALSE; \ \ + nm_assert (!_pp || !*_pp || G_IS_OBJECT (*_pp)); \ + nm_assert (!_obj || G_IS_OBJECT (_obj)); \ + \ if ( _pp \ && ((_p = *_pp) != _obj)) { \ - if (_obj) { \ - nm_assert (G_IS_OBJECT (_obj)); \ - g_object_ref (_obj); \ - } \ - if (_p) { \ - nm_assert (G_IS_OBJECT (_p)); \ - *_pp = NULL; \ - g_object_unref (_p); \ - } \ + nm_g_object_ref (_obj); \ *_pp = _obj; \ + nm_g_object_unref (_p); \ _changed = TRUE; \ } \ _changed; \ |