[geany/geany] dfc550: More robust fix for uninitialized BuildDestination::dst

Nick Treleaven git-noreply at xxxxx
Sat Oct 5 11:31:09 UTC 2019


Branch:      refs/heads/build-exec
Author:      Nick Treleaven <n at trelsoft.com>
Committer:   Nick Treleaven <n at trelsoft.com>
Date:        Sat, 05 Oct 2019 11:31:09 UTC
Commit:      dfc55085a01d983f525d2ebabdc4cfc812e53713
             https://github.com/geany/geany/commit/dfc55085a01d983f525d2ebabdc4cfc812e53713

Log Message:
-----------
More robust fix for uninitialized BuildDestination::dst


Modified Paths:
--------------
    src/build.c

Modified: src/build.c
17 lines changed, 2 insertions(+), 15 deletions(-)
===================================================================
@@ -2233,20 +2233,14 @@ static gboolean build_read_commands(BuildDestination *dst, BuildTableData table_
 
 void build_read_project(GeanyFiletype *ft, BuildTableData build_properties)
 {
-	BuildDestination menu_dst;
+	BuildDestination menu_dst = {0};
 
 	if (ft != NULL)
 	{
 		menu_dst.dst[GEANY_GBG_FT] = &(ft->priv->projfilecmds);
 		menu_dst.dst[GEANY_GBG_EXEC] = &ft->priv->projexeccmds;
 		menu_dst.fileregexstr = &(ft->priv->projerror_regex_string);
 	}
-	else
-	{
-		menu_dst.dst[GEANY_GBG_FT] = NULL;
-		menu_dst.dst[GEANY_GBG_EXEC] = NULL;
-		menu_dst.fileregexstr = NULL;
-	}
 	menu_dst.dst[GEANY_GBG_NON_FT] = &non_ft_proj;
 	menu_dst.dst[GEANY_GBG_EXEC_IND] = &exec_proj;
 	menu_dst.nonfileregexstr = &regex_proj;
@@ -2263,7 +2257,6 @@ static void show_build_commands_dialog(void)
 	const gchar *title = _("Set Build Commands");
 	gint response;
 	BuildTableData table_data;
-	BuildDestination prefdsts;
 
 	if (doc != NULL)
 		ft = doc->file_type;
@@ -2278,20 +2271,14 @@ static void show_build_commands_dialog(void)
 	/* run modally to prevent user changing idx filetype */
 	response = gtk_dialog_run(GTK_DIALOG(dialog));
 
+	BuildDestination prefdsts = {0};
 	prefdsts.dst[GEANY_GBG_NON_FT] = &non_ft_pref;
-	prefdsts.dst[GEANY_GBG_EXEC_IND] = NULL;
 	if (ft != NULL)
 	{
 		prefdsts.dst[GEANY_GBG_FT] = &(ft->priv->homefilecmds);
 		prefdsts.fileregexstr = &(ft->priv->homeerror_regex_string);
 		prefdsts.dst[GEANY_GBG_EXEC] = &(ft->priv->homeexeccmds);
 	}
-	else
-	{
-		prefdsts.dst[GEANY_GBG_FT] = NULL;
-		prefdsts.fileregexstr = NULL;
-		prefdsts.dst[GEANY_GBG_EXEC] = NULL;
-	}
 	prefdsts.nonfileregexstr = &regex_pref;
 	if (build_read_commands(&prefdsts, table_data, response) && ft != NULL)
 		filetypes_save_commands(ft);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list