gio: GCancellable can be used concurrently
[platform/upstream/glib.git] / gio / ginetaddress.c
index f6c5d5b..743ac06 100644 (file)
@@ -33,7 +33,6 @@
 #include "glibintl.h"
 #include "gnetworkingprivate.h"
 
-#include "gioalias.h"
 
 /**
  * SECTION:ginetaddress
@@ -415,6 +414,7 @@ g_inet_address_new_from_string (const gchar *string)
 
   /* Make sure _g_networking_init() has been called */
   type = g_inet_address_get_type ();
+  (type); /* To avoid -Wunused-but-set-variable */
 
 #ifdef G_OS_WIN32
   memset (&sa, 0, sizeof (sa));
@@ -571,7 +571,7 @@ g_inet_address_to_string (GInetAddress *address)
 }
 
 /**
- * g_inet_address_to_bytes:
+ * g_inet_address_to_bytes: (skip)
  * @address: a #GInetAddress
  *
  * Gets the raw binary address data from @address.
@@ -867,5 +867,31 @@ g_inet_address_get_is_mc_site_local (GInetAddress *address)
     return IN6_IS_ADDR_MC_SITELOCAL (&address->priv->addr.ipv6);
 }
 
-#define __G_INET_ADDRESS_C__
-#include "gioaliasdef.c"
+/**
+ * g_inet_address_equal:
+ * @address: A #GInetAddress.
+ * @other_address: Another #GInetAddress.
+ *
+ * Checks if two #GInetAddress instances are equal, e.g. the same address.
+ *
+ * Returns: %TRUE if @address and @other_address are equal, %FALSE otherwise.
+ *
+ * Since: 2.30
+ */
+gboolean
+g_inet_address_equal (GInetAddress *address,
+                      GInetAddress *other_address)
+{
+  g_return_val_if_fail (G_IS_INET_ADDRESS (address), FALSE);
+  g_return_val_if_fail (G_IS_INET_ADDRESS (other_address), FALSE);
+
+  if (g_inet_address_get_family (address) != g_inet_address_get_family (other_address))
+    return FALSE;
+
+  if (memcmp (g_inet_address_to_bytes (address),
+              g_inet_address_to_bytes (other_address),
+              g_inet_address_get_native_size (address)) != 0)
+    return FALSE;
+
+  return TRUE;
+}