Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-03 Thread Markus Armbruster
Luiz Capitulino writes: > On Wed, 02 Jun 2010 08:59:11 +0200 > Markus Armbruster wrote: > >> Luiz Capitulino writes: > > [...] > >> > + >> > +type = qobject_to_qstring(obj); >> > +assert(type != NULL); >> > + >> > +if (qstring_get_str(type)[0] == 'O') { >> > +QemuOptsList *o

Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-02 Thread Markus Armbruster
Luiz Capitulino writes: > On Wed, 02 Jun 2010 09:22:40 +0200 > Markus Armbruster wrote: [...] >> Higher order functions rock. But C is too static and limited for >> elegant use of higher order functions. Means to construct loops are >> usually more convenient to use, and yield more readable co

Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-02 Thread Luiz Capitulino
On Wed, 02 Jun 2010 09:22:40 +0200 Markus Armbruster wrote: > There's more... Good! > Luiz Capitulino writes: [...] > > +static void check_mandatory_args(const char *cmd_arg_name, > > + QObject *obj, void *opaque) > > +{ > > +QString *type; > > +QMPAr

Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-02 Thread Luiz Capitulino
On Wed, 02 Jun 2010 08:59:11 +0200 Markus Armbruster wrote: > Luiz Capitulino writes: [...] > > + > > +type = qobject_to_qstring(obj); > > +assert(type != NULL); > > + > > +if (qstring_get_str(type)[0] == 'O') { > > +QemuOptsList *opts_list = qemu_find_opts(cmd_arg_name); >

Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-02 Thread Markus Armbruster
There's more... Luiz Capitulino writes: > This commit introduces the first half of qmp_check_client_args(), > which is the new client argument checker. > > It's introduced on top of the existing code, so that there are > no regressions during the transition. > > It works this way: the command's

Re: [Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-01 Thread Markus Armbruster
Luiz Capitulino writes: > This commit introduces the first half of qmp_check_client_args(), > which is the new client argument checker. > > It's introduced on top of the existing code, so that there are > no regressions during the transition. > > It works this way: the command's args_type field (

[Qemu-devel] [PATCH 3/9] QMP: First half of the new argument checking code

2010-06-01 Thread Luiz Capitulino
This commit introduces the first half of qmp_check_client_args(), which is the new client argument checker. It's introduced on top of the existing code, so that there are no regressions during the transition. It works this way: the command's args_type field (from qemu-monitor.hx) is transformed i