Re: [PATCH v2 11/18] maintenance: auto-size incremental-repack batch

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

 



On 7/23/2020 7:24 PM, Junio C Hamano wrote:
> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:
> 
>> On Thu, Jul 23, 2020 at 6:15 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>> "Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>>>> +     struct strbuf batch_arg = STRBUF_INIT;
>>>> +
>>>> -     argv_array_push(&cmd, "--batch-size=0");
>>>> +     strbuf_addf(&batch_arg, "--batch-size=%"PRIuMAX,
>>>> +                 (uintmax_t)get_auto_pack_size());
>>>> +     argv_array_push(&cmd, batch_arg.buf);
>>>>
>>>> +     strbuf_release(&batch_arg);
>>>
>>> I think I saw a suggestion to use xstrfmt() with free()  instead of
>>> the sequence of strbuf_init(), strbuf_addf(), and strbuf_release()
>>> in a similar but different context.  Perhaps we should follow suit
>>> here, too?
>>
>> Perhaps I'm missing something obvious, but wouldn't argv_array_pushf()
>> be even simpler?
>>
>>     argv_array_pushf(&cmd, "--batch-size=%"PRIuMAX,
>>         (uintmax_t)get_auto_pack_size());
> 
> No, it was me who was missing an obvious and better alternative.

Today I learned about arv_array_push. Thanks!

-Stolee




[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