Re: [PATCH 4/5] pack-write: pass hash_algo to `write_rev_file()`

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

 



On Thu, Jan 16, 2025 at 12:35:16PM +0100, Karthik Nayak via B4 Relay wrote:
> From: Karthik Nayak <karthik.188@xxxxxxxxx>
> 
> The `write_rev_file()` function uses the global `the_hash_algo` variable
> to access the repository's hash function. To avoid global variable
> usage, let's pass the hash function from the layers above.
> 
> Altough the layers above could have access to the hash function
> internally, simply pass in `the_hash_algo`. This avoids any
> compatibility issues and bubbles up global variable usage to upper
> layers which can be eventually resolved.
> 
> However, in `midx-write.c`, since all usage of global variables is
> removed, don't reintroduce them and instead use the `repo` available in
> the context.

Yeah, this feels quite sensible. We know this file is supposedly
`the_repository`-clean, and callers expect it to be, so reintroducing it
wouldn't be sensible.

Patrick




[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