codebrainz commented on this pull request.
> @@ -2291,6 +2291,22 @@ static void build_load_menu_grp(GKeyFile *config,
> GeanyBuildCommand **dst, gint
}
+/* set GeanyBuildCommand if it doesn't already exist and there is a command */
+static void assign_cmd(GeanyBuildCommand *type, guint id,
+ const gchar *label, gchar *value)
+{
+ if (!EMPTY(value) && ! type[GBO_TO_CMD(id)].exists)
+ {
+ type[GBO_TO_CMD(id)].exists = TRUE;
+ SETPTR(type[GBO_TO_CMD(id)].label, g_strdup(label));
+ SETPTR(type[GBO_TO_CMD(id)].command, value);
+ SETPTR(type[GBO_TO_CMD(id)].working_dir, NULL);
+ type[GBO_TO_CMD(id)].old = TRUE;
+ }
+ else
+ g_free(value);
IMO, the braceless dangling elses hurt readability and are [a trap for future
people editing the code](https://dwheeler.com/essays/apple-goto-fail.html), but
it seems perfectly reasonably to not change this one, since it's existing code
and IIRC there are many of them elsewhere in the code, so it would probably
make more sense to get them all at once in a separate PR that can get
bikeshedded over.
--
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/2256#discussion_r313952481