Skip to content

Commit 196afc4

Browse files
committed
Merge branch 'jc/cocci-preincr' into maint
Code cleanup. * jc/cocci-preincr: fsck: s/++i > 1/i++/ cocci: simplify "if (++u > 1)" to "if (u++)"
2 parents eba1416 + b84c783 commit 196afc4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

contrib/coccinelle/preincr.cocci

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@ preincrement @
2+
identifier i;
3+
@@
4+
- ++i > 1
5+
+ i++

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio
485485
if (name) {
486486
struct object *obj = &parents->item->object;
487487

488-
if (++counter > 1)
488+
if (counter++)
489489
put_object_name(options, obj, "%s^%d",
490490
name, counter);
491491
else if (generation > 0)

0 commit comments

Comments
 (0)