[Github-comments] [geany/geany-plugins] pretty-printer: added saving and loading of preferences in/from a file. Fixes #494. (#581)

Anthony Loiseau notifications at xxxxx
Sat Jun 17 15:40:59 UTC 2017


Thannoy commented on this pull request.



> @@ -118,9 +119,204 @@ void saveSettings(void)
     ppo->indentChar = gtk_combo_box_get_active(GTK_COMBO_BOX(indentationChar))==0 ? '\t' : ' ';
 
     breakStyle = gtk_combo_box_get_active(GTK_COMBO_BOX(lineBreak));
-    if (breakStyle == 0) ppo->newLineChars = "\r";
-    else if (breakStyle == 1) ppo->newLineChars = "\n";
-    else ppo->newLineChars = "\r\n";
+    if (ppo->newLineChars != NULL)
+    {
+        g_free ((gpointer)ppo->newLineChars);

(minor) freeing a NULL pointer is perfectly legal. There is no need to test nullity, you can use g_free unconditionally here. (see https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/581#pullrequestreview-44702661
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170617/1e4a925f/attachment.html>


More information about the Github-comments mailing list