Browse Source

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++)"
maint
Junio C Hamano 6 years ago
parent
commit
196afc439c
  1. 5
      contrib/coccinelle/preincr.cocci
  2. 2
      fsck.c

5
contrib/coccinelle/preincr.cocci

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
@ preincrement @
identifier i;
@@
- ++i > 1
+ i++

2
fsck.c

@ -485,7 +485,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio @@ -485,7 +485,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio
if (name) {
struct object *obj = &parents->item->object;

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

Loading…
Cancel
Save