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

elextr notifications at xxxxx
Sat Aug 24 08:30:47 UTC 2019


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

@ntrel, agree there is some argument for the document loop one, since there isn't any really obvious solution to the `is_valid` thing.  (Aside, I thought the point of document IDs was to avoid dangling pointers, but my memory is a bit hazy and I don't have time just now to revise at this instant)

But if `FOREACH_DOCUMENT` is kept somehow it needs to be discoverable and documented, or people will only find it by accident reading existing code.  For example what does it do if the set of documents is changed by the user? Or is that just documented "don't do that"?

But for the others, I agree with @codebrainz that since most contributors to Geany don't work on it constantly, using standard C is most likely to be understood.

-- 
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_r317350293
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190824/d539f06c/attachment.html>


More information about the Github-comments mailing list