gvariant: Zero-initialise various GVariantSerialised objects

The following few commits will add a couple of new fields to
`GVariantSerialised`, and they should be zero-filled by default.

Try and pre-empt that a bit by zero-filling `GVariantSerialised` by
default in a few places.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2121
This commit is contained in:
Philip Withnall 2022-10-25 18:05:52 +01:00 committed by Michael Catanzaro
parent d51c16a7c8
commit fd215233ae
2 changed files with 7 additions and 7 deletions

View File

@ -5944,7 +5944,7 @@ g_variant_byteswap (GVariant *value)
if (alignment) if (alignment)
/* (potentially) contains multi-byte numeric data */ /* (potentially) contains multi-byte numeric data */
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
GVariant *trusted; GVariant *trusted;
GBytes *bytes; GBytes *bytes;

View File

@ -1438,7 +1438,7 @@ test_maybe (void)
for (flavour = 0; flavour < 8; flavour += alignment) for (flavour = 0; flavour < 8; flavour += alignment)
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
GVariantSerialised child; GVariantSerialised child;
serialised.type_info = type_info; serialised.type_info = type_info;
@ -1562,7 +1562,7 @@ test_array (void)
for (flavour = 0; flavour < 8; flavour += alignment) for (flavour = 0; flavour < 8; flavour += alignment)
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
serialised.type_info = array_info; serialised.type_info = array_info;
serialised.data = flavoured_malloc (needed_size, flavour); serialised.data = flavoured_malloc (needed_size, flavour);
@ -1726,7 +1726,7 @@ test_tuple (void)
for (flavour = 0; flavour < 8; flavour += alignment) for (flavour = 0; flavour < 8; flavour += alignment)
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
serialised.type_info = type_info; serialised.type_info = type_info;
serialised.data = flavoured_malloc (needed_size, flavour); serialised.data = flavoured_malloc (needed_size, flavour);
@ -1821,7 +1821,7 @@ test_variant (void)
for (flavour = 0; flavour < 8; flavour += alignment) for (flavour = 0; flavour < 8; flavour += alignment)
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
GVariantSerialised child; GVariantSerialised child;
serialised.type_info = type_info; serialised.type_info = type_info;
@ -2268,7 +2268,7 @@ serialise_tree (TreeInstance *tree,
static void static void
test_byteswap (void) test_byteswap (void)
{ {
GVariantSerialised one, two; GVariantSerialised one = { 0, }, two = { 0, };
TreeInstance *tree; TreeInstance *tree;
tree = tree_instance_new (NULL, 3); tree = tree_instance_new (NULL, 3);
@ -2342,7 +2342,7 @@ test_serialiser_children (void)
static void static void
test_fuzz (gdouble *fuzziness) test_fuzz (gdouble *fuzziness)
{ {
GVariantSerialised serialised; GVariantSerialised serialised = { 0, };
TreeInstance *tree; TreeInstance *tree;
/* make an instance */ /* make an instance */