Re: [PATCH v3 09/20] global: introduce `USE_THE_REPOSITORY_VARIABLE` macro

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

 



Patrick Steinhardt <ps@xxxxxx> writes:

> Use of the `the_repository` variable is deprecated nowadays, and we
> slowly but steadily convert the codebase to not use it anymore. Instead,
> callers should be passing down the repository to work on via parameters.
>
> It is hard though to prove that a given code unit does not use this
> variable anymore. The most trivial case, merely demonstrating that there
> is no direct use of `the_repository`, is already a bit of a pain during
> code reviews as the reviewer needs to manually verify claims made by the
> patch author. The bigger problem though is that we have many interfaces
> that implicitly rely on `the_repository`.
>
> Introduce a new `USE_THE_REPOSITORY_VARIABLE` macro that allows code
> units to opt into usage of `the_repository`. The intent of this macro is
> to demonstrate that a certain code unit does not use this variable
> anymore, and to keep it from new dependencies on it in future changes,
> be it explicit or implicit
>
> For now, the macro only guards `the_repository` itself as well as
> `the_hash_algo`. There are many more known interfaces where we have an
> implicit dependency on `the_repository`, but those are not guarded at
> the current point in time. Over time though, we should start to add
> guards as required (or even better, just remove them).
>
> Define the macro as required in our code units. As expected, most of our
> code still relies on the global variable. Nearly all of our builtins
> rely on the variable as there is no way yet to pass `the_repository` to
> their entry point. For now, declare the macro in "biultin.h" to keep the

s/biultin.h/builtin.h

[snip]

> diff --git a/hash.h b/hash.h
> index 39a0164be3..cb85d26a2f 100644
> --- a/hash.h
> +++ b/hash.h
> @@ -4,6 +4,8 @@
>  #include "hash-ll.h"
>  #include "repository.h"
>
> -#define the_hash_algo the_repository->hash_algo
> +#ifdef USE_THE_REPOSITORY_VARIABLE
> +# define the_hash_algo the_repository->hash_algo

s/# define/#define/

Attachment: signature.asc
Description: PGP signature


[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