qapi: Make visitor functions taking Error ** return bool, not void

See recent commit "error: Document Error API usage rules" for
rationale.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200707160613.848843-18-armbru@redhat.com>
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 730fa46..d0ca10a 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -60,7 +60,7 @@
     return container_of(v, StringInputVisitor, visitor);
 }
 
-static void start_list(Visitor *v, const char *name, GenericList **list,
+static bool start_list(Visitor *v, const char *name, GenericList **list,
                        size_t size, Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -80,6 +80,7 @@
         }
         siv->lm = LM_UNPARSED;
     }
+    return true;
 }
 
 static GenericList *next_list(Visitor *v, GenericList *tail, size_t size)
@@ -102,7 +103,7 @@
     return tail->next;
 }
 
-static void check_list(Visitor *v, Error **errp)
+static bool check_list(Visitor *v, Error **errp)
 {
     const StringInputVisitor *siv = to_siv(v);
 
@@ -111,9 +112,9 @@
     case LM_UINT64_RANGE:
     case LM_UNPARSED:
         error_setg(errp, "Fewer list elements expected");
-        return;
+        return false;
     case LM_END:
-        return;
+        return true;
     default:
         abort();
     }
@@ -178,7 +179,7 @@
     return 0;
 }
 
-static void parse_type_int64(Visitor *v, const char *name, int64_t *obj,
+static bool parse_type_int64(Visitor *v, const char *name, int64_t *obj,
                              Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -188,17 +189,17 @@
     case LM_NONE:
         /* just parse a simple int64, bail out if not completely consumed */
         if (qemu_strtoi64(siv->string, NULL, 0, &val)) {
-                error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
-                           name ? name : "null", "int64");
-            return;
+            error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+                       name ? name : "null", "int64");
+            return false;
         }
         *obj = val;
-        return;
+        return true;
     case LM_UNPARSED:
         if (try_parse_int64_list_entry(siv, obj)) {
             error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
                        "list of int64 values or ranges");
-            return;
+            return false;
         }
         assert(siv->lm == LM_INT64_RANGE);
         /* fall through */
@@ -211,10 +212,10 @@
             /* end of range, check if there is more to parse */
             siv->lm = siv->unparsed_string[0] ? LM_UNPARSED : LM_END;
         }
-        return;
+        return true;
     case LM_END:
         error_setg(errp, "Fewer list elements expected");
-        return;
+        return false;
     default:
         abort();
     }
@@ -268,7 +269,7 @@
     return 0;
 }
 
-static void parse_type_uint64(Visitor *v, const char *name, uint64_t *obj,
+static bool parse_type_uint64(Visitor *v, const char *name, uint64_t *obj,
                               Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -280,15 +281,15 @@
         if (qemu_strtou64(siv->string, NULL, 0, &val)) {
             error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
                        "uint64");
-            return;
+            return false;
         }
         *obj = val;
-        return;
+        return true;
     case LM_UNPARSED:
         if (try_parse_uint64_list_entry(siv, obj)) {
             error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
                        "list of uint64 values or ranges");
-            return;
+            return false;
         }
         assert(siv->lm == LM_UINT64_RANGE);
         /* fall through */
@@ -301,16 +302,16 @@
             /* end of range, check if there is more to parse */
             siv->lm = siv->unparsed_string[0] ? LM_UNPARSED : LM_END;
         }
-        return;
+        return true;
     case LM_END:
         error_setg(errp, "Fewer list elements expected");
-        return;
+        return false;
     default:
         abort();
     }
 }
 
-static void parse_type_size(Visitor *v, const char *name, uint64_t *obj,
+static bool parse_type_size(Visitor *v, const char *name, uint64_t *obj,
                             Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -320,13 +321,14 @@
     assert(siv->lm == LM_NONE);
     if (!parse_option_size(name, siv->string, &val, &err)) {
         error_propagate(errp, err);
-        return;
+        return false;
     }
 
     *obj = val;
+    return true;
 }
 
-static void parse_type_bool(Visitor *v, const char *name, bool *obj,
+static bool parse_type_bool(Visitor *v, const char *name, bool *obj,
                             Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -336,29 +338,31 @@
         !strcasecmp(siv->string, "yes") ||
         !strcasecmp(siv->string, "true")) {
         *obj = true;
-        return;
+        return true;
     }
     if (!strcasecmp(siv->string, "off") ||
         !strcasecmp(siv->string, "no") ||
         !strcasecmp(siv->string, "false")) {
         *obj = false;
-        return;
+        return true;
     }
 
     error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
                "boolean");
+    return false;
 }
 
-static void parse_type_str(Visitor *v, const char *name, char **obj,
+static bool parse_type_str(Visitor *v, const char *name, char **obj,
                            Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
 
     assert(siv->lm == LM_NONE);
     *obj = g_strdup(siv->string);
+    return true;
 }
 
-static void parse_type_number(Visitor *v, const char *name, double *obj,
+static bool parse_type_number(Visitor *v, const char *name, double *obj,
                               Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -368,13 +372,14 @@
     if (qemu_strtod_finite(siv->string, NULL, &val)) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
                    "number");
-        return;
+        return false;
     }
 
     *obj = val;
+    return true;
 }
 
-static void parse_type_null(Visitor *v, const char *name, QNull **obj,
+static bool parse_type_null(Visitor *v, const char *name, QNull **obj,
                             Error **errp)
 {
     StringInputVisitor *siv = to_siv(v);
@@ -385,10 +390,11 @@
     if (siv->string[0]) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
                    "null");
-        return;
+        return false;
     }
 
     *obj = qnull();
+    return true;
 }
 
 static void string_input_free(Visitor *v)