Skip to content

Commit 0e89cd0

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d1576dd commit 0e89cd0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ident.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static void strbuf_addstr_without_crud(struct strbuf *sb, const char *src)
272272
* can still be NULL if the input line only has the name/email part
273273
* (e.g. reading from a reflog entry).
274274
*/
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)
276276
{
277277
const char *cp;
278278
size_t span;

ident.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void reset_ident_date(void);
3535
* Signals an success with 0, but time part of the result may be NULL
3636
* if the input lacks timestamp and zone
3737
*/
38-
int split_ident_line(struct ident_split *, const char *, int);
38+
int split_ident_line(struct ident_split *, const char *, size_t);
3939

4040
/*
4141
* Given a commit or tag object buffer and the commit or tag headers, replaces

0 commit comments

Comments
 (0)