[libsoup] Add warning in a "can't happen" case



commit 373d0a5508a0f8edd93a784899f805f6352d227b
Author: Benjamin Otte <otte gnome org>
Date:   Mon Aug 17 19:29:17 2009 +0200

    Add warning in a "can't happen" case
    
    This is mostly to indicate that we did not forget error checking.

 libsoup/soup-address.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-address.c b/libsoup/soup-address.c
index 043bac2..0aa0547 100644
--- a/libsoup/soup-address.c
+++ b/libsoup/soup-address.c
@@ -566,7 +566,11 @@ update_addrs (SoupAddress *addr, GList *addrs, GError *error)
 
 	len = g_socket_address_get_native_size (gsa);
 	priv->sockaddr = g_malloc (len);
-	g_socket_address_to_native (gsa, priv->sockaddr, len, NULL);
+	if (!g_socket_address_to_native (gsa, priv->sockaddr, len, NULL)) {
+                /* can't happen: We know the address format is supported
+                 * and the buffer is large enough */
+                g_warn_if_reached ();
+        }
 
 	return SOUP_STATUS_OK;
 }



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