[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 02/21] qapi: add explicit null to string input and outp
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 02/21] qapi: add explicit null to string input and output visitors |
Date: |
Fri, 30 Jun 2017 20:46:13 +1000 |
From: Greg Kurz <address@hidden>
This may be used for deprecated object properties that are kept for
backwards compatibility.
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Tested-by: Andrea Bolognani <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
qapi/string-input-visitor.c | 11 +++++++++++
qapi/string-output-visitor.c | 14 ++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index c089491..63ae115 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -326,6 +326,16 @@ static void parse_type_number(Visitor *v, const char
*name, double *obj,
*obj = val;
}
+static void parse_type_null(Visitor *v, const char *name, Error **errp)
+{
+ StringInputVisitor *siv = to_siv(v);
+
+ if (!siv->string || siv->string[0]) {
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+ "null");
+ }
+}
+
static void string_input_free(Visitor *v)
{
StringInputVisitor *siv = to_siv(v);
@@ -349,6 +359,7 @@ Visitor *string_input_visitor_new(const char *str)
v->visitor.type_bool = parse_type_bool;
v->visitor.type_str = parse_type_str;
v->visitor.type_number = parse_type_number;
+ v->visitor.type_null = parse_type_null;
v->visitor.start_list = start_list;
v->visitor.next_list = next_list;
v->visitor.check_list = check_list;
diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 53c2175..af649e1 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -256,6 +256,19 @@ static void print_type_number(Visitor *v, const char
*name, double *obj,
string_output_set(sov, g_strdup_printf("%f", *obj));
}
+static void print_type_null(Visitor *v, const char *name, Error **errp)
+{
+ StringOutputVisitor *sov = to_sov(v);
+ char *out;
+
+ if (sov->human) {
+ out = g_strdup("<null>");
+ } else {
+ out = g_strdup("");
+ }
+ string_output_set(sov, out);
+}
+
static void
start_list(Visitor *v, const char *name, GenericList **list, size_t size,
Error **errp)
@@ -341,6 +354,7 @@ Visitor *string_output_visitor_new(bool human, char
**result)
v->visitor.type_bool = print_type_bool;
v->visitor.type_str = print_type_str;
v->visitor.type_number = print_type_number;
+ v->visitor.type_null = print_type_null;
v->visitor.start_list = start_list;
v->visitor.next_list = next_list;
v->visitor.end_list = end_list;
--
2.9.4
- [Qemu-ppc] [PULL 00/21] ppc-for-2.10 queue 20170730, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 01/21] hw/ppc/prep: Remove superfluous call to soundhw_init(), David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 02/21] qapi: add explicit null to string input and output visitors,
David Gibson <=
- [Qemu-ppc] [PULL 06/21] spapr: Add a "no HPT" encoding to HTAB migration stream, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 09/21] target/ppc: Fix return value in tcg radix mmu fault handler, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 07/21] spapr: Fix migration of Radix guests, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 08/21] target/ppc/excp_helper: Take BQL before calling cpu_interrupt(), David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 10/21] xics: directly register ICPState objects to vmstate, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 04/21] pseries: Reset CPU compatibility mode, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 14/21] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 05/21] ppc: Rework CPU compatibility testing across migration, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 18/21] spapr: Split DRC release from DRC detach, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 19/21] spapr: Make DRC reset force DRC into known state, David Gibson, 2017/06/30