Skip to content

Commit 754e4a6

Browse files
Seija KijinAZero13
authored andcommitted
git: use signed loop counters when comparing with signed vars
The compiler (at least LLVM) treats them better anyway because of the C standard not defining signed overflow. Signed-off-by: Seija Kijin <[email protected]>
1 parent d882f38 commit 754e4a6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ static int get_untracked_files(struct repository *r,
848848
const struct pathspec *ps)
849849
{
850850
struct dir_struct dir = { 0 };
851-
size_t i;
851+
int i;
852852
struct strbuf buf = STRBUF_INIT;
853853

854854
if (repo_read_index(r) < 0)

bloom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static int has_entries_with_high_bit(struct repository *r, struct tree *t)
314314

315315
init_tree_desc(&desc, &t->object.oid, t->buffer, t->size);
316316
while (tree_entry(&desc, &entry)) {
317-
size_t i;
317+
int i;
318318
for (i = 0; i < entry.pathlen; i++) {
319319
if (entry.path[i] & 0x80) {
320320
t->object.flags |= HIGH_BITS;

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ int cmd_main(int argc, const char **argv)
946946
*/
947947
setup_path();
948948

949-
for (size_t i = 0; i < argc; i++)
949+
for (int i = 0; i < argc; i++)
950950
strvec_push(&args, argv[i]);
951951

952952
while (1) {

0 commit comments

Comments
 (0)