diff mbox

[PULL,for-2.5,00/10] QOM devices patch queue 2015-11-18

Message ID 564DD82B.5070203@suse.de
State New
Headers show

Commit Message

Andreas Färber Nov. 19, 2015, 2:09 p.m. UTC
Am 19.11.2015 um 12:53 schrieb Daniel P. Berrange:
> On Thu, Nov 19, 2015 at 10:54:15AM +0000, Peter Maydell wrote:
>> On 18 November 2015 at 20:39, Andreas Färber <afaerber@suse.de> wrote:
>>> Hello Peter,
>>>
>>> This is my late QOM (devices) patch queue. Please pull.
>>>
>>> Regards,
>>> Andreas
>>>
>>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>> Cc: Daniel P. Berrange <berrange@redhat.com>
>>> Cc: Pavel Fedin <p.fedin@samsung.com>
>>>
>>> The following changes since commit 74fcbd22d20a2fbc1a47a7b00cce5bf98fd7be5f:
>>>
>>>   hw/misc: Add support for ADC controller in Xilinx Zynq 7000 (2015-11-12 21:30:42 +0000)
>>>
>>> are available in the git repository at:
>>>
>>>   git://github.com/afaerber/qemu-cpu.git tags/qom-devices-for-peter
>>>
>>> for you to fetch changes up to c5760450796433621ccdc125866a84b892e2d5b6:
>>>
>>>   MAINTAINERS: Add check-qom-{interface,proplist} to QOM (2015-11-18 21:13:50 +0100)
>>>
>>> ----------------------------------------------------------------
>>> QOM infrastructure fixes and device conversions
>>>
>>> * Fix for properties on objects > 4 GiB
>>> * Performance improvements for QOM property handling
>>> * Assertion cleanups
>>> * MAINTAINERS additions
>>
>> Hi. Unfortunately this doesn't build with our minimum supported
>> glib version:
>>
>> /Users/pm215/src/qemu-for-merges/qom/object.c:921:9: warning: implicit
>> declaration of function 'g_hash_table_contains' is invalid in C99
>> [-Wimplicit-function-declaration]
>>     if (g_hash_table_contains(obj->properties, name)) {
>>         ^
>>
>> g_hash_table_contains was only introduced in glib 2.32.
> 
> Since we never store NULL as a valid value in the hash tble, we
> can simply replace this with g_hash_table_lookup instead

Seems to work fine, too:

                        object_get_typename(obj));

Will respin.

Thanks,
Andreas

Comments

Daniel P. Berrangé Nov. 19, 2015, 2:13 p.m. UTC | #1
On Thu, Nov 19, 2015 at 03:09:47PM +0100, Andreas Färber wrote:
> Am 19.11.2015 um 12:53 schrieb Daniel P. Berrange:
> > On Thu, Nov 19, 2015 at 10:54:15AM +0000, Peter Maydell wrote:
> >> On 18 November 2015 at 20:39, Andreas Färber <afaerber@suse.de> wrote:
> >>> Hello Peter,
> >>>
> >>> This is my late QOM (devices) patch queue. Please pull.
> >>>
> >>> Regards,
> >>> Andreas
> >>>
> >>> Cc: Peter Maydell <peter.maydell@linaro.org>
> >>> Cc: Daniel P. Berrange <berrange@redhat.com>
> >>> Cc: Pavel Fedin <p.fedin@samsung.com>
> >>>
> >>> The following changes since commit 74fcbd22d20a2fbc1a47a7b00cce5bf98fd7be5f:
> >>>
> >>>   hw/misc: Add support for ADC controller in Xilinx Zynq 7000 (2015-11-12 21:30:42 +0000)
> >>>
> >>> are available in the git repository at:
> >>>
> >>>   git://github.com/afaerber/qemu-cpu.git tags/qom-devices-for-peter
> >>>
> >>> for you to fetch changes up to c5760450796433621ccdc125866a84b892e2d5b6:
> >>>
> >>>   MAINTAINERS: Add check-qom-{interface,proplist} to QOM (2015-11-18 21:13:50 +0100)
> >>>
> >>> ----------------------------------------------------------------
> >>> QOM infrastructure fixes and device conversions
> >>>
> >>> * Fix for properties on objects > 4 GiB
> >>> * Performance improvements for QOM property handling
> >>> * Assertion cleanups
> >>> * MAINTAINERS additions
> >>
> >> Hi. Unfortunately this doesn't build with our minimum supported
> >> glib version:
> >>
> >> /Users/pm215/src/qemu-for-merges/qom/object.c:921:9: warning: implicit
> >> declaration of function 'g_hash_table_contains' is invalid in C99
> >> [-Wimplicit-function-declaration]
> >>     if (g_hash_table_contains(obj->properties, name)) {
> >>         ^
> >>
> >> g_hash_table_contains was only introduced in glib 2.32.
> > 
> > Since we never store NULL as a valid value in the hash tble, we
> > can simply replace this with g_hash_table_lookup instead
> 
> Seems to work fine, too:
> 
> diff --git a/qom/object.c b/qom/object.c
> index 19e7561..ff34c86 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -918,7 +918,7 @@ object_property_add(Object *obj, const char *name,
> const char *type,
>          return ret;
>      }
> 
> -    if (g_hash_table_contains(obj->properties, name)) {
> +    if (g_hash_table_lookup(obj->properties, name) != NULL) {
>          error_setg(errp, "attempt to add duplicate property '%s'"
>                         " to object (type '%s')", name,
>                         object_get_typename(obj));
> 
> Will respin.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Regards,
Daniel
diff mbox

Patch

diff --git a/qom/object.c b/qom/object.c
index 19e7561..ff34c86 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -918,7 +918,7 @@  object_property_add(Object *obj, const char *name,
const char *type,
         return ret;
     }

-    if (g_hash_table_contains(obj->properties, name)) {
+    if (g_hash_table_lookup(obj->properties, name) != NULL) {
         error_setg(errp, "attempt to add duplicate property '%s'"
                        " to object (type '%s')", name,