From 90b5e4e3c57013a28333f47a057a3b49e182fa4b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 10 Oct 2015 20:51:17 +0200 Subject: [PATCH] core: disable assertion in nm_ip[46]_config_replace() by default Only enable the assertion when compiling with nm-more-asserts. --- src/nm-ip4-config.c | 8 +++++--- src/nm-ip6-config.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 02257d8c31..23af6aa713 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -940,7 +940,7 @@ nm_ip4_config_intersect (NMIP4Config *dst, const NMIP4Config *src) gboolean nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relevant_changes) { -#ifndef G_DISABLE_ASSERT +#if NM_MORE_ASSERTS gboolean config_equal; #endif gboolean has_minor_changes = FALSE, has_relevant_changes = FALSE, are_equal; @@ -953,7 +953,7 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev g_return_val_if_fail (dst != NULL, FALSE); g_return_val_if_fail (src != dst, FALSE); -#ifndef G_DISABLE_ASSERT +#if NM_MORE_ASSERTS config_equal = nm_ip4_config_equal (dst, src); #endif @@ -1167,9 +1167,11 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev has_minor_changes = TRUE; } +#if NM_MORE_ASSERTS /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ - g_assert (config_equal == !has_relevant_changes); + nm_assert (config_equal == !has_relevant_changes); +#endif g_object_thaw_notify (G_OBJECT (dst)); diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index d1ffbaa1fb..4b18ceab80 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -959,7 +959,7 @@ nm_ip6_config_intersect (NMIP6Config *dst, const NMIP6Config *src) gboolean nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relevant_changes) { -#ifndef G_DISABLE_ASSERT +#if NM_MORE_ASSERTS gboolean config_equal; #endif gboolean has_minor_changes = FALSE, has_relevant_changes = FALSE, are_equal; @@ -972,7 +972,7 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev g_return_val_if_fail (dst != NULL, FALSE); g_return_val_if_fail (src != dst, FALSE); -#ifndef G_DISABLE_ASSERT +#if NM_MORE_ASSERTS config_equal = nm_ip6_config_equal (dst, src); #endif @@ -1132,9 +1132,11 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev has_minor_changes = TRUE; } +#if NM_MORE_ASSERTS /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ - g_assert (config_equal == !has_relevant_changes); + nm_assert (config_equal == !has_relevant_changes); +#endif g_object_thaw_notify (G_OBJECT (dst));