From 519b1ea61d279db09dd914962dafbce5931ca6ed Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 18 Jan 2011 13:22:00 -0600 Subject: [PATCH] keyfile: namespace commonly-named functions (bgo #639537) Now that keyfile is built in, we may have symbol naming conflicts with the other plugins where code was copied & pasted around. Fix that by namespacing common function names in the keyfile plugin. Thanks to Giovanni Campagna for pinpointing the issue. --- .../plugins/keyfile/nm-keyfile-connection.c | 2 +- system-settings/plugins/keyfile/reader.c | 2 +- system-settings/plugins/keyfile/reader.h | 2 +- .../plugins/keyfile/tests/test-keyfile.c | 26 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/system-settings/plugins/keyfile/nm-keyfile-connection.c b/system-settings/plugins/keyfile/nm-keyfile-connection.c index d19b709d9a..5368464ef8 100644 --- a/system-settings/plugins/keyfile/nm-keyfile-connection.c +++ b/system-settings/plugins/keyfile/nm-keyfile-connection.c @@ -56,7 +56,7 @@ nm_keyfile_connection_new (const char *full_path, if (source) tmp = g_object_ref (source); else { - tmp = connection_from_file (full_path, error); + tmp = nm_keyfile_plugin_connection_from_file (full_path, error); if (!tmp) return NULL; } diff --git a/system-settings/plugins/keyfile/reader.c b/system-settings/plugins/keyfile/reader.c index 841315d9c6..9533e906a0 100644 --- a/system-settings/plugins/keyfile/reader.c +++ b/system-settings/plugins/keyfile/reader.c @@ -1054,7 +1054,7 @@ read_vpn_secrets (GKeyFile *file, NMSettingVPN *s_vpn) } NMConnection * -connection_from_file (const char *filename, GError **error) +nm_keyfile_plugin_connection_from_file (const char *filename, GError **error) { GKeyFile *key_file; struct stat statbuf; diff --git a/system-settings/plugins/keyfile/reader.h b/system-settings/plugins/keyfile/reader.h index 3572715495..55819630eb 100644 --- a/system-settings/plugins/keyfile/reader.h +++ b/system-settings/plugins/keyfile/reader.h @@ -25,6 +25,6 @@ #include #include -NMConnection *connection_from_file (const char *filename, GError **error); +NMConnection *nm_keyfile_plugin_connection_from_file (const char *filename, GError **error); #endif /* _KEYFILE_PLUGIN_READER_H */ diff --git a/system-settings/plugins/keyfile/tests/test-keyfile.c b/system-settings/plugins/keyfile/tests/test-keyfile.c index 05131c8fe8..213d3e87fe 100644 --- a/system-settings/plugins/keyfile/tests/test-keyfile.c +++ b/system-settings/plugins/keyfile/tests/test-keyfile.c @@ -83,7 +83,7 @@ test_read_valid_wired_connection (void) NMIP6Address *ip6_addr; NMIP6Route *ip6_route; - connection = connection_from_file (TEST_WIRED_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_WIRED_FILE); @@ -702,7 +702,7 @@ test_write_wired_connection (void) "connection-write", "didn't get keyfile name back after writing connection"); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -735,7 +735,7 @@ test_read_ip6_wired_connection (void) const char *expected6_gw1 = "abcd:1234:ffff::cdd1"; NMIP6Address *ip6_addr; - connection = connection_from_file (TEST_WIRED_IP6_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_IP6_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_WIRED_IP6_FILE); @@ -962,7 +962,7 @@ test_write_ip6_wired_connection (void) "connection-write", "didn't get keyfile name back after writing connection"); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -991,7 +991,7 @@ test_read_wired_mac_case (void) const char *expected_id = "Test Wired Connection MAC Case"; const char *expected_uuid = "4e80a56d-c99f-4aad-a6dd-b449bc398c57"; - connection = connection_from_file (TEST_WIRED_MAC_CASE_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_MAC_CASE_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_WIRED_MAC_CASE_FILE); @@ -1077,7 +1077,7 @@ test_read_valid_wireless_connection (void) const guint64 expected_timestamp = 1226604314; guint64 timestamp; - connection = connection_from_file (TEST_WIRELESS_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_WIRELESS_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_WIRELESS_FILE); @@ -1280,7 +1280,7 @@ test_write_wireless_connection (void) "connection-write", "didn't get keyfile name back after writing connection"); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -1305,7 +1305,7 @@ test_read_string_ssid (void) const GByteArray *array; const char *expected_ssid = "blah blah ssid 1234"; - connection = connection_from_file (TEST_STRING_SSID_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_STRING_SSID_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_STRING_SSID_FILE); @@ -1423,7 +1423,7 @@ test_write_string_ssid (void) g_key_file_free (keyfile); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -1458,7 +1458,7 @@ test_read_bt_dun_connection (void) const char *expected_username = "ISP@CINGULARGPRS.COM"; const char *expected_password = "CINGULAR1"; - connection = connection_from_file (TEST_BT_DUN_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_BT_DUN_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_BT_DUN_FILE); @@ -1708,7 +1708,7 @@ test_write_bt_dun_connection (void) "connection-write", "didn't get keyfile name back after writing connection"); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, @@ -1742,7 +1742,7 @@ test_read_gsm_connection (void) const char *expected_network_id = "24005"; const char *expected_pin = "2345"; - connection = connection_from_file (TEST_GSM_FILE, NULL); + connection = nm_keyfile_plugin_connection_from_file (TEST_GSM_FILE, NULL); ASSERT (connection != NULL, "connection-read", "failed to read %s", TEST_GSM_FILE); @@ -1970,7 +1970,7 @@ test_write_gsm_connection (void) "connection-write", "didn't get keyfile name back after writing connection"); /* Read the connection back in and compare it to the one we just wrote out */ - reread = connection_from_file (testfile, NULL); + reread = nm_keyfile_plugin_connection_from_file (testfile, NULL); ASSERT (reread != NULL, "connection-write", "failed to re-read test connection"); ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE,