Re: [PATCH v2 1/6] remote: fix tear down of struct branch and struct remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/18/2025 4:20 AM, Junio C Hamano wrote:
> Junio C Hamano <gitster@xxxxxxxxx> writes:
> 
>> Jacob Keller <jacob.e.keller@xxxxxxxxx> writes:
>>
>>> We initialize branch->merge with set_merge() which is called by
>>> branch_get() and which is the only way for callers external to remote.c
>>> of getting a branch structure.
>>>
>>> The issue is that merge_nr can be non-zero because if no caller has done
>>> a branch_get() on the given branch, we still have merge_nr is non-zero
>>> and merge is NULL.
>>
>> Meaning merge_nr and merge are both uninitialized and unlikely to be
>> 0 and NULL?  What values do they have, and if they are left
>> uninitialized, shouldn't we be initializing them to predictable
>> values?
> 
> Ah, no, I was just being stupid.
> 
> We read configuration files and accumulate things in .merge_name[]
> while incrementing .merge_nr but until set_merge() is called, .merge
> is NULL.  We need to clear .merge[] only when it is not NULL, of
> course.  And for that, it may be more readable if we had two loops.
> 
> Thanks.
> 
> 
> 

Right. I think I like my solution of just eliminating merge_names
entirely. Unfortunately it looks like my mailer marked that content as
quoted when I pasted it in as an inline diff.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux