gtype: Move an assertion to help out the static analyser

scan-build is worried that `node->data->common.value_table->value_init`
will be a `NULL` pointer dereference in the assignment to
`node->mutatable_check_cache`.

There’s already an assertion immediately below to check against this, so
let’s move it up a line to help the static analyser out.

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

Helps: #1767
This commit is contained in:
Philip Withnall 2024-04-09 22:50:05 +01:00
parent 6a1beede60
commit 70a49e35cc
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -1197,12 +1197,12 @@ type_data_make_W (TypeNode *node,
if (value_table->lcopy_format)
strcat (p, value_table->lcopy_format);
}
node->data->common.value_table = vtable;
g_assert (node->data->common.value_table != NULL); /* paranoid */
node->mutatable_check_cache = (node->data->common.value_table->value_init != NULL &&
!((G_TYPE_FLAG_VALUE_ABSTRACT | G_TYPE_FLAG_ABSTRACT) &
GPOINTER_TO_UINT (type_get_qdata_L (node, static_quark_type_flags))));
g_assert (node->data->common.value_table != NULL); /* paranoid */
g_atomic_int_set ((int *) &node->ref_count, 1);
}