diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-02-02 10:11:23 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-02-02 10:11:23 +0000 |
commit | 93be594100f783b409cba98f6c9d58060c4ef433 (patch) | |
tree | 1d7fe6dd97e402d0334aea95fdd70091824b524f /pango/pango-utils.c | |
parent | e2a2ac7947f8763fe1270d0f5f42602e59d84c0a (diff) | |
download | pango-93be594100f783b409cba98f6c9d58060c4ef433.tar.gz |
Fix GKeyFile transition.
2006-02-02 Behdad Esfahbod <behdad@gnome.org>
* pango/pango-utils.c (read_config_file): Fix GKeyFile transition.
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r-- | pango/pango-utils.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index e9fec5f6..38083f18 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -459,8 +459,8 @@ read_config_file (const char *filename, gboolean enoent_error) GKeyFile *key_file = g_key_file_new(); GError *key_file_error = NULL; gchar **groups; - gsize groups_length = 0; - gsize i = 0; + gsize groups_count = 0; + gint group_index; if (!g_key_file_load_from_file(key_file,filename, 0, &key_file_error)) { @@ -477,47 +477,47 @@ read_config_file (const char *filename, gboolean enoent_error) return; } - groups = g_key_file_get_groups (key_file, &groups_length); - while (i < groups_length) + groups = g_key_file_get_groups (key_file, &groups_count); + for (group_index = 0; group_index < groups_count; group_index++) { - gsize keys_length = 0; - gchar *current_group = groups[i]; + gsize keys_count = 0; + const gchar *group = groups[group_index]; GError *keys_error = NULL; - gsize j = 0; - gchar **keys = g_key_file_get_keys(key_file,current_group, &keys_length,&keys_error); + gchar **keys; + + keys = g_key_file_get_keys(key_file, group, &keys_count, &keys_error); if (keys) { - while ( j < keys_length) + gint key_index; + + for (key_index = 0; key_index < keys_count; key_index++) { - gchar *key = keys[j]; + const gchar *key = keys[key_index]; GError *key_error = NULL; - gchar *value = g_key_file_get_value(key_file,current_group,key, &key_error); + gchar *value = g_key_file_get_value(key_file, group, key, &key_error); if (value != NULL) { g_hash_table_insert (config_hash, - g_strdup (key), - g_strdup (value)); - free(value); + g_strdup_printf ("%s/%s", group, key), + value); } if (key_error) { - g_warning ("error getting key '%s' in config file '%s'\n", - key, filename); + g_warning ("error getting key '%s/%s' in config file '%s'\n", + group, key, filename); g_error_free(key_error); } - j++; } g_strfreev(keys); - } + if (keys_error) { g_warning ("error getting keys in group '%s' of config file '%s'\n", - filename, current_group); + filename, group); g_error_free(keys_error); } - i++; } g_strfreev(groups); g_key_file_free(key_file); |