Re: [PATCH v2 06/27] add: modify add_files_to_cache() to avoid globals

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

 



"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
> From: Elijah Newren <newren@xxxxxxxxx>
> 
> The function add_files_to_cache() is used by all three of builtin/{add,
> checkout, commit}.c.  That suggests this is common library code, and
> should be moved somewhere else, like read-cache.c.  However, the
> function and its helpers made use of two global variables that made
> straight code movement difficult:
>   * the_index
>   * include_sparse

I was checking that add_filer_to_cache() did not inadvertently use these
global variables even after the refactoring, and it looks good. It's a
pity that we can't remove the USE_THE_INDEX_VARIABLE #define even after
this patch (other parts in builtin/add.c use it), but I couldn't see
any more usages of the_index in that function. There is no more usage
of include_sparse, indeed, as can be seen from the next patch (when the
function is moved to another file that has no access to include_sparse
declared in builtin/add.c).
 



[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