Source-Changes-HG archive

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

[src/trunk]: src/libexec/lfs_cleanerd Use llabs(), not abs(), on the differen...



details:   https://anonhg.NetBSD.org/src/rev/84e8b9cb5a0f
branches:  trunk
changeset: 340924:84e8b9cb5a0f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Oct 10 22:34:46 2015 +0000

description:
Use llabs(), not abs(), on the difference of daddr_t's.
Caught by clang, reported by joerg.

Turn off the clang-specific compiler flags that were making the report
nonfatal.

diffstat:

 libexec/lfs_cleanerd/Makefile   |  4 +---
 libexec/lfs_cleanerd/coalesce.c |  4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r d230671db7bc -r 84e8b9cb5a0f libexec/lfs_cleanerd/Makefile
--- a/libexec/lfs_cleanerd/Makefile     Sat Oct 10 22:34:33 2015 +0000
+++ b/libexec/lfs_cleanerd/Makefile     Sat Oct 10 22:34:46 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.18 2014/03/04 21:06:47 joerg Exp $
+#      $NetBSD: Makefile,v 1.19 2015/10/10 22:34:46 dholland Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 .include "Makefile.inc"
@@ -11,6 +11,4 @@
 LDSTATIC?=      -static
 .endif
 
-CWARNFLAGS.clang+=     -Wno-error=absolute-value
-
 .include <bsd.prog.mk>
diff -r d230671db7bc -r 84e8b9cb5a0f libexec/lfs_cleanerd/coalesce.c
--- a/libexec/lfs_cleanerd/coalesce.c   Sat Oct 10 22:34:33 2015 +0000
+++ b/libexec/lfs_cleanerd/coalesce.c   Sat Oct 10 22:34:46 2015 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: coalesce.c,v 1.32 2015/08/12 18:28:00 dholland Exp $  */
+/*      $NetBSD: coalesce.c,v 1.33 2015/10/10 22:34:46 dholland Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -269,7 +269,7 @@
        for (i = 1; i < nb; i++) {
                if (bip[i].bi_daddr != bip[i - 1].bi_daddr + lfs_sb_getfrag(fs))
                        ++noff;
-               toff += abs(bip[i].bi_daddr - bip[i - 1].bi_daddr
+               toff += llabs(bip[i].bi_daddr - bip[i - 1].bi_daddr
                    - lfs_sb_getfrag(fs)) >> lfs_sb_getfbshift(fs);
        }
 



Home | Main Index | Thread Index | Old Index