Re: [PATCH 1/1] sparse-checkout: use extern for global variables

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

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
>
> When the core.sparseCheckoutCone config setting was added in
> 879321eb0b ("sparse-checkout: add 'cone' mode" 2019-11-21), the
> variables storing the config values for core.sparseCheckout and
> core.sparseCheckoutCone were rearranged in cache.h, but in doing
> so the "extern" keyword was dropped.
>
> While we are tending to drop the "extern" keyword for function
> declarations, it is still necessary for global variables used
> across multiple *.c files. The impact of not having the extern
> keyword may be unpredictable.

"May be unpredictable" might be a bit too strong, but I agree that
it is better not to rely on the "common extension" these days, and
instead make sure variable decls have "extern" in front.

Will queue.  Thanks.

> Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
> ---
>  cache.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cache.h b/cache.h
> index 1554488d66..cbfaead23a 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -958,8 +958,8 @@ extern int protect_hfs;
>  extern int protect_ntfs;
>  extern const char *core_fsmonitor;
>  
> -int core_apply_sparse_checkout;
> -int core_sparse_checkout_cone;
> +extern int core_apply_sparse_checkout;
> +extern int core_sparse_checkout_cone;
>  
>  /*
>   * Include broken refs in all ref iterations, which will



[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