disassembler: Put debug variable into cmdargs struct
authorMichael Buesch <mb@bu3sch.de>
Mon, 20 Sep 2010 20:41:48 +0000 (22:41 +0200)
committerMichael Buesch <mb@bu3sch.de>
Mon, 20 Sep 2010 20:41:48 +0000 (22:41 +0200)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
disassembler/args.c
disassembler/args.h

index 08e3a402c3ac25cb68b5ae7d7adb9595876e3654..89db70663668eed70b8c423ee22858e6b78e9532 100644 (file)
 #include <unistd.h>
 
 
-int _debug;
-
 struct cmdline_args cmdargs = {
-       .arch = 5,
-       .informat = FMT_B43,
-       .print_addresses = 0,
-       .unknown_decode = 0,
+       .debug                  = 0,
+       .arch                   = 5,
+       .informat               = FMT_B43,
+       .print_addresses        = 0,
+       .unknown_decode         = 0,
 };
 
 #define ARG_MATCH              0
@@ -139,7 +138,7 @@ int parse_args(int argc, char **argv)
                } else if ((res = cmp_arg(argv, &i, "--unkdec", "-u", NULL)) == ARG_MATCH) {
                        cmdargs.unknown_decode = 1;
                } else if ((res = cmp_arg(argv, &i, "--debug", "-d", NULL)) == ARG_MATCH) {
-                       _debug++;
+                       cmdargs.debug++;
                } else if ((res = cmp_arg(argv, &i, "--arch", "-a", &param)) == ARG_MATCH) {
                        unsigned long arch;
                        char *tail;
index 67f1e4539e93a7abb1248d2faf783f50d906326a..6af5b8d76cdd50c53c415a563cff9f369f2bd704 100644 (file)
@@ -8,6 +8,7 @@ enum fwformat {
 };
 
 struct cmdline_args {
+       int debug;                      /* Debug level. */
        unsigned int arch;              /* The architecture we're disassembling. */
        enum fwformat informat;         /* The input file format. */
        int print_addresses;            /* Print a comment with instruction address. */
@@ -21,11 +22,10 @@ void close_input_file(void);
 int open_output_file(void);
 void close_output_file(void);
 
-extern int _debug;
 extern struct cmdline_args cmdargs;
 
-#define IS_DEBUG               (_debug > 0)
-#define IS_VERBOSE_DEBUG       (_debug > 1)
-#define IS_INSANE_DEBUG                (_debug > 2)
+#define IS_DEBUG               (cmdargs.debug > 0)
+#define IS_VERBOSE_DEBUG       (cmdargs.debug > 1)
+#define IS_INSANE_DEBUG                (cmdargs.debug > 2)
 
 #endif /* B43_DASM_ARGS_H_ */