Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

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

 



On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:

>> +       repo_set_commondir(repo, o->shared_root);
>
> The repo_set_gitdir() prototype (below) makes it seem as if the last
> argument ('o', in this case) is optional, presumably by passing in
> NULL, however, this code does not appear to be prepared to deal with
> NULL.

I know. I went this this struct because I really hate to write lots of
NULL without names

    repo_set_gitdir(gitdir, NULL, NULL, NULL, ...);

but I could not find a nicer way to make the whole struct optional,
not without repeating more code or using preprocessor. Given that this
function has 3-4 call sites max, I think it's still ok.

>
>> +       expand_base_dir(&repo->objects.objectdir, o->object_dir,
>> +                       repo->commondir, "objects");
>> +       expand_base_dir(&repo->graft_file, o->graft_file,
>> +                       repo->commondir, "info/grafts");
>> +       expand_base_dir(&repo->index_file, o->index_file,
>> +                       repo->gitdir, "index");
>>  }
-- 
Duy



[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