
On 05/13/2013 02:05 AM, Osier Yang wrote:
On 27/04/13 05:01, Eric Blake wrote:
In an upcoming patch, I need the way to safely transfer a nested virJSON object out of its parent container for independent use, even after the parent is freed.
* src/util/virjson.h (virJSONValueObjectRemoveKey): New function. (_virJSONObject, _virJSONArray): Use correct type. * src/util/virjson.c (virJSONValueObjectRemoveKey): Implement it. * src/libvirt_private.syms (virjson.h): Export it. * tests/jsontest.c (mymain): Test it.
+/* Remove the key-value pair tied to KEY out of OBJECT. If VALUE is + * not NULL, the dropped value object is returned instead of freed.
How about:
s/KEY/@key/, s/OBJECT/@object/, s/VALUE/@value/, ?
Sure thing. Some of my old habits slipping through (not every project uses doxygen-style markup :)
+int virJSONValueObjectRemoveKey(virJSONValuePtr object, const char *key,
Worth to add ATTRIBUTE_NONNULL for "object" and "key"?
Good idea. Consider it done :)
with the questions.
ACK with the two questions resolved.
Will push shortly as amended. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org