mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
reftable: check for trailing newline in 'tables.list'
In the reftable format, the 'tables.list' file contains a newline separated list of tables. While we parse this file, we do not check or care about the last newline. Tighten the parser in `parse_names()` to return an appropriate error if the last newline is missing. This requires modification to `parse_names()` to now return the error while accepting the output as a third argument. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
1ef32f0989
commit
f644206377
@@ -167,10 +167,11 @@ 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.
|
||||
*
|
||||
* Returns 0 on success, a reftable error code on error.
|
||||
*/
|
||||
char **parse_names(char *buf, int size);
|
||||
int parse_names(char *buf, int size, char ***out);
|
||||
|
||||
/* compares two NULL-terminated arrays of strings. */
|
||||
int names_equal(const char **a, const char **b);
|
||||
|
||||
Reference in New Issue
Block a user