On 10/23/20 1:36 PM, 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 +++------
> +++ 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); > + value->method_name = g_strdup(p->name); Oops, tab damage. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org