]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
qemu-io: Fix warnings from static code analysis
authorStefan Weil <sw@weilnetz.de>
Wed, 5 Mar 2014 21:23:00 +0000 (22:23 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 13 Mar 2014 13:42:24 +0000 (14:42 +0100)
Smatch complains about several global symbols which should be local.

Add the missing 'static' attributes and move the 'extern' declaration
of variable qemuio_misalign to qemu-io.h. This variable also changes
the type from 'int' to 'bool' which better fits documents its use.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/qemu-io.h
qemu-io-cmds.c
qemu-io.c

index 7e7c07c09ba0a90bd9f035ad3b5383ae8181303d..5d6006f73ba29f0115c5e6643f68ca1f5b512f1a 100644 (file)
@@ -38,6 +38,8 @@ typedef struct cmdinfo {
     helpfunc_t  help;
 } cmdinfo_t;
 
+extern bool qemuio_misalign;
+
 bool qemuio_command(BlockDriverState *bs, const char *cmd);
 
 void qemuio_add_command(const cmdinfo_t *ci);
index f1de24c91c1a30c18d7a9eb02d6c9c096049c349..fb1db53c6b2b65d40801748146b122462f40cd6d 100644 (file)
@@ -16,7 +16,7 @@
 
 #define CMD_NOFILE_OK   0x01
 
-int qemuio_misalign;
+bool qemuio_misalign;
 
 static cmdinfo_t *cmdtab;
 static int ncmds;
index fc3860884c2a017d3fe297cdab2bde606886e34c..2d119c28a61aaeffbb860aa1ff06829198ca44e7 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
 
 #define CMD_NOFILE_OK   0x01
 
-char *progname;
+static char *progname;
 
-BlockDriverState *qemuio_bs;
-extern int qemuio_misalign;
+static BlockDriverState *qemuio_bs;
 
 /* qemu-io commands passed using -c */
 static int ncmdline;
@@ -408,7 +407,7 @@ int main(int argc, char **argv)
             readonly = 1;
             break;
         case 'm':
-            qemuio_misalign = 1;
+            qemuio_misalign = true;
             break;
         case 'g':
             growable = 1;