Commit f90200c0 authored by James Westman's avatar James Westman Committed by Olivier Crête

address: Add introspection-friendly to_string_dup

nice_address_to_string expects an already-allocated string, which is not
great for introspection. Adds nice_address_to_string_dup, which does the
same thing, but returns a newly allocated string.
parent 8671aed5
......@@ -261,6 +261,16 @@ nice_address_to_string (const NiceAddress *addr, gchar *dst)
}
}
NICEAPI_EXPORT gchar *
nice_address_dup_string (const NiceAddress *addr)
{
char dst[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN)] = "";
nice_address_to_string (addr, dst);
return g_strdup (dst);
}
NICEAPI_EXPORT gboolean
nice_address_equal (const NiceAddress *a, const NiceAddress *b)
......
......@@ -260,7 +260,7 @@ gboolean
nice_address_equal_no_port (const NiceAddress *a, const NiceAddress *b);
/**
* nice_address_to_string:
* nice_address_to_string: (skip)
* @addr: The #NiceAddress to query
* @dst: The string to fill
*
......@@ -270,6 +270,19 @@ nice_address_equal_no_port (const NiceAddress *a, const NiceAddress *b);
void
nice_address_to_string (const NiceAddress *addr, gchar *dst);
/**
* nice_address_dup_string:
* @addr: The #NiceAddress to query
*
* Transforms the address @addr into a newly allocated human readable string
*
* Returns: (transfer full): the address string
*
* Since: 0.1.20
*/
gchar *
nice_address_dup_string (const NiceAddress *addr);
/**
* nice_address_is_private:
* @addr: The #NiceAddress to query
......
......@@ -145,6 +145,7 @@ nice_address_copy_to_sockaddr
nice_address_equal
nice_address_equal_no_port
nice_address_to_string
nice_address_dup_string
nice_address_is_private
nice_address_is_linklocal
nice_address_is_valid
......
......@@ -2,6 +2,7 @@ nice_address_copy_to_sockaddr
nice_address_dup
nice_address_equal
nice_address_equal_no_port
nice_address_dup_string
nice_address_free
nice_address_get_port
nice_address_get_type
......
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