[geany/geany-plugins] 58f493: Workbench: Initialize loop variables for cppcheck

Enrico Tröger git-noreply at xxxxx
Sun Oct 1 22:45:27 UTC 2017


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 01 Oct 2017 22:45:27 UTC
Commit:      58f493ba7c300586bf4a7182ccdb33b9c6e4c4a2
             https://github.com/geany/geany-plugins/commit/58f493ba7c300586bf4a7182ccdb33b9c6e4c4a2

Log Message:
-----------
Workbench: Initialize loop variables for cppcheck


Modified Paths:
--------------
    workbench/src/sidebar.c
    workbench/src/utils.c
    workbench/src/wb_project.c

Modified: workbench/src/sidebar.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -95,7 +95,7 @@ static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList
 {
 	GSList *dir_list = NULL;
 	GSList *file_list = NULL;
-	GSList *elem;
+	GSList *elem = NULL;
 	gchar **path_arr;
 
 	foreach_slist (elem, leaf_list)
@@ -230,7 +230,7 @@ static void sidebar_insert_project_directory(WB_PROJECT *prj, WB_PROJECT_DIR *di
 {
 	GSList *lst = NULL;
 	GSList *path_list = NULL;
-	GSList *elem;
+	GSList *elem = NULL;
 	GHashTableIter iter;
 	gpointer key, value;
 	gchar *abs_base_dir;
@@ -267,7 +267,7 @@ static void sidebar_insert_project_directories (WB_PROJECT *project, GtkTreeIter
 {
 	GtkTreeIter iter;
 	GIcon *icon;
-	GSList *elem, *dirs;
+	GSList *elem = NULL, *dirs;
 
 	if (project == NULL)
 	{


Modified: workbench/src/utils.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -72,7 +72,7 @@ gchar *get_relative_path(const gchar *utf8_parent, const gchar *utf8_descendant)
  **/
 gboolean patterns_match(GSList *patterns, const gchar *str)
 {
-	GSList *elem;
+	GSList *elem = NULL;
 	foreach_slist (elem, patterns)
 	{
 		GPatternSpec *pattern = elem->data;


Modified: workbench/src/wb_project.c
17 lines changed, 9 insertions(+), 8 deletions(-)
===================================================================
@@ -535,7 +535,7 @@ static gint wb_project_dir_comparator(WB_PROJECT_DIR *a, WB_PROJECT_DIR *b)
 /* Get the file count of a project */
 static guint wb_project_get_file_count(WB_PROJECT *prj)
 {
-	GSList *elem;
+	GSList *elem = NULL;
 	guint filenum = 0;
 
 	foreach_slist(elem, prj->directories)
@@ -553,7 +553,7 @@ static guint wb_project_dir_rescan_int(WB_PROJECT *prj, WB_PROJECT_DIR *root)
 	GSList *ignored_file_list = NULL;
 	GHashTable *visited_paths;
 	GSList *lst;
-	GSList *elem;
+	GSList *elem = NULL;
 	guint filenum = 0;
 	gchar *searchdir;
 
@@ -717,7 +717,7 @@ guint wb_project_dir_rescan(WB_PROJECT *prj, WB_PROJECT_DIR *root)
  **/
 void wb_project_rescan(WB_PROJECT *prj)
 {
-	GSList *elem;
+	GSList *elem = NULL;
 	guint filenum = 0;
 
 	if (!prj)
@@ -772,7 +772,7 @@ gboolean wb_project_dir_file_is_included(WB_PROJECT_DIR *dir, const gchar *filen
  **/
 gboolean wb_project_file_is_included(WB_PROJECT *prj, const gchar *filename)
 {
-	GSList *elem;
+	GSList *elem = NULL;
 
 	if (prj == NULL)
 	{
@@ -793,7 +793,7 @@ gboolean wb_project_file_is_included(WB_PROJECT *prj, const gchar *filename)
 static gboolean add_tm_idle(gpointer foo)
 {
 	WB_PROJECT *prj;
-	GSList *elem2;
+	GSList *elem2 = NULL;
 
 	prj = (WB_PROJECT *)foo;
 	if (prj == NULL || prj->s_idle_add_funcs == NULL)
@@ -803,7 +803,7 @@ static gboolean add_tm_idle(gpointer foo)
 
 	foreach_slist (elem2, prj->s_idle_add_funcs)
 	{
-		GSList *elem;
+		GSList *elem = NULL;
 		gchar *utf8_fname = elem2->data;
 
 		foreach_slist (elem, prj->directories)
@@ -851,7 +851,7 @@ void wb_project_add_single_tm_file(WB_PROJECT *prj, const gchar *filename)
 static gboolean remove_tm_idle(gpointer foo)
 {
 	WB_PROJECT *prj;
-	GSList *elem2;
+	GSList *elem2 = NULL;
 
 	prj = (WB_PROJECT *)foo;
 	if (prj == NULL || prj->s_idle_remove_funcs == NULL)
@@ -861,7 +861,8 @@ static gboolean remove_tm_idle(gpointer foo)
 
 	foreach_slist (elem2, prj->s_idle_remove_funcs)
 	{
-		GSList *elem;
+
+		GSList *elem = NULL;
 		gchar *utf8_fname = elem2->data;
 
 		foreach_slist (elem, prj->directories)



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