git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 3/7] reftable: check for trailing newline in 'tables.list'

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 6, 2025, 12:02 UTC
Message-ID
<CAOLa=ZT48BV5Xs8R0Mwi1tpMHKC1jrR8AGScHHAq37xU4_UpOw@mail.gmail.com>
In-Reply-To
<aN5lmEx7Q57YEyHH@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 16 quoted lines
> On Fri, Sep 26, 2025 at 09:25:46AM +0200, Karthik Nayak wrote:
>> diff --git a/reftable/basics.c b/reftable/basics.c
>> index 9988ebd635..e969927b61 100644
>> --- a/reftable/basics.c
>> +++ b/reftable/basics.c
>> @@ -195,44 +195,55 @@ size_t names_length(const char **names)
>>  	return p - names;
>>  }
>>
>> -char **parse_names(char *buf, int size)
>> +int parse_names(char *buf, int size, char ***out)
>>  {
>
> Yup, this changed function signature reads a lot nicer to me now and is
> more in line with our usual coding style.
>

I have to agree with that. It would be so much nicer, if we could return (value, err) in C. Anyways this seems a lot more consistent.

Show 19 quoted lines
>> diff --git a/reftable/basics.h b/reftable/basics.h
>> index 7d22f96261..693db9524f 100644
>> --- a/reftable/basics.h
>> +++ b/reftable/basics.h
>> @@ -167,10 +167,9 @@ void free_names(char **a);
>>
>>  /*
>>   * Parse a newline separated list of names. `size` is the length of the buffer,
>> - * without terminating '\0'. Empty names are discarded. Returns a `NULL`
>> - * pointer when allocations fail.
>> + * without terminating '\0'. Empty names are discarded.
>>   */
>> -char **parse_names(char *buf, int size);
>> +int parse_names(char *buf, int size, char ***out);
>
> Tiny nit, not worth a reroll: we may still want to document that a
> return value of 0 means success, and that it otherwise returns a
> reftable error code.
>
Yes, I'll add that in my re-roll.
> Patrick
Previous: Patrick SteinhardtNext: Karthik Nayak
Message 6 of 14 in “refs/reftable: add consistency checks”
  1. 0/7 refs/reftable: add consistency checksKarthik Nayak, Sep 26, 2025
  2. 1/7 refs: remove unused headersKarthik Nayak, Sep 26, 2025
  3. 2/7 refs: move consistency check msg to generic layerKarthik Nayak, Sep 26, 2025
  4. 3/7 reftable: check for trailing newline in 'tables.list'Karthik Nayak, Sep 26, 2025
  5. Patrick SteinhardtOct 2, 2025
  6. Karthik NayakOct 6, 2025
  7. 4/7 Documentation/fsck-msgids: remove duplicate msg idKarthik Nayak, Sep 26, 2025
  8. 5/7 fsck: order 'fsck_msg_type' alphabeticallyKarthik Nayak, Sep 26, 2025
  9. 6/7 reftable: add code to facilitate consistency checksKarthik Nayak, Sep 26, 2025
  10. Patrick SteinhardtOct 2, 2025
  11. 7/7 refs/reftable: add fsck check for checking the table nameKarthik Nayak, Sep 26, 2025
  12. Patrick SteinhardtOct 2, 2025
  13. Karthik NayakOct 6, 2025
  14. Junio C HamanoSep 26, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.