qmp: constify QmpCommand and list

Since 0b69f6f72c "qapi: remove
qmp_unregister_command()", the command list can be declared const.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20200316171824.2319695-1-marcandre.lureau@redhat.com>
[Rebased]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Marc-André Lureau 2020-03-16 18:18:24 +01:00 committed by Markus Armbruster
parent df4097aeaf
commit f0ccc00be1
7 changed files with 16 additions and 15 deletions

View file

@ -88,14 +88,14 @@ bool qmp_is_oob(const QDict *dict)
&& !qdict_haskey(dict, "execute");
}
QDict *qmp_dispatch(QmpCommandList *cmds, QObject *request,
QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
bool allow_oob)
{
Error *err = NULL;
bool oob;
const char *command;
QDict *args;
QmpCommand *cmd;
const QmpCommand *cmd;
QDict *dict;
QObject *id;
QObject *ret = NULL;

View file

@ -27,7 +27,7 @@ void qmp_register_command(QmpCommandList *cmds, const char *name,
QTAILQ_INSERT_TAIL(cmds, cmd, node);
}
QmpCommand *qmp_find_command(QmpCommandList *cmds, const char *name)
const QmpCommand *qmp_find_command(const QmpCommandList *cmds, const char *name)
{
QmpCommand *cmd;
@ -77,10 +77,10 @@ bool qmp_has_success_response(const QmpCommand *cmd)
return !(cmd->options & QCO_NO_SUCCESS_RESP);
}
void qmp_for_each_command(QmpCommandList *cmds, qmp_cmd_callback_fn fn,
void qmp_for_each_command(const QmpCommandList *cmds, qmp_cmd_callback_fn fn,
void *opaque)
{
QmpCommand *cmd;
const QmpCommand *cmd;
QTAILQ_FOREACH(cmd, cmds, node) {
fn(cmd, opaque);