From: Ben Peart Date: Mon, 28 Aug 2017 22:45:29 GMT Subject: Re: [PATCH 2/3] merge-recursive: remove return value from get_files_dirs Message-ID: <8f1a7139-6f5b-eb47-ecb6-ded1d550b06a@gmail.com> In-Reply-To: <20170828202829.3056-3-kewillf@microsoft.com> On 8/28/2017 4:28 PM, Kevin Willford wrote: > The return value of the get_files_dirs call is never being used. > Looking at the history of the file and it was originally only > being used for debug output statements. Also when > read_tree_recursive return value is non zero it is changed to > zero. This leads me to believe that it doesn't matter if > read_tree_recursive gets an error. > > Since the debug output has been removed and the caller isn't > checking the return value there is no reason to keep calulating > and returning a value. > Did a quick search and you're right, nothing is using the return value. No reason to spend time calculating it. Looks good. > Signed-off-by: Kevin Willford > --- > merge-recursive.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/merge-recursive.c b/merge-recursive.c > index 033d7cd406..d47f40ea81 100644 > --- a/merge-recursive.c > +++ b/merge-recursive.c > @@ -328,15 +328,11 @@ static int save_files_dirs(const unsigned char *sha1, > return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0); > } > > -static int get_files_dirs(struct merge_options *o, struct tree *tree) > +static void get_files_dirs(struct merge_options *o, struct tree *tree) > { > - int n; > struct pathspec match_all; > memset(&match_all, 0, sizeof(match_all)); > - if (read_tree_recursive(tree, "", 0, 0, &match_all, save_files_dirs, o)) > - return 0; > - n = o->current_file_set.nr + o->current_directory_set.nr; > - return n; > + read_tree_recursive(tree, "", 0, 0, &match_all, save_files_dirs, o); > } > > /* >