Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Parenthesize S_IS*() macro arguments to prevent brea...



details:   https://anonhg.NetBSD.org/src/rev/c4c581834a7d
branches:  trunk
changeset: 747019:c4c581834a7d
user:      mouse <mouse%NetBSD.org@localhost>
date:      Thu Aug 27 07:28:42 2009 +0000

description:
Parenthesize S_IS*() macro arguments to prevent breakage with certain
arguments - see PR 41919.  Approved by dholland.

diffstat:

 sys/sys/stat.h |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (39 lines):

diff -r 7d284f77c86b -r c4c581834a7d sys/sys/stat.h
--- a/sys/sys/stat.h    Thu Aug 27 04:59:15 2009 +0000
+++ b/sys/sys/stat.h    Thu Aug 27 07:28:42 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stat.h,v 1.58 2009/01/11 02:45:55 christos Exp $       */
+/*     $NetBSD: stat.h,v 1.59 2009/08/27 07:28:42 mouse Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -148,21 +148,21 @@
 #define        S_ARCH2 _S_ARCH2
 #endif
 
-#define        S_ISDIR(m)      ((m & _S_IFMT) == _S_IFDIR)     /* directory */
-#define        S_ISCHR(m)      ((m & _S_IFMT) == _S_IFCHR)     /* char special */
-#define        S_ISBLK(m)      ((m & _S_IFMT) == _S_IFBLK)     /* block special */
-#define        S_ISREG(m)      ((m & _S_IFMT) == _S_IFREG)     /* regular file */
-#define        S_ISFIFO(m)     ((m & _S_IFMT) == _S_IFIFO)     /* fifo */
+#define        S_ISDIR(m)      (((m) & _S_IFMT) == _S_IFDIR)   /* directory */
+#define        S_ISCHR(m)      (((m) & _S_IFMT) == _S_IFCHR)   /* char special */
+#define        S_ISBLK(m)      (((m) & _S_IFMT) == _S_IFBLK)   /* block special */
+#define        S_ISREG(m)      (((m) & _S_IFMT) == _S_IFREG)   /* regular file */
+#define        S_ISFIFO(m)     (((m) & _S_IFMT) == _S_IFIFO)   /* fifo */
 #if ((_POSIX_C_SOURCE - 0) >= 200112L) || defined(_XOPEN_SOURCE) || \
     defined(_NETBSD_SOURCE)
-#define        S_ISLNK(m)      ((m & _S_IFMT) == _S_IFLNK)     /* symbolic link */
+#define        S_ISLNK(m)      (((m) & _S_IFMT) == _S_IFLNK)   /* symbolic link */
 #endif
 #if ((_POSIX_C_SOURCE - 0) >= 200112L) || ((_XOPEN_SOURCE - 0) >= 600) || \
     defined(_NETBSD_SOURCE)
-#define        S_ISSOCK(m)     ((m & _S_IFMT) == _S_IFSOCK)    /* socket */
+#define        S_ISSOCK(m)     (((m) & _S_IFMT) == _S_IFSOCK)  /* socket */
 #endif
 #if defined(_NETBSD_SOURCE)
-#define        S_ISWHT(m)      ((m & _S_IFMT) == _S_IFWHT)     /* whiteout */
+#define        S_ISWHT(m)      (((m) & _S_IFMT) == _S_IFWHT)   /* whiteout */
 #endif
 
 #if defined(_NETBSD_SOURCE)



Home | Main Index | Thread Index | Old Index