diff options
author | 2016-10-18 21:06:52 +0000 | |
---|---|---|
committer | 2016-10-18 21:06:52 +0000 | |
commit | 1c690bec2f8d115b6b179bfdda6bafd69d74f740 (patch) | |
tree | 48159ede1391345bb617c0f5684f36e37a94e42a /usr.bin/cvs/diff3.c | |
parent | Use the files in /var/db/acpi instead of trying to run acpidump. (diff) | |
download | wireguard-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/cvs/diff3.c')
-rw-r--r-- | usr.bin/cvs/diff3.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index ae5f1fd05c3..d076e47c139 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.61 2016/10/16 13:03:40 millert Exp $ */ +/* $OpenBSD: diff3.c,v 1.62 2016/10/18 21:06:52 millert Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -543,7 +543,12 @@ merge(size_t m1, size_t 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, |