[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 06/15] monitor: Rename HMP command type and t
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 06/15] monitor: Rename HMP command type and tables |
Date: |
Fri, 14 Jun 2019 08:01:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Kevin Wolf <address@hidden> writes:
> This renames the type for HMP monitor commands and the tables holding
> the commands to make clear that they are related to HMP and to allow
> making them public later:
>
> * mon_cmd_t -> HMPCommand (fixing use of a reserved name, too)
> * mon_cmds -> hmp_cmds
> * info_cmds -> hmp_info_cmds
>
> Signed-off-by: Kevin Wolf <address@hidden>
checkpatch.pl gripes:
> ---
> monitor.c | 68 ++++++++++++++++++++++++-------------------------
> hmp-commands.hx | 2 +-
> 2 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 5eacaa48a6..006c650761 100644
> --- a/monitor.c
> +++ b/monitor.c
[...]
> @@ -4531,20 +4531,20 @@ static void monitor_event(void *opaque, int event)
> static int
> compare_mon_cmd(const void *a, const void *b)
> {
> - return strcmp(((const mon_cmd_t *)a)->name,
> - ((const mon_cmd_t *)b)->name);
> + return strcmp(((const HMPCommand *)a)->name,
> + ((const HMPCommand *)b)->name);
> }
>
> static void sortcmdlist(void)
> {
> int array_num;
> - int elem_size = sizeof(mon_cmd_t);
> + int elem_size = sizeof(HMPCommand);
>
> - array_num = sizeof(mon_cmds)/elem_size-1;
> - qsort((void *)mon_cmds, array_num, elem_size, compare_mon_cmd);
> + array_num = sizeof(hmp_cmds)/elem_size-1;
229: ERROR: spaces required around that '/' (ctx:VxV)
229: ERROR: spaces required around that '-' (ctx:VxV)
> + qsort((void *)hmp_cmds, array_num, elem_size, compare_mon_cmd);
>
> - array_num = sizeof(info_cmds)/elem_size-1;
> - qsort((void *)info_cmds, array_num, elem_size, compare_mon_cmd);
> + array_num = sizeof(hmp_info_cmds)/elem_size-1;
Likewise.
I figure we should simply use ARRAY_SIZE().
static void sortcmdlist(void)
{
qsort(hmp_cmds, ARRAY_SIZE(hmp_cmds), sizeof(*hmp_cmds),
compare_mon_cmd);
qsort(hmp_info_cmds, ARRAY_SIZE(hmp_info_cmds), sizeof(*hmp_info_cmds),
compare_mon_cmd);
}
Can touch up in my tree.
> + qsort((void *)hmp_info_cmds, array_num, elem_size, compare_mon_cmd);
> }
>
> static void monitor_iothread_init(void)
[...]
- [Qemu-devel] [PATCH v3 00/15] monitor: Split monitor.c in core/HMP/QMP/misc, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 01/15] monitor: Remove unused password prompting fields, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 05/15] monitor: Remove Monitor.cmd_table indirection, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 06/15] monitor: Rename HMP command type and tables, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 03/15] monitor: Make MonitorQMP a child class of Monitor, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 02/15] monitor: Split monitor_init in HMP and QMP function, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 07/15] Move monitor.c to monitor/misc.c, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 04/15] monitor: Create MonitorHMP with readline state, Kevin Wolf, 2019/06/13
- [Qemu-devel] [PATCH v3 09/15] monitor: Create monitor-internal.h with common definitions, Kevin Wolf, 2019/06/13