[Github-comments] [geany/geany-plugins] Workbench: fixed not closed file handles on directory scanning (thanks to techee). Fixes #607. (#608)

LarsGit223 notifications at xxxxx
Wed Oct 4 20:36:32 UTC 2017


LarsGit223 commented on this pull request.



> @@ -245,14 +248,17 @@ static GSList *wb_project_dir_get_file_list(WB_PROJECT_DIR *root, const gchar *u
 
 	g_hash_table_insert(visited_paths, real_path, GINT_TO_POINTER(1));
 
-	while (TRUE)
+	while ((child_name = g_dir_read_name(dir)))

Honestly I simply copied techee's code. I also don't like assignment's in while loops that much but I can live with it. I suggest the following code:
``` c
	while ((child_name = g_dir_read_name(dir)) != NULL)
	{
		children = g_slist_prepend(children, g_strdup(child_name));
	}
```
So we have the explicit ```NULL``` pointer check and the curly braces to make it more readable. If that fine for you two then I will apply that change.

-- 
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/608#discussion_r142785328
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20171004/41d1f29e/attachment.html>


More information about the Github-comments mailing list