Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src - avoid multipling a boolean value, use &&.



details:   https://anonhg.NetBSD.org/src/rev/664b1e699822
branches:  trunk
changeset: 448440:664b1e699822
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 03 10:45:58 2019 +0000

description:
- avoid multipling a boolean value, use &&.

diffstat:

 games/backgammon/backgammon/main.c |  6 +++---
 tests/lib/libc/misc/t_ubsan.c      |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r be114d02e550 -r 664b1e699822 games/backgammon/backgammon/main.c
--- a/games/backgammon/backgammon/main.c        Sun Feb 03 10:23:42 2019 +0000
+++ b/games/backgammon/backgammon/main.c        Sun Feb 03 10:45:58 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.32 2014/03/22 23:10:36 dholland Exp $       */
+/*     $NetBSD: main.c,v 1.33 2019/02/03 10:45:58 mrg Exp $    */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.32 2014/03/22 23:10:36 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.33 2019/02/03 10:45:58 mrg Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -465,7 +465,7 @@
                mflag = 0;
                l = bar + 7 * cturn;
                for (i = bar; i != l; i += cturn)
-                       if (board[i] * cturn)
+                       if (board[i] && cturn)
                                mflag++;
 
                /* compute game value */
diff -r be114d02e550 -r 664b1e699822 tests/lib/libc/misc/t_ubsan.c
--- a/tests/lib/libc/misc/t_ubsan.c     Sun Feb 03 10:23:42 2019 +0000
+++ b/tests/lib/libc/misc/t_ubsan.c     Sun Feb 03 10:45:58 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ubsan.c,v 1.1 2018/08/03 04:18:40 kamil Exp $        */
+/*     $NetBSD: t_ubsan.c,v 1.2 2019/02/03 10:45:58 mrg Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2018\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ubsan.c,v 1.1 2018/08/03 04:18:40 kamil Exp $");
+__RCSID("$NetBSD: t_ubsan.c,v 1.2 2019/02/03 10:45:58 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -376,7 +376,7 @@
        volatile int a = INT_MAX;
        volatile int b = atoi("2");
 
-       raise((a * b) ? SIGSEGV : SIGBUS);
+       raise((a && b) ? SIGSEGV : SIGBUS);
 }
 
 UBSAN_TC_BODY(mul_overflow_signed, tc)



Home | Main Index | Thread Index | Old Index