[Github-comments] [geany/geany] build.c: Remove g_ptr_array_foreach with gpointer user_data & update HACKING (#2270)

Nick Treleaven notifications at xxxxx
Thu Aug 29 16:21:55 UTC 2019


ntrel commented on this pull request.



> @@ -2577,15 +2565,20 @@ void build_save_menu(GKeyFile *config, gpointer ptr, GeanyBuildSource src)
 				g_key_file_remove_key(config, build_grp_name, "error_regex", NULL);
 			if (pj->priv->build_filetypes_list != NULL)
 			{
-				data.config = config;
-				data.ft_names = g_ptr_array_new();
-				g_ptr_array_foreach(pj->priv->build_filetypes_list, foreach_project_filetype, (gpointer)(&data));
-				if (data.ft_names->pdata != NULL)
+				GPtrArray *ft_names = g_ptr_array_new();
+				guint i;
+				
+				foreach_ptr_array(ft, i, pj->priv->build_filetypes_list)

> it needs to be discoverable and documented, or people will only find it by accident reading existing code

Yes, that's why the `documents` macro has always mentioned it:

> * @see documents_array(). */
> #define documents ((GeanyDocument **)GEANY(documents_array)->pdata)

`documents_array` itself doesn't seem to be documented.

> For example what does it do if the set of documents is changed by the user?

It's undefined and not documented. I think it's to be expected that iterator invalidation is not handled by the macro.

-- 
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/pull/2270#discussion_r319159445
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190829/dda8331d/attachment.html>


More information about the Github-comments mailing list