Subject: Re: [PATCH v7 00/16] Reftable coverity fixes

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 24 Jan 2022 20:48:54 +0100

On Mon, Jan 24 2022, Han-Wen Nienhuys via GitGitGadget wrote:

> This series was targeted to 'master'.
>
> This addresses some complaints from Coverity that Peff reported.
>
> v7:
>
>  * address avarab's comments.

Thanks. I just had time to skim it now but this overall LGTM. I noted a
compilation error on xlc in another reply that I'm sorry I didn't test
before, but provided a hopefully easy fix for.

>      @@ reftable/record.c: static int reftable_ref_record_equal_void(const void *a,
>       +static void reftable_ref_record_print_void(const void *rec,
>       +					   int hash_size)
>       +{
>      -+	reftable_ref_record_print_sz((struct reftable_ref_record *) rec, hash_size);
>      ++	reftable_ref_record_print_sz(
>      ++		(struct reftable_ref_record *) rec, hash_size);
>       +}
>       +

Just a nit, and only noting this since you seemed to be adjusting your
clang-format settings (or so I recall), but I think the more usual
wrapping in the codebase is:
    
    diff --git a/reftable/record.c b/reftable/record.c
    index 8330b7a2589..ee42897460d 100644
    --- a/reftable/record.c
    +++ b/reftable/record.c
    @@ -464,8 +464,8 @@ static int reftable_ref_record_equal_void(const void *a,
     static void reftable_ref_record_print_void(const void *rec,
                                               int hash_size)
     {
    -       reftable_ref_record_print_sz(
    -               (struct reftable_ref_record *) rec, hash_size);
    +       reftable_ref_record_print_sz((struct reftable_ref_record *)rec,
    +                                    hash_size);
     }
     
     static struct reftable_record_vtable reftable_ref_record_vtable = {

I.e. to "keep going" with the initial line until we hit 79 characters,
and then wrap it. Then for casts "(x *)y" rather than "(x *) y".