Commit 9117c6d0 authored by Dafydd Harries's avatar Dafydd Harries

make address memebers of Candidate not pointers

darcs-hash:20070122162925-c9803-182e8ac93559f46ec08b084a5ab14d316c367bf5.gz
parent 5728d6e1
......@@ -146,8 +146,6 @@ candidate_new (CandidateType type)
void
candidate_free (Candidate *candidate)
{
address_free (candidate->addr);
address_free (candidate->base_addr);
g_slice_free (Candidate, candidate);
}
......@@ -376,8 +374,8 @@ ice_agent_add_local_host_candidate (
candidate->id = agent->next_candidate_id++;
candidate->stream_id = stream_id;
candidate->component_id = component_id;
candidate->addr = address_dup (address);
candidate->base_addr = address_dup (address);
candidate->addr = *address;
candidate->base_addr = *address;
agent->local_candidates = g_slist_append (agent->local_candidates,
candidate);
......@@ -448,7 +446,7 @@ ice_agent_add_remote_candidate (
candidate = candidate_new (type);
/* do remote candidates need IDs? */
candidate->id = 0;
candidate->addr = address_dup (addr);
candidate->addr = *addr;
candidate->port = port;
agent->remote_candidates = g_slist_append (agent->remote_candidates,
......
......@@ -68,8 +68,8 @@ struct _candidate
{
CandidateType type;
guint id;
Address *addr;
Address *base_addr;
Address addr;
Address base_addr;
// guint sock;
guint16 port;
guint32 priority;
......
......@@ -23,7 +23,7 @@ main (void)
g_assert (address_set_ipv4_from_string (&addr, "192.168.0.1"));
candidate = candidate_from_string ("H/192.168.0.1/1234");
g_assert (candidate != NULL);
g_assert (address_equal (&addr, candidate->addr));
g_assert (address_equal (&addr, &(candidate->addr)));
g_assert (candidate->port == 1234);
str = candidate_to_string (candidate);
......
......@@ -51,7 +51,7 @@ main (void)
g_assert (agent->local_candidates != NULL);
g_assert (g_slist_length (agent->local_candidates) == 1);
candidate = (Candidate *) agent->local_candidates->data;
g_assert (address_equal (candidate->addr, &addr_local));
g_assert (address_equal (&(candidate->addr), &addr_local));
g_assert (candidate->id == 1);
/* fake socket manager uses incremental port numbers starting at 1 */
g_assert (candidate->port == 1);
......@@ -62,7 +62,7 @@ main (void)
g_assert (agent->remote_candidates != NULL);
g_assert (g_slist_length (agent->remote_candidates) == 1);
candidate = (Candidate *) agent->remote_candidates->data;
g_assert (address_equal (candidate->addr, &addr_remote));
g_assert (address_equal (&(candidate->addr), &addr_remote));
g_assert (candidate->port == 2345);
/* check there's no unexpected events, and clean up */
......
......@@ -75,7 +75,7 @@ candidate_from_string (const gchar *s)
candidate = candidate_new (type);
addr = address_new ();
address_set_ipv4 (addr, ntohl (ip));
candidate->addr = addr;
candidate->addr = *addr;
candidate->port = port;
return candidate;
......@@ -88,9 +88,6 @@ candidate_to_string (Candidate *candidate)
gchar *ret;
gchar type;
if (!candidate->addr)
return NULL;
switch (candidate->type)
{
case CANDIDATE_TYPE_HOST:
......@@ -109,7 +106,7 @@ candidate_to_string (Candidate *candidate)
return NULL;
}
addr_tmp = address_to_string (candidate->addr);
addr_tmp = address_to_string (&(candidate->addr));
ret = g_strdup_printf ("%c/%s/%d", type, addr_tmp, candidate->port);
g_free (addr_tmp);
return ret;
......
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