tests: Tidy up GError assignment

No need to clear it to NULL before every time it’s used, since we assert
that it’s never set.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-10-30 15:11:36 +00:00
parent 0e1549eb20
commit dd5132e041

View File

@ -188,7 +188,7 @@ test_create_structure (gconstpointer test_data)
GFile *root; GFile *root;
GFile *child; GFile *child;
gboolean res; gboolean res;
GError *error; GError *error = NULL;
GFileOutputStream *outs; GFileOutputStream *outs;
GDataOutputStream *outds; GDataOutputStream *outds;
guint i; guint i;
@ -241,7 +241,6 @@ test_create_structure (gconstpointer test_data)
if ((item.mode > 0) && (posix_compat)) if ((item.mode > 0) && (posix_compat))
{ {
error = NULL;
res = res =
g_file_set_attribute_uint32 (child, G_FILE_ATTRIBUTE_UNIX_MODE, g_file_set_attribute_uint32 (child, G_FILE_ATTRIBUTE_UNIX_MODE,
item.mode, item.mode,
@ -277,7 +276,6 @@ test_create_structure (gconstpointer test_data)
child = g_file_get_child (root, "pattern_file"); child = g_file_get_child (root, "pattern_file");
g_assert (child != NULL); g_assert (child != NULL);
error = NULL;
outs = outs =
g_file_replace (child, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error); g_file_replace (child, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
@ -287,11 +285,10 @@ test_create_structure (gconstpointer test_data)
g_assert (outds != NULL); g_assert (outds != NULL);
for (i = 0; i < PATTERN_FILE_SIZE; i++) for (i = 0; i < PATTERN_FILE_SIZE; i++)
{ {
error = NULL;
res = g_data_output_stream_put_byte (outds, i % 256, NULL, &error); res = g_data_output_stream_put_byte (outds, i % 256, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
} }
error = NULL;
res = g_output_stream_close (G_OUTPUT_STREAM (outs), NULL, &error); res = g_output_stream_close (G_OUTPUT_STREAM (outs), NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_object_unref (outds); g_object_unref (outds);