Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-21 16:58:08 +0300
committerJunio C Hamano <gitster@pobox.com>2018-11-21 16:58:08 +0300
commit196afc439c0eb4070ab6fe89b7d11748370dbffa (patch)
tree8759cbb508048172c9d27325266e64f95590ef29
parenteba14167f1354a0bbe2c7ec44d37f5a950b6a2f7 (diff)
parentb84c7838829f997e0a0028b678b7ae8f7a21cc62 (diff)
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++)"
-rw-r--r--contrib/coccinelle/preincr.cocci5
-rw-r--r--fsck.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/contrib/coccinelle/preincr.cocci b/contrib/coccinelle/preincr.cocci
new file mode 100644
index 0000000000..7fe1e8d2d9
--- /dev/null
+++ b/contrib/coccinelle/preincr.cocci
@@ -0,0 +1,5 @@
+@ preincrement @
+identifier i;
+@@
+- ++i > 1
++ i++
diff --git a/fsck.c b/fsck.c
index 0f56977d6a..d44c46c527 100644
--- a/fsck.c
+++ b/fsck.c
@@ -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)