[glib] gsocketaddress: Add an assertion to help static analysis



commit 956c58c7f202009d769aefc9bc8adaedccec074d
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Nov 26 11:09:58 2013 +0000

    gsocketaddress: Add an assertion to help static analysis
    
    The static analyser will check dynamic type assertions and assume that
    if they fail, the variable can either have the wrong type, or be NULL
    (which is correct). The analyser doesn’t know that other constraints in
    the API ensure the variable is non-NULL.
    
    Add a non-null assertion to help the static analyser and shut it up in
    this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=113075

 gio/gsocketaddress.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocketaddress.c b/gio/gsocketaddress.c
index 03c8ac0..90f22be 100644
--- a/gio/gsocketaddress.c
+++ b/gio/gsocketaddress.c
@@ -386,6 +386,8 @@ g_socket_address_connectable_proxy_enumerate (GSocketConnectable *connectable)
 {
   GSocketAddressEnumerator *addr_enum = NULL;
 
+  g_assert (connectable != NULL);
+
   if (G_IS_INET_SOCKET_ADDRESS (connectable) &&
       !G_IS_PROXY_ADDRESS (connectable))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]