Re: [PATCH 1/4] json: support removing a value from an object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]