qdev-properties.h: Explicitly set the default value for arraylen properties
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 17 Jul 2017 12:36:06 +0000 (13:36 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 17 Jul 2017 12:36:06 +0000 (13:36 +0100)
In DEFINE_PROP_ARRAY, because we use a PropertyInfo (qdev_prop_arraylen)
which has a .set_default_value member we will set the field to a default
value. That default value will be zero, by the C rule that struct
initialization sets unmentioned members to zero if at least one member
is initialized. However it's clearer to state it explicitly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1499788408-10096-2-git-send-email-peter.maydell@linaro.org

include/hw/qdev-properties.h

index f6692d5dc355775d6de86cfedc0a5f35d610a859..12c0c7b1f61b3dc5228743af54592dfb17553d9f 100644 (file)
@@ -111,6 +111,7 @@ extern const PropertyInfo qdev_prop_link;
                           _arrayfield, _arrayprop, _arraytype) {        \
         .name = (PROP_ARRAY_LEN_PREFIX _name),                          \
         .info = &(qdev_prop_arraylen),                                  \
+        .defval.u = 0,                                                  \
         .offset = offsetof(_state, _field)                              \
             + type_check(uint32_t, typeof_field(_state, _field)),       \
         .arrayinfo = &(_arrayprop),                                     \