[glib] gio/tests: Add non-NULL assertions to help static analysis
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gio/tests: Add non-NULL assertions to help static analysis
- Date: Wed, 27 Nov 2013 10:02:42 +0000 (UTC)
commit c9ccc2af9157b99651507eb078e6cdd8d31d3bd6
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Nov 26 11:18:35 2013 +0000
gio/tests: Add non-NULL assertions to help static analysis
These prevent some false positives from the static analyser which are
caused by it not inspecting the invariants of
g_subprocess_communicate[_utf8]_finish() (i.e. that stdout and
stdout_str will always be set unless an error was returned).
They’re also good testing anyway.
Found by scan-build.
https://bugzilla.gnome.org/show_bug.cgi?id=113075
gio/tests/gsubprocess.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c
index 48de292..4e70c4d 100644
--- a/gio/tests/gsubprocess.c
+++ b/gio/tests/gsubprocess.c
@@ -583,10 +583,12 @@ on_communicate_complete (GObject *proc,
if (!data->is_utf8)
{
+ g_assert (stdout != NULL);
stdout_data = g_bytes_get_data (stdout, &stdout_len);
}
else
{
+ g_assert (stdout_str != NULL);
stdout_data = (guint8*)stdout_str;
stdout_len = strlen (stdout_str);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]