Re: [PATCH v7 3/7] progress.c tests: make start/stop commands on stdin

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

 



On Mon, Dec 27 2021, Johannes Altmanninger wrote:

[Will reply to the rest later, thanks for the review...]

> On Fri, Dec 17, 2021 at 05:24:58AM +0100, Ævar Arnfjörð Bjarmason wrote:
> [...]
>>  int cmd__progress(int argc, const char **argv)
>>  {
>> -	int total = 0;
>> -	const char *title;
>> +	const char *const default_title = "Working hard";
>> +	struct string_list titles = STRING_LIST_INIT_DUP;
>>  	struct strbuf line = STRBUF_INIT;
>> -	struct progress *progress;
>> +	struct progress *progress = NULL;
>>  
>>  	const char *usage[] = {
>> -		"test-tool progress [--total=<n>] <progress-title>",
>> +		"test-tool progress <stdin",
>>  		NULL
>
> (unrelated: I'd always add a trailing comma if I can, even though in this case it won't ever matter)

FWIW this bit is intentional coding style in git.git, see Junio's
https://lore.kernel.org/git/xmqqk0g5656r.fsf@gitster.g/:
    
    It is a good idea to leave a comma even after the last element,
    _unless_ there is a strong reason why the element that currently is
    at the last MUST stay to be last when new elements are added[...]

Well, in that case he's talking about enums, but the same applies even
more to these sorts of lists here the NULL must remain the last element.
    




[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