]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
OptsVisitor: introduce basic list modes
authorLaszlo Ersek <lersek@redhat.com>
Mon, 19 Aug 2013 22:35:33 +0000 (00:35 +0200)
committerLuiz Capitulino <lcapitulino@redhat.com>
Tue, 20 Aug 2013 15:51:59 +0000 (11:51 -0400)
commitd95704341280fc521dc2b16bbbc5858f6647e2c3
tree3b5b7b5afc47bd6c7fb3818f0af6792e30fa5fd9
parent4a44d85e28bd282f53ccf0fa933dd71b8744a229
OptsVisitor: introduce basic list modes

We're going to need more state while processing a list of repeated
options. This change eliminates "repeated_opts_first" and adds a new state
variable:

  list_mode       repeated_opts  repeated_opts_first
  --------------  -------------  -------------------
  LM_NONE         NULL           false
  LM_STARTED      non-NULL       true
  LM_IN_PROGRESS  non-NULL       false

Additionally, it is documented that lookup_scalar() and processed(), both
called by opts_type_XXX(), are invalid in LM_STARTED -- generated qapi
code calls opts_next_list() to allocate the very first link before trying
to parse a scalar into it. List mode restrictions are expressed in
positive / inclusive form.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi/opts-visitor.c