From: Jens Axboe Date: Mon, 11 Feb 2013 15:33:25 +0000 (+0100) Subject: Initialize global and non-static variables X-Git-Tag: fio-2.0.14~14 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5be4c944e83b32c0c6842130df3dc1d46cd6eb1f;hp=47f07ddc7d3354cd6f985b6468989e5e699c4b53 Initialize global and non-static variables 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 --- diff --git a/fio.c b/fio.c index af4c12cb..60261ffa 100644 --- 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) { diff --git a/gettime-thread.c b/gettime-thread.c index c1b4b096..3d49034a 100644 --- a/gettime-thread.c +++ b/gettime-thread.c @@ -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 e8f3a9bb..4709ff29 100644 --- 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; diff --git a/lib/getopt_long.c b/lib/getopt_long.c index 70894e32..bdd524ba 100644 --- a/lib/getopt_long.c +++ b/lib/getopt_long.c @@ -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;