From: Stefan Weil <sw@weilnetz.de>
To: qemu-trivial@nongnu.org
Cc: qemu-devel@nongnu.org, Stefan Weil <sw@weilnetz.de>,
Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] monitor: Fix warning from clang
Date: Fri, 17 Aug 2012 15:34:04 +0200 [thread overview]
Message-ID: <1345210444-2292-1-git-send-email-sw@weilnetz.de> (raw)
ccc-analyzer reports these warnings:
monitor.c:3532:21: warning: Division by zero
val %= val2;
^
monitor.c:3530:21: warning: Division by zero
val /= val2;
^
Rewriting the code fixes this (and also a style issue).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
monitor.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/monitor.c b/monitor.c
index 0c34934..0ea2c14 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3524,12 +3524,13 @@ static int64_t expr_prod(Monitor *mon)
break;
case '/':
case '%':
- if (val2 == 0)
+ if (val2 == 0) {
expr_error(mon, "division by zero");
- if (op == '/')
+ } else if (op == '/') {
val /= val2;
- else
+ } else {
val %= val2;
+ }
break;
}
}
--
1.7.10
next reply other threads:[~2012-08-17 13:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 13:34 Stefan Weil [this message]
2012-08-17 13:58 ` [Qemu-devel] [PATCH] monitor: Fix warning from clang Luiz Capitulino
2012-08-17 14:10 ` Markus Armbruster
2012-08-17 14:21 ` Luiz Capitulino
2012-08-17 14:41 ` Markus Armbruster
2012-08-17 15:02 ` Luiz Capitulino
2012-08-18 11:49 ` Stefan Weil
2012-08-20 7:17 ` Markus Armbruster
2012-08-24 10:31 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345210444-2292-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).