فهرست منبع

qmp: Drop dead command->type

Ever since QMP was first added back in commit 43c20a43, we have
never had any QmpCommandType other than QCT_NORMAL.  It's
pointless to carry around the cruft.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1461879932-9020-4-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Eric Blake 9 سال پیش
والد
کامیت
42a502a7a6
3فایلهای تغییر یافته به همراه7 افزوده شده و 18 حذف شده
  1. 0 6
      include/qapi/qmp/dispatch.h
  2. 7 11
      qapi/qmp-dispatch.c
  3. 0 1
      qapi/qmp-registry.c

+ 0 - 6
include/qapi/qmp/dispatch.h

@@ -19,11 +19,6 @@
 
 
 typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
 typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
 
 
-typedef enum QmpCommandType
-{
-    QCT_NORMAL,
-} QmpCommandType;
-
 typedef enum QmpCommandOptions
 typedef enum QmpCommandOptions
 {
 {
     QCO_NO_OPTIONS = 0x0,
     QCO_NO_OPTIONS = 0x0,
@@ -33,7 +28,6 @@ typedef enum QmpCommandOptions
 typedef struct QmpCommand
 typedef struct QmpCommand
 {
 {
     const char *name;
     const char *name;
-    QmpCommandType type;
     QmpCommandFunc *fn;
     QmpCommandFunc *fn;
     QmpCommandOptions options;
     QmpCommandOptions options;
     QTAILQ_ENTRY(QmpCommand) node;
     QTAILQ_ENTRY(QmpCommand) node;

+ 7 - 11
qapi/qmp-dispatch.c

@@ -94,17 +94,13 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp)
         QINCREF(args);
         QINCREF(args);
     }
     }
 
 
-    switch (cmd->type) {
-    case QCT_NORMAL:
-        cmd->fn(args, &ret, &local_err);
-        if (local_err) {
-            error_propagate(errp, local_err);
-        } else if (cmd->options & QCO_NO_SUCCESS_RESP) {
-            g_assert(!ret);
-        } else if (!ret) {
-            ret = QOBJECT(qdict_new());
-        }
-        break;
+    cmd->fn(args, &ret, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+    } else if (cmd->options & QCO_NO_SUCCESS_RESP) {
+        g_assert(!ret);
+    } else if (!ret) {
+        ret = QOBJECT(qdict_new());
     }
     }
 
 
     QDECREF(args);
     QDECREF(args);

+ 0 - 1
qapi/qmp-registry.c

@@ -25,7 +25,6 @@ void qmp_register_command(const char *name, QmpCommandFunc *fn,
     QmpCommand *cmd = g_malloc0(sizeof(*cmd));
     QmpCommand *cmd = g_malloc0(sizeof(*cmd));
 
 
     cmd->name = name;
     cmd->name = name;
-    cmd->type = QCT_NORMAL;
     cmd->fn = fn;
     cmd->fn = fn;
     cmd->enabled = true;
     cmd->enabled = true;
     cmd->options = options;
     cmd->options = options;