[geany/geany-plugins] 2149e3: Fixed unnecessary NULL pointer checks on call to 'g_free()'.

LarsDW223 git-noreply at xxxxx
Thu Oct 12 19:58:37 UTC 2017


Branch:      refs/heads/master
Author:      LarsDW223 <lars_paulsen at web.de>
Committer:   LarsDW223 <lars_paulsen at web.de>
Date:        Sun, 18 Jun 2017 09:24:04 UTC
Commit:      2149e3fb4fd9dc43b28747a25c8ad0ff4e60196c
             https://github.com/geany/geany-plugins/commit/2149e3fb4fd9dc43b28747a25c8ad0ff4e60196c

Log Message:
-----------
Fixed unnecessary NULL pointer checks on call to 'g_free()'.


Modified Paths:
--------------
    pretty-printer/src/ConfigUI.c

Modified: pretty-printer/src/ConfigUI.c
10 lines changed, 2 insertions(+), 8 deletions(-)
===================================================================
@@ -119,10 +119,7 @@ fetchSettingsFromConfigUI(PrettyPrintingOptions* ppo)
     ppo->indentChar = gtk_combo_box_get_active(GTK_COMBO_BOX(indentationChar))==0 ? '\t' : ' ';
 
     breakStyle = gtk_combo_box_get_active(GTK_COMBO_BOX(lineBreak));
-    if (ppo->newLineChars != NULL)
-    {
-        g_free ((gpointer)ppo->newLineChars);
-    }
+    g_free ((gpointer)ppo->newLineChars);
     if (breakStyle == 0) ppo->newLineChars = g_strdup("\r");
     else if (breakStyle == 1) ppo->newLineChars = g_strdup("\n");
     else ppo->newLineChars = g_strdup("\r\n");
@@ -183,10 +180,7 @@ prefsFromData (PrettyPrintingOptions* ppo,
 
     if (g_key_file_has_key (kf, "pretty-printer", "newLineChars", NULL))
     {
-        if (ppo->newLineChars != NULL )
-        {
-            g_free ((gpointer)ppo->newLineChars);
-        }
+        g_free ((gpointer)ppo->newLineChars);
         ppo->newLineChars = g_key_file_get_string (kf, "pretty-printer", "newLineChars", error);
     }
     if (g_key_file_has_key (kf, "pretty-printer", "indentChar", NULL))



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list