Skip to content

Commit 132ceda

Browse files
avargitster
authored andcommitted
ls-tree: use "size_t", not "int" for "struct strbuf"'s "len"
The "struct strbuf"'s "len" member is a "size_t", not an "int", so let's change our corresponding types accordingly. This also changes the "len" and "speclen" variables, which are likewise used to store the return value of strlen(), which returns "size_t", not "int". Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 26f6d4d commit 132ceda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/ls-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static const char * const ls_tree_usage[] = {
3131
NULL
3232
};
3333

34-
static int show_recursive(const char *base, int baselen, const char *pathname)
34+
static int show_recursive(const char *base, size_t baselen, const char *pathname)
3535
{
3636
int i;
3737

@@ -43,7 +43,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
4343

4444
for (i = 0; i < pathspec.nr; i++) {
4545
const char *spec = pathspec.items[i].match;
46-
int len, speclen;
46+
size_t len, speclen;
4747

4848
if (strncmp(base, spec, baselen))
4949
continue;
@@ -65,7 +65,7 @@ static int show_tree(const struct object_id *oid, struct strbuf *base,
6565
const char *pathname, unsigned mode, void *context)
6666
{
6767
int retval = 0;
68-
int baselen;
68+
size_t baselen;
6969
enum object_type type = OBJ_BLOB;
7070

7171
if (S_ISGITLINK(mode)) {

0 commit comments

Comments
 (0)