]> git.itanic.dy.fi Git - glucose/commitdiff
main: Only set non-zero elements in user_options structure
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 27 Mar 2012 17:59:38 +0000 (20:59 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Tue, 27 Mar 2012 17:59:38 +0000 (20:59 +0300)
As the number of elements may increase over time, it is better to zero
out the entire strucutre and then explicity set default values only on
those entries that have non-zero default.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
main.c

diff --git a/main.c b/main.c
index 79d22c2b576ffee9c5a4c9842396d2848540edbd..a78d6800583425f9709fbf9f5ca25217acea3e76 100644 (file)
--- a/main.c
+++ b/main.c
@@ -137,9 +137,12 @@ static int dump_entries(struct user_options *opts, int fd, int usage_code)
 
 int main(int argc, char *argv[])
 {
-       struct user_options opts = { .usbdev = NULL, .output_path = NULL, .output_format = CLEAN, .trace_level = 0 };
+       struct user_options opts;
        int fd, usage_code, ret, error;
 
+       bzero(&opts, sizeof(opts));
+       opts.output_format = CLEAN;
+
        if ( read_args(argc, argv, &opts) )
                return -1;