summaryrefslogtreecommitdiff
path: root/tests/gnio-util.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2010-01-27 14:04:42 +1100
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-02-23 09:53:36 +1100
commitc9e09c7c21670f37fa0169fa12458b103396d447 (patch)
treea256834f9f9a6ea0f7769ac8fbe0c5aa5ea5ddc3 /tests/gnio-util.c
parentacac4a0ceb499d7d3ddb1a6111a89b44b0937e64 (diff)
downloadtelepathy-glib-c9e09c7c21670f37fa0169fa12458b103396d447.tar.gz
Use tp_value_array_build to build GValueArrays
Diffstat (limited to 'tests/gnio-util.c')
-rw-r--r--tests/gnio-util.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/tests/gnio-util.c b/tests/gnio-util.c
index 85ca66641..579db9b29 100644
--- a/tests/gnio-util.c
+++ b/tests/gnio-util.c
@@ -26,7 +26,7 @@
static void
test_variant_to_sockaddr_ipv4 (void)
{
- GValueArray *array = g_value_array_new (2);
+ GValueArray *array;
GValue value = { 0, };
GSocketAddress *sockaddr;
GInetSocketAddress *inetaddr;
@@ -35,15 +35,10 @@ test_variant_to_sockaddr_ipv4 (void)
guint16 port;
/* set up an address variant */
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, IPV4_ADDR);
- g_value_array_append (array, &value);
- g_value_unset (&value);
-
- g_value_init (&value, G_TYPE_UINT);
- g_value_set_uint (&value, PORT);
- g_value_array_append (array, &value);
- g_value_unset (&value);
+ array = tp_value_array_build (2,
+ G_TYPE_STRING, IPV4_ADDR,
+ G_TYPE_UINT, PORT,
+ G_TYPE_INVALID);
g_value_init (&value, TP_STRUCT_TYPE_SOCKET_ADDRESS_IPV4);
g_value_take_boxed (&value, array);
@@ -73,7 +68,7 @@ test_variant_to_sockaddr_ipv4 (void)
static void
test_variant_to_sockaddr_ipv6 (void)
{
- GValueArray *array = g_value_array_new (2);
+ GValueArray *array;
GValue value = { 0, };
GSocketAddress *sockaddr;
GInetSocketAddress *inetaddr;
@@ -82,15 +77,10 @@ test_variant_to_sockaddr_ipv6 (void)
guint16 port;
/* set up an address variant */
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, IPV6_ADDR);
- g_value_array_append (array, &value);
- g_value_unset (&value);
-
- g_value_init (&value, G_TYPE_UINT);
- g_value_set_uint (&value, PORT);
- g_value_array_append (array, &value);
- g_value_unset (&value);
+ array = tp_value_array_build (2,
+ G_TYPE_STRING, IPV6_ADDR,
+ G_TYPE_UINT, PORT,
+ G_TYPE_INVALID);
g_value_init (&value, TP_STRUCT_TYPE_SOCKET_ADDRESS_IPV6);
g_value_take_boxed (&value, array);