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)

@codebrainz @elextr 
BTW I wrote the macros not to 'save a line or two of code' but to encapsulate 
iteration so when seeing the macro invocation you know there are no bugs in 
iteration (that was the intent anyway).

I accept the counter-argument that things like array iteration are simple and a 
custom macro is a geany-specific thing to learn, and it could possibly make 
debugging more confusing if the macro was passed a wrongly typed parameter.

But what about things that people often get wrong, like not checking 
`doc->is_valid`, I think the `foreach_document` macro is worth having. 
`is_valid` *is* a Geany-specific thing, so it's easy to justify a macro here. 
Sure, make it upper-case though.

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

Reply via email to