* [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis
@ 2014-03-05 21:23 Stefan Weil
2014-03-06 10:49 ` Stefan Hajnoczi
2014-03-12 9:20 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2014-03-05 21:23 UTC (permalink / raw)
To: qemu-trivial; +Cc: Stefan Weil, qemu-devel
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>
---
include/qemu-io.h | 2 ++
qemu-io-cmds.c | 2 +-
qemu-io.c | 7 +++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/qemu-io.h b/include/qemu-io.h
index 7e7c07c..5d6006f 100644
--- a/include/qemu-io.h
+++ b/include/qemu-io.h
@@ -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);
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index f1de24c..fb1db53 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -16,7 +16,7 @@
#define CMD_NOFILE_OK 0x01
-int qemuio_misalign;
+bool qemuio_misalign;
static cmdinfo_t *cmdtab;
static int ncmds;
diff --git a/qemu-io.c b/qemu-io.c
index fc38608..2d119c2 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -24,10 +24,9 @@
#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;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis
2014-03-05 21:23 [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis Stefan Weil
@ 2014-03-06 10:49 ` Stefan Hajnoczi
2014-03-12 9:20 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-03-06 10:49 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-trivial, qemu-devel
On Wed, Mar 05, 2014 at 10:23:00PM +0100, Stefan Weil wrote:
> 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>
> ---
> include/qemu-io.h | 2 ++
> qemu-io-cmds.c | 2 +-
> qemu-io.c | 7 +++----
> 3 files changed, 6 insertions(+), 5 deletions(-)
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis
2014-03-05 21:23 [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis Stefan Weil
2014-03-06 10:49 ` Stefan Hajnoczi
@ 2014-03-12 9:20 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-03-12 9:20 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-trivial, qemu-devel
On Wed, Mar 05, 2014 at 10:23:00PM +0100, Stefan Weil wrote:
> 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>
> ---
> include/qemu-io.h | 2 ++
> qemu-io-cmds.c | 2 +-
> qemu-io.c | 7 +++----
> 3 files changed, 6 insertions(+), 5 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-12 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 21:23 [Qemu-devel] [PATCH] qemu-io: Fix warnings from static code analysis Stefan Weil
2014-03-06 10:49 ` Stefan Hajnoczi
2014-03-12 9:20 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).