Просмотр исходного кода

Remove extra check before call mc_config_deinit()

...and minor cleanup of related code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 14 лет назад
Родитель
Сommit
4c0ba932a8
3 измененных файлов с 12 добавлено и 18 удалено
  1. 4 6
      lib/filehighlight/common.c
  2. 6 7
      lib/mcconfig/common.c
  3. 2 5
      lib/skin/common.c

+ 4 - 6
lib/filehighlight/common.c

@@ -116,13 +116,11 @@ mc_fhl_free (mc_fhl_t ** fhl)
 void
 mc_fhl_clear (mc_fhl_t * fhl)
 {
-    if (fhl == NULL)
-        return;
-
-    if (fhl->config)
+    if (fhl != NULL)
+    {
         mc_config_deinit (fhl->config);
-
-    mc_fhl_array_free (fhl);
+        mc_fhl_array_free (fhl);
+    }
 }
 
 /* --------------------------------------------------------------------------------------------- */

+ 6 - 7
lib/mcconfig/common.c

@@ -131,13 +131,12 @@ mc_config_init (const gchar * ini_path)
 void
 mc_config_deinit (mc_config_t * mc_config)
 {
-    if (!mc_config)
-        return;
-
-    g_free (mc_config->ini_path);
-    g_key_file_free (mc_config->handle);
-    g_free (mc_config);
-
+    if (mc_config != NULL)
+    {
+        g_free (mc_config->ini_path);
+        g_key_file_free (mc_config->handle);
+        g_free (mc_config);
+    }
 }
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

+ 2 - 5
lib/skin/common.c

@@ -149,7 +149,6 @@ mc_skin_init (GError ** error)
 void
 mc_skin_deinit (void)
 {
-
     g_free (mc_skin__default.name);
     mc_skin__default.name = NULL;
     g_hash_table_destroy (mc_skin__default.colors);
@@ -158,10 +157,8 @@ mc_skin_deinit (void)
     g_free (mc_skin__default.description);
     mc_skin__default.description = NULL;
 
-    if (mc_skin__default.config) {
-        mc_config_deinit (mc_skin__default.config);
-        mc_skin__default.config = NULL;
-    }
+    mc_config_deinit (mc_skin__default.config);
+    mc_skin__default.config = NULL;
 
     mc_skin_is_init = FALSE;
 }