Commit 269c15e8 authored by Thomas Haller's avatar Thomas Haller

keyfile: various refactoring and restructure nm_keyfile_read()

- in nm_keyfile_read(), unify _read_setting() and
  _read_setting_vpn_secret() in they way they are called
  (that is, they no longer return any value and don't accept
  any arguments aside @info).

- use cleanup attributes

- use nm_streq() instead of strcmp().

- wrap lines that have multiple statements or conditions.
parent abe84859
...@@ -48,7 +48,7 @@ nm_keyfile_plugin_get_alias_for_setting_name (const char *setting_name) ...@@ -48,7 +48,7 @@ nm_keyfile_plugin_get_alias_for_setting_name (const char *setting_name)
g_return_val_if_fail (setting_name != NULL, NULL); g_return_val_if_fail (setting_name != NULL, NULL);
for (i = 0; i < G_N_ELEMENTS (alias_list); i++) { for (i = 0; i < G_N_ELEMENTS (alias_list); i++) {
if (strcmp (setting_name, alias_list[i].setting) == 0) if (nm_streq (setting_name, alias_list[i].setting))
return alias_list[i].alias; return alias_list[i].alias;
} }
return NULL; return NULL;
...@@ -62,7 +62,7 @@ nm_keyfile_plugin_get_setting_name_for_alias (const char *alias) ...@@ -62,7 +62,7 @@ nm_keyfile_plugin_get_setting_name_for_alias (const char *alias)
g_return_val_if_fail (alias != NULL, NULL); g_return_val_if_fail (alias != NULL, NULL);
for (i = 0; i < G_N_ELEMENTS (alias_list); i++) { for (i = 0; i < G_N_ELEMENTS (alias_list); i++) {
if (strcmp (alias, alias_list[i].alias) == 0) if (nm_streq (alias, alias_list[i].alias))
return alias_list[i].setting; return alias_list[i].setting;
} }
return NULL; return NULL;
......
...@@ -90,4 +90,3 @@ const char *nm_keyfile_key_decode (const char *key, ...@@ -90,4 +90,3 @@ const char *nm_keyfile_key_decode (const char *key,
char **out_to_free); char **out_to_free);
#endif /* __NM_KEYFILE_UTILS_H__ */ #endif /* __NM_KEYFILE_UTILS_H__ */
This diff is collapsed.
...@@ -1196,7 +1196,7 @@ nm_g_object_set_property_boolean (GObject *object, ...@@ -1196,7 +1196,7 @@ nm_g_object_set_property_boolean (GObject *object,
gboolean gboolean
nm_g_object_set_property_uint (GObject *object, nm_g_object_set_property_uint (GObject *object,
const char *property_name, const char *property_name,
guint value, guint value,
GError **error) GError **error)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment