[geany/geany-plugins] 61f4a5: Eliminate Yoda style conditions to match the style of the rest of the code

Jiří Techet git-noreply at xxxxx
Mon Apr 1 01:03:33 UTC 2019


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 14 Oct 2018 17:54:59 UTC
Commit:      61f4a51d69a31d62d05d7328e2a86f8888bd5c95
             https://github.com/geany/geany-plugins/commit/61f4a51d69a31d62d05d7328e2a86f8888bd5c95

Log Message:
-----------
Eliminate Yoda style conditions to match the style of the rest of the code


Modified Paths:
--------------
    projectorganizer/src/prjorg-sidebar.c
    projectorganizer/src/prjorg-utils.c

Modified: projectorganizer/src/prjorg-sidebar.c
16 lines changed, 8 insertions(+), 8 deletions(-)
===================================================================
@@ -387,7 +387,7 @@ static void on_create_file(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gp
 	gchar *dir, *name, *path;
 
 	dir = parent_dir_for_create();
-	if (NULL == dir)
+	if (dir == NULL)
 	{
 		return;
 	}
@@ -397,7 +397,7 @@ static void on_create_file(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gp
 	name = dialogs_show_input(_("New File"), GTK_WINDOW(geany->main_widgets->window),
 		_("Name:"), _("newfile.txt"));
 
-	if (NULL != name)
+	if (name != NULL)
 	{
 		path = g_build_path(G_DIR_SEPARATOR_S, dir, name, NULL);
 		g_free(name);
@@ -425,7 +425,7 @@ static void on_create_dir(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpo
 	gchar *dir, *name, *path;
 
 	dir = parent_dir_for_create();
-	if (NULL == dir)
+	if (dir == NULL)
 	{
 		return;
 	}
@@ -435,7 +435,7 @@ static void on_create_dir(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpo
 	name = dialogs_show_input(_("New Directory"), GTK_WINDOW(geany->main_widgets->window),
 		_("Name:"), _("newdir"));
 
-	if (NULL != name)
+	if (name != NULL)
 	{
 		path = g_build_path(G_DIR_SEPARATOR_S, dir, name, NULL);
 		g_free(name);
@@ -476,18 +476,18 @@ static void on_rename(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointe
 		return;
 	}
 	dir = build_path(&parent);
-	if (NULL == dir)
+	if (dir == NULL)
 	{
 		return;
 	}
 
 	gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1);
-	if (NULL != name)
+	if (name != NULL)
 	{
 		newname = dialogs_show_input(_("Rename"), GTK_WINDOW(geany->main_widgets->window),
 			_("New name:"), name);
 
-		if (NULL != newname)
+		if (newname != NULL)
 		{
 			oldpath = g_build_path(G_DIR_SEPARATOR_S, dir, name, NULL);
 			newpath = g_build_path(G_DIR_SEPARATOR_S, dir, newname, NULL);
@@ -1106,7 +1106,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent,
 		gchar **path_arr = elem->data;
 		GIcon *icon = NULL;
 
-		if (0 == g_strcmp0(PROJORG_SENTINEL_FILENAME, path_arr[level]))
+		if (g_strcmp0(PROJORG_SENTINEL_FILENAME, path_arr[level]) == 0)
 			continue;
 
 		gchar *content_type = g_content_type_guess(path_arr[level], NULL, 0, NULL);


Modified: projectorganizer/src/prjorg-utils.c
8 lines changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -128,7 +128,7 @@ gboolean create_file(gchar *utf8_name)
 	GError *err;
 
 	fd = g_open(utf8_name, O_CREAT|O_EXCL, 0660); // rw-rw----
-	if (-1 == fd) // not created?
+	if (fd == -1) // not created?
 	{
 		return FALSE;
 	}
@@ -139,13 +139,13 @@ gboolean create_file(gchar *utf8_name)
 
 gboolean create_dir(char *utf8_name)
 {
-	return 0 == g_mkdir_with_parents(utf8_name, 0770); // rwxrwx---
+	return g_mkdir_with_parents(utf8_name, 0770) == 0; // rwxrwx---
 }
 
 
 gboolean remove_file_or_dir(char *utf8_name)
 {
-	return 0 == g_remove(utf8_name);
+	return g_remove(utf8_name) == 0;
 }
 
 
@@ -177,7 +177,7 @@ gboolean rename_file_or_dir(gchar *utf8_oldname, gchar *utf8_newname)
 		res = g_rename(oldname, newname);
 		g_free(oldname);
 		g_free(newname);
-		return 0 == res;
+		return res == 0;
 	}
 }
 



--------------
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