[glib] gio/tests: Add a non-NULL assertion to help static analysis
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gio/tests: Add a non-NULL assertion to help static analysis
- Date: Wed, 27 Nov 2013 10:02:47 +0000 (UTC)
commit 32118951ea827811d3885568916de89a0e5d1f4e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Nov 26 11:20:01 2013 +0000
gio/tests: Add a non-NULL assertion to help static analysis
The static analyser (correctly) considers a type check to fail if the
variable is NULL. In this case, the address must be non-NULL as no error
was thrown by g_socket_connection_get_remote_address(), but the static
analyser doesn’t know this.
Add a non-NULL assertion anyway, both to shut the analyser up, and
because it’s good extra testing.
Found by scan-build.
https://bugzilla.gnome.org/show_bug.cgi?id=113075
gio/tests/proxy-test.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/proxy-test.c b/gio/tests/proxy-test.c
index ad2fcdf..af91f38 100644
--- a/gio/tests/proxy-test.c
+++ b/gio/tests/proxy-test.c
@@ -889,7 +889,7 @@ assert_direct (GSocketConnection *conn)
addr = g_socket_connection_get_remote_address (conn, &error);
g_assert_no_error (error);
- g_assert (!G_IS_PROXY_ADDRESS (addr));
+ g_assert (addr != NULL && !G_IS_PROXY_ADDRESS (addr));
g_object_unref (addr);
addr = g_socket_connection_get_local_address (conn, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]