qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V5 08/10] Create four opts list related function


From: Dong Xu Wang
Subject: Re: [Qemu-devel] [PATCH V5 08/10] Create four opts list related functions
Date: Wed, 21 Nov 2012 10:48:39 +0800

On Tue, Nov 20, 2012 at 1:16 AM, Stefan Hajnoczi <address@hidden> wrote:
>
> On Thu, Nov 01, 2012 at 05:12:28PM +0800, Dong Xu Wang wrote:
> > +/* Create a new QemuOptsList and make its desc to the merge of first and 
> > second.
> > + * It will allocate space for one new QemuOptsList plus enouth space for
> > + * QemuOptDesc in first and second QemuOptsList. First argument's 
> > QemuOptDesc
> > + * members take precedence over second's.
> > + */
> > +QemuOptsList *append_opts_list(QemuOptsList *first,
> > +                               QemuOptsList *second)
> > +{
> > +    size_t num_first_options, num_second_options;
> > +    QemuOptsList *dest = NULL;
> > +    int i = 0;
> > +    int index = 0;
> > +
> > +    num_first_options = count_opts_list(first);
> > +    num_second_options = count_opts_list(second);
> > +    if (num_first_options + num_second_options == 0) {
> > +        return NULL;
> > +    }
> > +
> > +    dest = g_malloc0(sizeof(QemuOptsList)
> > +        + (num_first_options + num_second_options) * sizeof(QemuOptDesc));
>
> (num_first_options + num_second_options + 1) since we assign
> desc[index].name = NULL at the end.
>
Okay, Thank you Stefan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]