Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-18 Thread Chunyan Liu
2014-03-18 3:58 GMT+08:00 Leandro Dorileo : > Hi, > > On Mon, Mar 10, 2014 at 03:31:39PM +0800, Chunyan Liu wrote: > > Improve opt_get and opt_set group of functions. For opt_get, check and > handle > > NULL input; for opt_set, when set to an existing option, rewrite the > option > > with new valu

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-18 Thread Chunyan Liu
2014-03-17 5:19 GMT+08:00 Leandro Dorileo : > Hi Chunyan, > > On Tue, Mar 11, 2014 at 09:00:04PM +, Leandro Dorileo wrote: > > Hi, > > > > On Tue, Mar 11, 2014 at 03:26:51PM +0800, Chunyan Liu wrote: > > > 2014-03-11 5:21 GMT+08:00 Eric Blake : > > > > > > > On 03/10/2014 02:29 PM, Eric Blake

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-17 Thread Leandro Dorileo
Hi, On Mon, Mar 10, 2014 at 03:31:39PM +0800, Chunyan Liu wrote: > Improve opt_get and opt_set group of functions. For opt_get, check and handle > NULL input; for opt_set, when set to an existing option, rewrite the option > with new value. > > Signed-off-by: Dong Xu Wang > Signed-off-by: Chunya

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-16 Thread Leandro Dorileo
Hi Chunyan, On Tue, Mar 11, 2014 at 09:00:04PM +, Leandro Dorileo wrote: > Hi, > > On Tue, Mar 11, 2014 at 03:26:51PM +0800, Chunyan Liu wrote: > > 2014-03-11 5:21 GMT+08:00 Eric Blake : > > > > > On 03/10/2014 02:29 PM, Eric Blake wrote: > > > > > > >> +opt = qemu_opt_find(opts, name);

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-11 Thread Chunyan Liu
2014-03-11 5:21 GMT+08:00 Eric Blake : > On 03/10/2014 02:29 PM, Eric Blake wrote: > > >> +opt = qemu_opt_find(opts, name); > >> +if (opt) { > >> +g_free((char *)opt->str); > > > > ...which means the cast is pointless here. > > > > Hmm. This means that you are giving opt_set() the

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-11 Thread Leandro Dorileo
Hi, On Tue, Mar 11, 2014 at 03:26:51PM +0800, Chunyan Liu wrote: > 2014-03-11 5:21 GMT+08:00 Eric Blake : > > > On 03/10/2014 02:29 PM, Eric Blake wrote: > > > > >> +opt = qemu_opt_find(opts, name); > > >> +if (opt) { > > >> +g_free((char *)opt->str); > > > > > > ...which means th

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-11 Thread Chunyan Liu
2014-03-11 5:21 GMT+08:00 Eric Blake : > On 03/10/2014 02:29 PM, Eric Blake wrote: > > >> +opt = qemu_opt_find(opts, name); > >> +if (opt) { > >> +g_free((char *)opt->str); > > > > ...which means the cast is pointless here. > > > > Hmm. This means that you are giving opt_set() the

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-10 Thread Eric Blake
On 03/10/2014 02:29 PM, Eric Blake wrote: >> +opt = qemu_opt_find(opts, name); >> +if (opt) { >> +g_free((char *)opt->str); > > ...which means the cast is pointless here. > > Hmm. This means that you are giving opt_set() the behavior of 'last > version wins', by silently overwri

Re: [Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-10 Thread Eric Blake
On 03/10/2014 01:31 AM, Chunyan Liu wrote: > Improve opt_get and opt_set group of functions. For opt_get, check and handle > NULL input; for opt_set, when set to an existing option, rewrite the option > with new value. > > Signed-off-by: Dong Xu Wang > Signed-off-by: Chunyan Liu > --- > include

[Qemu-devel] [PATCH v22 03/25] improve some functions in qemu-option.c

2014-03-10 Thread Chunyan Liu
Improve opt_get and opt_set group of functions. For opt_get, check and handle NULL input; for opt_set, when set to an existing option, rewrite the option with new value. Signed-off-by: Dong Xu Wang Signed-off-by: Chunyan Liu --- include/qemu/option_int.h | 4 +-- util/qemu-option.c| 81