On 27/10/2020 06.05, Eric Blake wrote: > Anywhere we create a list of just one item or by prepending items > (typically because order doesn't matter), we can use the now-public > macro. But places where we must keep the list in order by appending > remain open-coded. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > docs/devel/writing-qmp-commands.txt | 13 +++------ > hw/net/rocker/rocker_fp.h | 2 +- > block/gluster.c | 19 +++++-------- > chardev/char.c | 21 +++++++-------- > hw/core/machine.c | 6 +---- > hw/net/rocker/rocker.c | 8 +++--- > hw/net/rocker/rocker_fp.c | 14 +++++----- > hw/net/virtio-net.c | 21 +++++---------- > migration/migration.c | 7 ++--- > migration/postcopy-ram.c | 7 ++--- > monitor/hmp-cmds.c | 11 ++++---- > qemu-img.c | 5 ++-- > qga/commands-posix.c | 13 +++------ > qga/commands-win32.c | 17 +++--------- > qga/commands.c | 6 +---- > qom/qom-qmp-cmds.c | 29 ++++++-------------- > target/arm/helper.c | 6 +---- > target/arm/monitor.c | 13 ++------- > target/i386/cpu.c | 6 +---- > target/mips/helper.c | 6 +---- > target/s390x/cpu_models.c | 12 ++------- > tests/test-clone-visitor.c | 7 ++--- > tests/test-qobject-output-visitor.c | 42 ++++++++++++++--------------- > tests/test-visitor-serialization.c | 5 +--- > trace/qmp.c | 22 +++++++-------- > ui/vnc.c | 21 +++++---------- > util/qemu-config.c | 14 +++------- > target/ppc/translate_init.c.inc | 12 ++------- > 28 files changed, 119 insertions(+), 246 deletions(-) > > diff --git a/docs/devel/writing-qmp-commands.txt > b/docs/devel/writing-qmp-commands.txt > index 46a6c48683f5..3e11eeaa1893 100644 > --- a/docs/devel/writing-qmp-commands.txt > +++ b/docs/devel/writing-qmp-commands.txt > @@ -531,15 +531,10 @@ TimerAlarmMethodList *qmp_query_alarm_methods(Error > **errp) > bool current = true; > > for (p = alarm_timers; p->name; p++) { > - TimerAlarmMethodList *info = g_malloc0(sizeof(*info)); > - info->value = g_malloc0(sizeof(*info->value)); > - info->value->method_name = g_strdup(p->name); > - info->value->current = current; > - > - current = false; > - > - info->next = method_list; > - method_list = info; > + TimerAlarmMethod *value = g_new0(TimerAlarmMethod, 1);
White space damage - please replace the TAB with spaces. > + value->method_name = g_strdup(p->name); > + value->current = current; > + QAPI_LIST_ADD(method_list, value); > } Thomas