[Top][All Lists]
[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.
- [Qemu-devel] [PATCH V5 00/10] replace QEMUOptionParameter with QemuOpts parser, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 01/10] qemu-option: opt_set(): split it up into more functions, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 03/10] qemu-option: qemu_opt_set_bool(): fix code duplication, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 06/10] create new function: qemu_opt_set_number, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 04/10] introduce qemu_opts_create_nofail function, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 05/10] use qemu_opts_create_nofail, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 07/10] add def_print_str and use it in qemu_opts_print., Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 02/10] qemu-option: qemu_opts_validate(): fix duplicated code, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 08/10] Create four opts list related functions, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 09/10] Use QemuOpts support in block layer, Dong Xu Wang, 2012/11/01
- [Qemu-devel] [PATCH V5 10/10] remove QEMUOptionParameter related functions and struct, Dong Xu Wang, 2012/11/01