From patchwork Mon Dec 21 08:09:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [03/19] avoid dubiously clever code in win32_start_timer Date: Sun, 20 Dec 2009 22:09:14 -0000 From: Paolo Bonzini X-Patchwork-Id: 41522 Message-Id: <1261382970-23251-4-git-send-email-pbonzini@redhat.com> To: qemu-devel@nongnu.org The code is initializing an unsigned int to UINT_MAX using "-1", so that the following always-true comparison seems to be always-false at a first look. Just remove the if. Signed-off-by: Paolo Bonzini --- vl.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 97410ad..22ec53d 100644 --- a/vl.c +++ b/vl.c @@ -813,7 +813,7 @@ static struct qemu_alarm_timer *alarm_timer; struct qemu_alarm_win32 { MMRESULT timerId; unsigned int period; -} alarm_win32_data = {0, -1}; +} alarm_win32_data = {0, 0}; static int win32_start_timer(struct qemu_alarm_timer *t); static void win32_stop_timer(struct qemu_alarm_timer *t); @@ -1550,9 +1550,7 @@ static int win32_start_timer(struct qemu_alarm_timer *t) memset(&tc, 0, sizeof(tc)); timeGetDevCaps(&tc, sizeof(tc)); - if (data->period < tc.wPeriodMin) - data->period = tc.wPeriodMin; - + data->period = tc.wPeriodMin; timeBeginPeriod(data->period); flags = TIME_CALLBACK_FUNCTION;