summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff3
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2016-10-18 21:06:52 +0000
committermillert <millert@openbsd.org>2016-10-18 21:06:52 +0000
commit1c690bec2f8d115b6b179bfdda6bafd69d74f740 (patch)
tree48159ede1391345bb617c0f5684f36e37a94e42a /usr.bin/diff3
parentUse the files in /var/db/acpi instead of trying to run acpidump. (diff)
downloadwireguard-openbsd-1c690bec2f8d115b6b179bfdda6bafd69d74f740.tar.xz
wireguard-openbsd-1c690bec2f8d115b6b179bfdda6bafd69d74f740.zip
Using bitwise OR along with two assignments in the conditional of
a while() loop is a trap for the unwary programmer (albeit a clever trap). Break this up into two separate assignments and using boolean OR for clarity. OK otto@
Diffstat (limited to 'usr.bin/diff3')
-rw-r--r--usr.bin/diff3/diff3prog.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/diff3/diff3prog.c b/usr.bin/diff3/diff3prog.c
index 512fef48380..992037b6d85 100644
--- a/usr.bin/diff3/diff3prog.c
+++ b/usr.bin/diff3/diff3prog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3prog.c,v 1.18 2016/10/16 13:03:40 millert Exp $ */
+/* $OpenBSD: diff3prog.c,v 1.19 2016/10/18 21:06:52 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -301,7 +301,12 @@ merge(int m1, int m2)
d1 = d13;
d2 = d23;
j = 0;
- while ((t1 = (d1 < d13 + m1)) | (t2 = (d2 < d23 + m2))) {
+ for (;;) {
+ t1 = (d1 < d13 + m1);
+ t2 = (d2 < d23 + m2);
+ if (!t1 && !t2)
+ break;
+
if (debug) {
printf("%d,%d=%d,%d %d,%d=%d,%d\n",
d1->old.from,d1->old.to,