ident: fix type of string length parameter

The last parameter in `split_ident_line()` is the length of the line passed in by the caller. As such, most callers pass in either the result of `strlen()`, `struct strbuf::len` or a pointer diff, all of which are expected to be positive numbers. Regardless of that, the function accepts a signed integer, which is somewhat confusing. Fix the function signature to instead accept a `size_t`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 6, 2025 at 07:54 UTC 9fdbba862dfa53cf347fd9f05e99bd1f13c5eb0c
2 files changed +2 -2
ident.c
+1 -1
@@ -272,7 +272,7 @@ static void strbuf_addstr_without_crud(struct strbuf *sb, const char *src)
272 * can still be NULL if the input line only has the name/email part
273 * (e.g. reading from a reflog entry).
274 */
275 -int split_ident_line(struct ident_split *split, const char *line, int len)
275 +int split_ident_line(struct ident_split *split, const char *line, size_t len)
276 {
277 const char *cp;
278 size_t span;
ident.h
+1 -1
@@ -35,7 +35,7 @@ void reset_ident_date(void);
35 * Signals an success with 0, but time part of the result may be NULL
36 * if the input lacks timestamp and zone
37 */
38 -int split_ident_line(struct ident_split *, const char *, int);
38 +int split_ident_line(struct ident_split *, const char *, size_t);
39
40 /*
41 * Given a commit or tag object buffer and the commit or tag headers, replaces