From 9fda0817abeb3230f32b4b8b2b07a80f6105c935 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 3 Feb 2016 13:34:38 +0100 Subject: [PATCH] nmtst: don't use G_STRLOC in test functions Instead pass separate values for file and line. Otherwise, we create a unique string for each occurance. --- shared/nm-test-utils.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/nm-test-utils.h b/shared/nm-test-utils.h index e926c51659..86acaddc88 100644 --- a/shared/nm-test-utils.h +++ b/shared/nm-test-utils.h @@ -1578,7 +1578,7 @@ nmtst_assert_setting_verify_fails (NMSetting *setting, #ifdef __NM_UTILS_H__ static inline void -nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const char *expected, const char *loc) +nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const char *expected, const char *file, int line) { guint8 buf2[NM_UTILS_HWADDR_LEN_MAX]; gsize hwaddr2_len = 1; @@ -1603,12 +1603,12 @@ nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const cha if (success) success = !memcmp (hwaddr1, buf2, hwaddr1_len); if (!success) { - g_error ("assert: %s: hwaddr '%s' (%zd) expected, but got %s (%zd)", - loc, expected, hwaddr2_len, nm_utils_hwaddr_ntoa (hwaddr1, hwaddr1_len), hwaddr1_len); + g_error ("assert: %s:%d: hwaddr '%s' (%zd) expected, but got %s (%zd)", + file, line, expected, hwaddr2_len, nm_utils_hwaddr_ntoa (hwaddr1, hwaddr1_len), hwaddr1_len); } } #define nmtst_assert_hwaddr_equals(hwaddr1, hwaddr1_len, expected) \ - nmtst_assert_hwaddr_equals (hwaddr1, hwaddr1_len, expected, G_STRLOC) + nmtst_assert_hwaddr_equals (hwaddr1, hwaddr1_len, expected, __FILE__, __LINE__) #endif #if defined(__NM_SIMPLE_CONNECTION_H__) && defined(__NM_SETTING_CONNECTION_H__) && defined(__NM_KEYFILE_INTERNAL_H__)