diff --git a/lib/filehighlight/ini-file-read.c b/lib/filehighlight/ini-file-read.c index 26777ad25..42ad872ce 100644 --- a/lib/filehighlight/ini-file-read.c +++ b/lib/filehighlight/ini-file-read.c @@ -132,12 +132,9 @@ mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name) { mc_fhl_filter_t *mc_filter; gchar **exts, **exts_orig; - gsize exts_size; GString *buf; - exts_orig = exts = - mc_config_get_string_list (fhl->config, group_name, "extensions", &exts_size); - + exts_orig = mc_config_get_string_list (fhl->config, group_name, "extensions", NULL); if (exts_orig == NULL || exts_orig[0] == NULL) { g_strfreev (exts_orig); @@ -145,6 +142,7 @@ mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name) } buf = g_string_sized_new (64); + for (exts = exts_orig; *exts != NULL; exts++) { char *esc_ext; diff --git a/lib/mcconfig.h b/lib/mcconfig.h index ff3eee5fd..cc68992bc 100644 --- a/lib/mcconfig.h +++ b/lib/mcconfig.h @@ -62,7 +62,8 @@ gboolean mc_config_get_bool (mc_config_t *, const gchar *, const gchar *, gboole int mc_config_get_int (mc_config_t *, const gchar *, const gchar *, int); -gchar **mc_config_get_string_list (mc_config_t *, const gchar *, const gchar *, gsize *); +gchar **mc_config_get_string_list (mc_config_t * mc_config, const gchar * group, + const gchar * param, gsize * length); gboolean *mc_config_get_bool_list (mc_config_t *, const gchar *, const gchar *, gsize *); diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index ba593d840..5f7290f30 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -1921,7 +1921,6 @@ edit_load_macro_cmd (WEdit * edit) mc_config_t *macros_config = NULL; gchar **profile_keys, **keys; gchar **values, **curr_values; - gsize values_len; const char *section_name = "editor"; gchar *macros_fname; @@ -1944,8 +1943,7 @@ edit_load_macro_cmd (WEdit * edit) macros_t macro; macros = g_array_new (TRUE, FALSE, sizeof (macro_action_t)); - values = - mc_config_get_string_list (macros_config, section_name, *profile_keys, &values_len); + values = mc_config_get_string_list (macros_config, section_name, *profile_keys, NULL); hotkey = lookup_key (*profile_keys, NULL); for (curr_values = values; *curr_values != NULL && *curr_values[0] != '\0'; curr_values++) diff --git a/src/filemanager/treestore.c b/src/filemanager/treestore.c index fb710a865..065eda5c0 100644 --- a/src/filemanager/treestore.c +++ b/src/filemanager/treestore.c @@ -539,23 +539,24 @@ remove_entry (tree_entry * entry) static void process_special_dirs (GList ** special_dirs, const char *file) { - gchar **buffers, **start_buff; + gchar **start_buff; mc_config_t *cfg; - gsize buffers_len; cfg = mc_config_init (file, TRUE); if (cfg == NULL) return; - start_buff = buffers = mc_config_get_string_list (cfg, "Special dirs", "list", &buffers_len); - if (buffers != NULL) + start_buff = mc_config_get_string_list (cfg, "Special dirs", "list", NULL); + if (start_buff != NULL) { - while (*buffers != NULL) + gchar **buffers; + + for (buffers = start_buff; *buffers != NULL; buffers++) { *special_dirs = g_list_prepend (*special_dirs, *buffers); *buffers = NULL; - buffers++; } + g_strfreev (start_buff); } mc_config_deinit (cfg); diff --git a/src/setup.c b/src/setup.c index 4ad734680..ee15a033a 100644 --- a/src/setup.c +++ b/src/setup.c @@ -617,10 +617,8 @@ load_keys_from_section (const char *terminal, mc_config_t * cfg) { char *section_name; gchar **profile_keys, **keys; - gchar **values, **curr_values; char *valcopy, *value; long key_code; - gsize values_len; if (terminal == NULL) return; @@ -639,22 +637,24 @@ load_keys_from_section (const char *terminal, mc_config_t * cfg) continue; } - curr_values = values = - mc_config_get_string_list (cfg, section_name, *profile_keys, &values_len); - key_code = lookup_key (*profile_keys, NULL); - if (key_code != 0) { - if (curr_values != NULL) + gchar **values; + + values = mc_config_get_string_list (cfg, section_name, *profile_keys, NULL); + if (values != NULL) { - while (*curr_values != NULL) + gchar **curr_values; + + for (curr_values = values; *curr_values != NULL; curr_values++) { valcopy = convert_controls (*curr_values); define_sequence (key_code, valcopy, MCKEY_NOACTION); g_free (valcopy); - curr_values++; } + + g_strfreev (values); } else { @@ -665,8 +665,6 @@ load_keys_from_section (const char *terminal, mc_config_t * cfg) g_free (value); } } - - g_strfreev (values); } g_strfreev (keys); g_free (section_name); @@ -686,22 +684,21 @@ load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t for (profile_keys = keys; *profile_keys != NULL; profile_keys++) { - gchar **values, **curr_values; - gsize len; + gchar **values; - curr_values = values = mc_config_get_string_list (cfg, section_name, *profile_keys, &len); - - if (curr_values != NULL) + values = mc_config_get_string_list (cfg, section_name, *profile_keys, NULL); + if (values != NULL) { int action; action = keybind_lookup_action (*profile_keys); if (action > 0) - while (*curr_values != NULL) - { + { + gchar **curr_values; + + for (curr_values = values; *curr_values != NULL; curr_values++) keybind_cmd_bind (keymap, *curr_values, action); - curr_values++; - } + } g_strfreev (values); }