OSDN Git Service

qdict: Extract non-QDicts in qdict_array_split()
authorMax Reitz <mreitz@redhat.com>
Fri, 21 Feb 2014 18:11:40 +0000 (19:11 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 21 Feb 2014 21:11:23 +0000 (22:11 +0100)
commitbae3f92a016b8eddc0d5806c24baea3ecedac0a0
treed865cc966a4b75db9708e97db85b146fbabacfc7
parentae39c4b2015dd5ee35021d0f4212bb1304106524
qdict: Extract non-QDicts in qdict_array_split()

Currently, qdict_array_split() only splits off entries with a key prefix
of "%u.", packing them into a new QDict. This patch makes it support
entries with the plain key "%u" as well, directly putting them into the
new QList without creating a QDict.

If there is both an entry with a key of "%u" and other entries with keys
prefixed "%u." (for the same index), the function simply terminates.

To do this, this patch also adds a static function which tests whether a
given QDict contains any keys with the given prefix. This is used to test
whether entries with a key prefixed "%u." do exist in the source QDict
without modifying it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qobject/qdict.c