On Mon, Nov 28, 2022 at 08:37:40PM +0800, Teng Long wrote: > > > @@ -559,11 +557,20 @@ static int open_midx_bitmap(struct repository *r, > > > static int open_bitmap(struct repository *r, > > > struct bitmap_index *bitmap_git) > > > { > > > + int found = 0; > > > + > > > assert(!bitmap_git->map); > > > > > > - if (!open_midx_bitmap(r, bitmap_git)) > > > - return 0; > > > - return open_pack_bitmap(r, bitmap_git); > > > + found = !open_midx_bitmap(r, bitmap_git); > > > > I think we can drop the initialization of "found = 0"; that value is > > unused, since we'll always assign to it (I think my initial attempt had > > setting it to 1 inside the conditional). > > > > It's not hurting anything functionally, but it makes the code slightly > > more confusing to read. > > I agree it's not hurting here, it's OK for me to make the improvement > here. But I have a question, do we prefer to omit the initialization > in such scenarios if we make sure it will initialized correctly? I don't know that we have a particular rule here, but I would say that yes, if you know the initialization isn't used, then skip it. That communicates the expectation to anybody reading the code. And if you're wrong, the compiler will generally notice. -Peff