mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 13:08:10 +02:00
parent
7927d451fc
commit
beeb676735
2 changed files with 22 additions and 1 deletions
|
|
@ -2527,7 +2527,7 @@ test_setting_compare_wireless_cloned_mac_address (void)
|
||||||
g_assert_cmpstr ("stable-bia", ==, nm_setting_wireless_get_cloned_mac_address ((NMSettingWireless *) new));
|
g_assert_cmpstr ("stable-bia", ==, nm_setting_wireless_get_cloned_mac_address ((NMSettingWireless *) new));
|
||||||
g_object_get (new, NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, &str1, NULL);
|
g_object_get (new, NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, &str1, NULL);
|
||||||
g_assert_cmpstr ("stable-bia", ==, str1);
|
g_assert_cmpstr ("stable-bia", ==, str1);
|
||||||
g_clear_pointer (&str1, g_free);
|
nm_clear_g_free (&str1);
|
||||||
|
|
||||||
success = nm_setting_compare (old, new, NM_SETTING_COMPARE_FLAG_EXACT);
|
success = nm_setting_compare (old, new, NM_SETTING_COMPARE_FLAG_EXACT);
|
||||||
g_assert (!success);
|
g_assert (!success);
|
||||||
|
|
|
||||||
|
|
@ -366,6 +366,27 @@ nm_g_object_unref (gpointer obj)
|
||||||
g_object_unref (obj);
|
g_object_unref (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* basically, replaces
|
||||||
|
* g_clear_pointer (&location, g_free)
|
||||||
|
* with
|
||||||
|
* nm_clear_g_free (&location)
|
||||||
|
*
|
||||||
|
* Another advantage is that by using a macro and typeof(), it is more
|
||||||
|
* typesafe and gives you for example a compiler warning when pp is a const
|
||||||
|
* pointer or points to a const-pointer.
|
||||||
|
*/
|
||||||
|
#define nm_clear_g_free(pp) \
|
||||||
|
({ \
|
||||||
|
typeof (*(pp)) *_pp = (pp); \
|
||||||
|
typeof (**_pp) *_p = *_pp; \
|
||||||
|
\
|
||||||
|
if (_p) { \
|
||||||
|
*_pp = NULL; \
|
||||||
|
g_free (_p); \
|
||||||
|
} \
|
||||||
|
!!_p; \
|
||||||
|
})
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
nm_clear_g_source (guint *id)
|
nm_clear_g_source (guint *id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue