On 12/19/2013 12:47 PM, Max Reitz wrote: > This function splits a QDict consisting of entries prefixed by > incrementally enumerated indices into a QList of QDicts. > > Signed-off-by: Max Reitz <mre...@redhat.com> > Reviewed-by: Kevin Wolf <kw...@redhat.com> > --- > include/qapi/qmp/qdict.h | 1 + > qobject/qdict.c | 36 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 37 insertions(+)
> + > +/** > + * qdict_array_split(): This function creates a QList of QDicts. Every entry > in > + * the original QDict with a key prefixed "%u.", where %u designates an > unsigned > + * integer starting at 0 and incrementally counting up, will be moved to a > new > + * QDict at index %u in the output QList with the key prefix removed. The > + * function terminates when there is no entry in the QDict with a prefix > + * directly (incrementally) following the last one. > + * Example: {"0.a": 42, "0.b": 23, "1.x": 0, "3.y": 1, "o.o": 7} > + * (or {"1.x": 0, "3.y": 1, "0.a": 42, "o.o": 7, "0.b": 23}) > + * => [{"a": 42, "b": 23}, {"x": 0}] > + * and {"3.y": 1, "o.o": 7} (remainder of the old QDict) It took me a read through the function to realize the "and ... (remainder)" comment refers to the input QDict, which is modified in-place as a side effect. Maybe change the first sentence to: This function moves array-like elements of a QDict into a new QList of QDicts. But that's minor, and doesn't stop me from adding: Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature