Re: [PATCH] range-diff: fix some 'hdr-check' and sparse warnings
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jul 12, 2019, 05:21 UTC
- Message-ID
- <41a60e60-d2c0-7d54-5456-e44d106548a4@kdbg.org>
- In-Reply-To
- <e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com>
Am 12.07.19 um 00:03 schrieb Ramsay Jones:
Show 10 quoted lines
> diff --git a/range-diff.c b/range-diff.c
> index ba1e9a4265..0f24a4ad12 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -102,7 +102,7 @@ static int read_patches(const char *range, struct string_list *list)
> }
>
> if (starts_with(line, "diff --git")) {
> - struct patch patch = { 0 };
> + struct patch patch = { NULL };There is nothing wrong with 0 here. IMHO, zero-initialization should *always* be written as = { 0 } and nothing else. Changing 0 to NULL to pacify sparse encourages a wrong style.
-- Hannes