Commit 384386b9 authored by Kai Vehmanen's avatar Kai Vehmanen

Changed local iface struct to include an embedded NiceAddress.

darcs-hash:20070918151032-77cd4-b2bed5f70964c43537790b3d911eab268fab3f4c.gz
parent bf9100e2
......@@ -55,7 +55,7 @@ main (void)
NiceInterface *iface = i->data;
gchar addr[NICE_ADDRESS_STRING_LEN];
nice_address_to_string (iface->addr, addr);
nice_address_to_string (&iface->addr, addr);
g_print ("%s: %s\n", iface->name, addr);
nice_interface_free (iface);
}
......
......@@ -50,27 +50,12 @@
NICEAPI_EXPORT NiceInterface *
nice_interface_new ()
{
NiceInterface *iface;
NiceAddress *addr = nice_address_new ();
if (addr == NULL)
return NULL;
iface = g_slice_new0 (NiceInterface);
if (iface == NULL)
{
nice_address_free (addr);
return NULL;
}
iface->addr = addr;
return iface;
return g_slice_new0 (NiceInterface);
}
NICEAPI_EXPORT void
nice_interface_free (NiceInterface *iface)
{
if (iface->addr != NULL)
nice_address_free (iface->addr);
g_slice_free (NiceInterface, iface);
}
......@@ -98,7 +83,7 @@ nice_list_local_interfaces ()
iface = nice_interface_new ();
strncpy (iface->name, i->ifa_name, sizeof (iface->name));
iface->name[sizeof (iface->name) - 1] = '\0';
nice_address_set_from_sockaddr (iface->addr, addr);
nice_address_set_from_sockaddr (&(iface->addr), addr);
ret = g_slist_append (ret, iface);
}
}
......
......@@ -48,8 +48,8 @@ typedef struct _NiceInterface NiceInterface;
struct _NiceInterface
{
NiceAddress *addr;
gchar name[16];
NiceAddress addr;
};
NiceInterface *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment