]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorTestAddHandler: Remove return value
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 May 2023 12:07:50 +0000 (14:07 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 2 Jun 2023 07:41:25 +0000 (09:41 +0200)
The function always returns 0. Remove the return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuagenttest.c
tests/qemumonitortestutils.c
tests/qemumonitortestutils.h

index 7724df2742b0aa3af8f10bd5d5aaf954fda11255..7d8c66707d89dfc3dc38fc5af0cd33bf92483b96 100644 (file)
@@ -475,10 +475,9 @@ testQemuAgentShutdown(const void *data)
     priv.event = QEMU_AGENT_EVENT_SHUTDOWN;
     priv.mode = "halt";
 
-    if (qemuMonitorTestAddHandler(test, "guest-shutdown",
-                                  qemuAgentShutdownTestMonitorHandler,
-                                  &priv, NULL) < 0)
-        return -1;
+    qemuMonitorTestAddHandler(test, "guest-shutdown",
+                              qemuAgentShutdownTestMonitorHandler,
+                              &priv, NULL);
 
     if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
                           QEMU_AGENT_SHUTDOWN_HALT) < 0)
@@ -487,10 +486,9 @@ testQemuAgentShutdown(const void *data)
     priv.event = QEMU_AGENT_EVENT_SHUTDOWN;
     priv.mode = "powerdown";
 
-    if (qemuMonitorTestAddHandler(test, "guest-shutdown",
-                                  qemuAgentShutdownTestMonitorHandler,
-                                  &priv, NULL) < 0)
-        return -1;
+    qemuMonitorTestAddHandler(test, "guest-shutdown",
+                              qemuAgentShutdownTestMonitorHandler,
+                              &priv, NULL);
 
     if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
                           QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0)
@@ -499,11 +497,10 @@ testQemuAgentShutdown(const void *data)
     priv.event = QEMU_AGENT_EVENT_RESET;
     priv.mode = "reboot";
 
-    if (qemuMonitorTestAddHandler(test,
-                                  "guest-shutdown",
-                                  qemuAgentShutdownTestMonitorHandler,
-                                  &priv, NULL) < 0)
-        return -1;
+    qemuMonitorTestAddHandler(test,
+                              "guest-shutdown",
+                              qemuAgentShutdownTestMonitorHandler,
+                              &priv, NULL);
 
     if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
                           QEMU_AGENT_SHUTDOWN_REBOOT) < 0)
@@ -691,10 +688,9 @@ testQemuAgentTimeout(const void *data)
     if (virTestGetExpensive() == 0)
         return EXIT_AM_SKIP;
 
-    if (qemuMonitorTestAddHandler(test, NULL,
-                                  qemuAgentTimeoutTestMonitorHandler,
-                                  NULL, NULL) < 0)
-        return -1;
+    qemuMonitorTestAddHandler(test, NULL,
+                              qemuAgentTimeoutTestMonitorHandler,
+                              NULL, NULL);
 
     if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test), NULL, 0) != -1) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -706,11 +702,10 @@ testQemuAgentTimeout(const void *data)
     if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
         return -1;
 
-    if (qemuMonitorTestAddHandler(test,
-                                  NULL,
-                                  qemuAgentTimeoutTestMonitorHandler,
-                                  NULL, NULL) < 0)
-        return -1;
+    qemuMonitorTestAddHandler(test,
+                              NULL,
+                              qemuAgentTimeoutTestMonitorHandler,
+                              NULL, NULL);
 
     if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test),
                                   "{\"execute\":\"ble\"}",
index cfe78b258a400533443bae78ff6439905275903b..40ef05727196250cf016f58e43a349960dfa62d8 100644 (file)
@@ -441,7 +441,7 @@ qemuMonitorTestFree(qemuMonitorTest *test)
 }
 
 
-int
+void
 qemuMonitorTestAddHandler(qemuMonitorTest *test,
                           const char *identifier,
                           qemuMonitorTestResponseCallback cb,
@@ -460,8 +460,6 @@ qemuMonitorTestAddHandler(qemuMonitorTest *test,
     VIR_WITH_MUTEX_LOCK_GUARD(&test->lock) {
         VIR_APPEND_ELEMENT(test->items, test->nitems, item);
     }
-
-    return 0;
 }
 
 void *
@@ -604,10 +602,12 @@ qemuMonitorTestAddItem(qemuMonitorTest *test,
     data->command_name = g_strdup(command_name);
     data->response = g_strdup(response);
 
-    return qemuMonitorTestAddHandler(test,
-                                     command_name,
-                                     qemuMonitorTestProcessCommandDefault,
-                                     data, qemuMonitorTestHandlerDataFree);
+    qemuMonitorTestAddHandler(test,
+                              command_name,
+                              qemuMonitorTestProcessCommandDefault,
+                              data, qemuMonitorTestHandlerDataFree);
+
+    return 0;
 }
 
 
@@ -684,10 +684,12 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test,
     data->cmderr = g_strdup(cmderr);
     data->command_name = g_steal_pointer(&reformatted);
 
-    return qemuMonitorTestAddHandler(test,
-                                     command,
-                                     qemuMonitorTestProcessCommandVerbatim,
-                                     data, qemuMonitorTestHandlerDataFree);
+    qemuMonitorTestAddHandler(test,
+                              command,
+                              qemuMonitorTestProcessCommandVerbatim,
+                              data, qemuMonitorTestHandlerDataFree);
+
+    return 0;
 }
 
 
@@ -732,10 +734,12 @@ qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *test)
         return -1;
     }
 
-    return qemuMonitorTestAddHandler(test,
-                                     "agent-sync",
-                                     qemuMonitorTestProcessGuestAgentSync,
-                                     NULL, NULL);
+    qemuMonitorTestAddHandler(test,
+                              "agent-sync",
+                              qemuMonitorTestProcessGuestAgentSync,
+                              NULL, NULL);
+
+    return 0;
 }
 
 
@@ -841,10 +845,12 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test,
 
     va_end(args);
 
-    return qemuMonitorTestAddHandler(test,
-                                     cmdname,
-                                     qemuMonitorTestProcessCommandWithArgs,
-                                     data, qemuMonitorTestHandlerDataFree);
+    qemuMonitorTestAddHandler(test,
+                              cmdname,
+                              qemuMonitorTestProcessCommandWithArgs,
+                              data, qemuMonitorTestHandlerDataFree);
+
+    return 0;
 
  error:
     va_end(args);
@@ -939,10 +945,12 @@ qemuMonitorTestAddItemExpect(qemuMonitorTest *test,
         }
     }
 
-    return qemuMonitorTestAddHandler(test,
-                                     cmdname,
-                                     qemuMonitorTestProcessCommandWithArgStr,
-                                     data, qemuMonitorTestHandlerDataFree);
+    qemuMonitorTestAddHandler(test,
+                              cmdname,
+                              qemuMonitorTestProcessCommandWithArgStr,
+                              data, qemuMonitorTestHandlerDataFree);
+
+    return 0;
 }
 
 
index ffcb32a5cc0be53fbd27766ae1ab9bd134c7ed8c..df0d54472037235488768ddaa5034712485dcaf6 100644 (file)
@@ -30,7 +30,7 @@ typedef int (*qemuMonitorTestResponseCallback)(qemuMonitorTest *test,
                                                qemuMonitorTestItem *item,
                                                const char *message);
 
-int
+void
 qemuMonitorTestAddHandler(qemuMonitorTest *test,
                           const char *identifier,
                           qemuMonitorTestResponseCallback cb,