Subject: Re: [PATCH 03/10] reftable/reader: rename `reftable_new_reader()`

From: Junio C Hamano <[email-masked]>
Date: Thu, 22 Aug 2024 12:09:33 -0700

Justin Tobler <[email-masked]> writes:

> On 24/08/19 05:39PM, Patrick Steinhardt wrote:
>> Rename the `reftable_new_reader()` function to `reftable_reader_new()`
>> to match our coding guidelines.
>> 
>> Signed-off-by: Patrick Steinhardt <[email-masked]>
>> ---
> [snip]  
>> -int init_reader(struct reftable_reader *r, struct reftable_block_source *source,
>> +int reader_init(struct reftable_reader *r, struct reftable_block_source *source,
>>  		const char *name);
>
> Here we also rename `init_reader()` to `reader_init()`, but do not
> update its call sites resulting in build errors. Since we remove this in
> the next patch anyway, let's drop this change.

True.  The actual definition of the function is also left
unmodified.  Let me locally edit the hunk out.  As you pointed out,
the next step does mention the "new" name in order to remove it, so
there needs a cascading adjustment there, but the fallout is fairly
small (see the attached range-diff).

Thanks.

 1:  348438a69e =  1:  348438a69e reftable/blocksource: drop malloc block source
 2:  ed8bb0e345 =  2:  ed8bb0e345 reftable/stack: inline `stack_compact_range_stats()`
 3:  80cf24d54f !  3:  6b5466771c reftable/reader: rename `reftable_new_reader()`
    @@ reftable/reader.c: int reftable_reader_print_blocks(const char *tablename)
      		goto done;

    - ## reftable/reader.h ##
    -@@ reftable/reader.h: struct reftable_reader {
    - 	struct reftable_reader_offsets log_offsets;
    - };
    - 
    --int init_reader(struct reftable_reader *r, struct reftable_block_source *source,
    -+int reader_init(struct reftable_reader *r, struct reftable_block_source *source,
    - 		const char *name);
    - void reader_close(struct reftable_reader *r);
    - const char *reader_name(struct reftable_reader *r);
    -
      ## reftable/readwrite_test.c ##
     @@ reftable/readwrite_test.c: static void test_write_empty_table(void)
      
 4:  ce93c128f5 !  4:  bc1eeb32ef reftable/reader: inline `init_reader()`
    @@ reftable/reader.h: struct reftable_reader {
      	struct reftable_reader_offsets log_offsets;
      };
      
    --int reader_init(struct reftable_reader *r, struct reftable_block_source *source,
    +-int init_reader(struct reftable_reader *r, struct reftable_block_source *source,
     -		const char *name);
      void reader_close(struct reftable_reader *r);
      const char *reader_name(struct reftable_reader *r);
 5:  079a3d365e =  5:  3e244b036a reftable/reader: inline `reader_close()`
 6:  7e951256c6 =  6:  41c537e44b reftable/stack: fix broken refnames in `write_n_ref_tables()`
 7:  8e99330cff =  7:  b7596c4c32 reftable/reader: introduce refcounting
 8:  2383c196a6 =  8:  9f28628ecc reftable/reader: keep readers alive during iteration
 9:  8af7c4485f =  9:  51df76889c reftable/stack: reorder swapping in the reloaded stack contents
10:  1ccdac05ab = 10:  32bbcc46b9 reftable/stack: fix segfault when reload with reused readers fails