[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/11] monitor: print the invalid char in error messa
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 10/11] monitor: print the invalid char in error message |
Date: |
Tue, 20 Aug 2013 12:10:40 -0400 |
From: Fam Zheng <address@hidden>
It's more friendly to print which char is invalid to user, especially
when user tries to input a float value and expect the monitor to round
it to int. Since we don't round float number when we look for a integer,
telling which char is invalid is less confusing.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/monitor.c b/monitor.c
index 5dc0aa9..da9c9a2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3171,9 +3171,13 @@ static const MonitorDef monitor_defs[] = {
{ NULL },
};
-static void expr_error(Monitor *mon, const char *msg)
+static void expr_error(Monitor *mon, const char *fmt, ...)
{
- monitor_printf(mon, "%s\n", msg);
+ va_list ap;
+ va_start(ap, fmt);
+ monitor_vprintf(mon, fmt, ap);
+ monitor_printf(mon, "\n");
+ va_end(ap);
siglongjmp(expr_env, 1);
}
@@ -3291,7 +3295,7 @@ static int64_t expr_unary(Monitor *mon)
expr_error(mon, "number too large");
}
if (pch == p) {
- expr_error(mon, "invalid char in expression");
+ expr_error(mon, "invalid char '%c' in expression", *p);
}
pch = p;
while (qemu_isspace(*pch))
--
1.8.1.4
- [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, (continued)
- [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Luiz Capitulino, 2013/08/20
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Andreas Färber, 2013/08/20
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Luiz Capitulino, 2013/08/20
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Andreas Färber, 2013/08/20
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Laszlo Ersek, 2013/08/21
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Eric Blake, 2013/08/21
- Re: [Qemu-devel] [PULL 08/11] add "test-int128" and "test-bitops" to .gitignore, Markus Armbruster, 2013/08/22
[Qemu-devel] [PULL 07/11] OptsVisitor: don't try to flatten overlong integer ranges, Luiz Capitulino, 2013/08/20
[Qemu-devel] [PULL 09/11] OptsVisitor: introduce unit tests, with test cases for range flattening, Luiz Capitulino, 2013/08/20
[Qemu-devel] [PULL 11/11] scripts/qapi.py: Avoid syntax not supported by Python 2.4, Luiz Capitulino, 2013/08/20
[Qemu-devel] [PULL 10/11] monitor: print the invalid char in error message,
Luiz Capitulino <=