]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONParseKeywords: remove constant argument
authorPeter Krempa <pkrempa@redhat.com>
Wed, 13 May 2020 18:54:24 +0000 (20:54 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 May 2020 07:41:57 +0000 (09:41 +0200)
There's just one caller that always passes '1'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_monitor_json.c

index 3770380a3a1ba0c0b5f43d38b0fc0f5227968604..4dcee819bb01c44ba7508af5ec663fe7f412f1a5 100644 (file)
@@ -604,16 +604,15 @@ qemuMonitorJSONParseKeywordsFree(int nkeywords,
 /*
  * Takes a string containing a set of key=value,key=value,key...
  * parameters and splits them up, returning two arrays with
- * the individual keys and values. If allowEmptyValue is nonzero,
- * the "=value" part is optional and if a key with no value is found,
- * NULL is be placed into corresponding place in retvalues.
+ * the individual keys and values.
+ * The "=value" part is optional and if a key with no value is found,
+ * NULL will be placed into corresponding place in retvalues.
  */
 static int
 qemuMonitorJSONParseKeywords(const char *str,
                              char ***retkeywords,
                              char ***retvalues,
-                             int *retnkeywords,
-                             int allowEmptyValue)
+                             int *retnkeywords)
 {
     int keywordCount = 0;
     int keywordAlloc = 0;
@@ -645,14 +644,8 @@ qemuMonitorJSONParseKeywords(const char *str,
         if (!(separator = strchr(start, '=')))
             separator = end;
 
-        if (separator >= endmark) {
-            if (!allowEmptyValue) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("malformed keyword arguments in '%s'"), str);
-                goto error;
-            }
+        if (separator >= endmark)
             separator = endmark;
-        }
 
         keyword = g_strndup(start, separator - start);
 
@@ -708,7 +701,7 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeyword)
     int nkeywords = 0;
     size_t i;
 
-    if (qemuMonitorJSONParseKeywords(str, &keywords, &values, &nkeywords, 1) < 0)
+    if (qemuMonitorJSONParseKeywords(str, &keywords, &values, &nkeywords) < 0)
         goto error;
 
     for (i = 0; i < nkeywords; i++) {