Initialize global and non-static variables
authorJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2013 15:33:25 +0000 (16:33 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Feb 2013 15:33:25 +0000 (16:33 +0100)
Don't assume they get zeroed. The AIX linker throws a hissy fit on
these, refusing to link the program.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fio.c
gettime-thread.c
init.c
lib/getopt_long.c

diff --git a/fio.c b/fio.c
index af4c12cbe1815f7119511a6bdb44b39421c85161..60261ffa9b26f2fd27e7cf88ff25a6a773d29f96 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -28,8 +28,8 @@
 #include "fio.h"
 #include "smalloc.h"
 
-uintptr_t page_mask;
-uintptr_t page_size;
+uintptr_t page_mask = 0;
+uintptr_t page_size = 0;
 
 static int endian_check(void)
 {
index c1b4b0967c28f354b8a3e6c9ad82fc2845c41e56..3d49034a72792fc6cfc590ed545c522de4f7a999 100644 (file)
@@ -6,7 +6,7 @@
 #include "fio.h"
 #include "smalloc.h"
 
-struct timeval *fio_tv;
+struct timeval *fio_tv = NULL;
 int fio_gtod_offload = 0;
 int fio_gtod_cpu = -1;
 static pthread_t gtod_thread;
diff --git a/init.c b/init.c
index e8f3a9bb24e856f262b08dcdf43cfaeedb65b0d0..4709ff29146292a41b6994b450b68730ce8a3032 100644 (file)
--- a/init.c
+++ b/init.c
@@ -40,7 +40,7 @@ struct thread_data *threads = NULL;
 
 int exitall_on_terminate = 0;
 int output_format = FIO_OUTPUT_NORMAL;
-int eta_print;
+int eta_print = FIO_ETA_AUTO;
 unsigned long long mlock_size = 0;
 FILE *f_out = NULL;
 FILE *f_err = NULL;
index 70894e3281e04f7830cc583c2079affb9c545518..bdd524babf0c4a2ab0f175e386481be9e5d47522 100644 (file)
@@ -16,8 +16,9 @@
 
 #include "getopt.h"
 
-char *optarg;
-int optind, opterr, optopt;
+char *optarg = NULL;
+int optind = 0, opterr = 0, optopt = 0;
+
 static struct getopt_private_state {
        const char *optptr;
        const char *last_optstring;