summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-01-25 05:18:03 +0000
committerngie <ngie@FreeBSD.org>2015-01-25 05:18:03 +0000
commitc8660cb9dbc66c7c91c172c9e108b410791d522c (patch)
treecffbcc479ea7490e358eaa78ae92ef23ea9b3a03 /tools
parentbe8fb1ecdaa7b1b74b7ab53a9e0fd5f4c89efa00 (diff)
downloadFreeBSD-src-c8660cb9dbc66c7c91c172c9e108b410791d522c.zip
FreeBSD-src-c8660cb9dbc66c7c91c172c9e108b410791d522c.tar.gz
MFC r277527:
r277527 (by ngie): Make this compile with WARNS=6 and clang/gcc Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/file/flock/flock.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/regression/file/flock/flock.c b/tools/regression/file/flock/flock.c
index fd426b0..49e47b8 100644
--- a/tools/regression/file/flock/flock.c
+++ b/tools/regression/file/flock/flock.c
@@ -27,6 +27,7 @@
* $FreeBSD$
*/
+#include <sys/param.h>
#include <sys/file.h>
#include <sys/time.h>
#ifdef __FreeBSD__
@@ -52,6 +53,10 @@
#endif
#include <sys/cdefs.h>
#else
+#ifndef nitems
+#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
+#endif
+
#ifndef __unused
#ifdef __GNUC__
#define __unused __attribute__((__unused__))
@@ -61,7 +66,7 @@
#endif
#endif
-int verbose = 0;
+static int verbose = 0;
static int
make_file(const char *pathname, off_t sz)
@@ -1519,7 +1524,7 @@ struct test {
int intr; /* non-zero if the test interrupts a lock */
};
-struct test tests[] = {
+static struct test tests[] = {
{ test1, 1, 0 },
{ test2, 2, 0 },
{ test3, 3, 1 },
@@ -1537,7 +1542,6 @@ struct test tests[] = {
{ test15, 15, 1 },
{ test16, 16, 1 },
};
-int test_count = sizeof(tests) / sizeof(tests[0]);
int
main(int argc, const char *argv[])
@@ -1545,7 +1549,7 @@ main(int argc, const char *argv[])
int testnum;
int fd;
int nointr;
- int i;
+ unsigned i;
struct sigaction sa;
int test_argc;
const char **test_argv;
@@ -1583,7 +1587,7 @@ main(int argc, const char *argv[])
}
#endif
- for (i = 0; i < test_count; i++) {
+ for (i = 0; i < nitems(tests); i++) {
if (tests[i].intr && nointr)
continue;
if (!testnum || tests[i].num == testnum)
OpenPOWER on IntegriCloud