Subject: Re: [PATCH v4 4/7] t-reftable-merged: improve the const-correctness of helper functions

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 24 Jul 2024 11:12:04 +0200

On Fri, Jul 12, 2024 at 11:09:00AM +0530, Chandra Pratap wrote:
> In t-reftable-merged.c, a number of helper functions used by the
> tests can be re-defined with parameters made 'const' which makes
> it easier to understand if they're read-only or not. Re-define
> these functions along these lines.
> 
> Mentored-by: Patrick Steinhardt <[email-masked]>
> Mentored-by: Christian Couder <[email-masked]>
> Signed-off-by: Chandra Pratap <[email-masked]>
> ---
>  t/unit-tests/t-reftable-merged.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c
> index f4c14c5d47..ff2f448bb6 100644
> --- a/t/unit-tests/t-reftable-merged.c
> +++ b/t/unit-tests/t-reftable-merged.c
> @@ -15,7 +15,7 @@ license that can be found in the LICENSE file or at
>  #include "reftable/reftable-merged.h"
>  #include "reftable/reftable-writer.h"
>  
> -static ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
> +static ssize_t strbuf_add_void(void *b, const void *data, const size_t sz)

It is quite uncustomary for the Git codebase to mark such plain values
as `const`. While there is value in marking pointers as constant such
that the caller knows that the data it points to won't get modified,
there isn't really any value in marking pass-by-value parameters.

As far as I can see all changes relate to pass-by-value parameters, so
I'd rather drop this patch.

Patrick