Warnings work in util/
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 28 Jul 2009 11:25:08 +0000 (12:25 +0100)
committerDerrick Brashear <shadow@dementia.org>
Wed, 29 Jul 2009 11:13:08 +0000 (04:13 -0700)
Make afs_ctime an inline function, instead of a complex macro.
This both improves our type safety, and suppreses warnings about
unused results.

Add bracing to clarify operator precedence in if (a && b || c)
statement

AFS_DARwiN60_ENV != AFS_DARWIN60_ENV

Use (void) rather than () in function prototypes

Reviewed-on: http://gerrit.openafs.org/240
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/util/afsutil.h
src/util/fstab.c
src/util/softsig.c
src/util/softsig.h

index bf4db4e..dc587a6 100644 (file)
@@ -89,8 +89,12 @@ extern char *vctime(const time_t * atime);
 #define afs_ctime(C, B, L) (char*)ctime_r(C, B)
 #endif /* AFS_SUN5_ENV */
 #else /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
-#define afs_ctime(C, B, S) \
-       ((void)strncpy(B, ctime(C), (S-1)), (B)[S-1] = '\0', (B))
+static_inline char *
+afs_ctime(const time_t *C, char *B, size_t S) {
+    strncpy(B, ctime(C), (S-1));
+    B[S-1] = '\0';
+    return B;
+}
 #endif /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
 
 
index a39ab46..2c3d518 100644 (file)
@@ -104,7 +104,7 @@ fstabscan(void)
 struct fstab *
 getfsent(void)
 {
-    if (!_fs_buf && !setfsent() || !fstabscan())
+    if ((!_fs_buf && !setfsent()) || !fstabscan())
        return ((struct fstab *)NULL);
     return (&_fs_fstab);
 }
index 24a2412..bcd04f9 100644 (file)
@@ -68,7 +68,7 @@ softsig_thread(void *arg)
 
     while (1) {
        void (*h) (int);
-#if !defined(AFS_DARwiN60_ENV) && !defined(AFS_NBSD_ENV)
+#if !defined(AFS_DARWIN60_ENV) && !defined(AFS_NBSD_ENV)
        int sigw;
 #endif
 
index 8d1b790..fec107b 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _SOFTSIG_H
 #define _SOFTSIG_H
 
-void softsig_init();
+void softsig_init(void);
 void softsig_signal(int signo, void (*handler) (int));
 
 #endif