Commit cf49edba authored by Dafydd Harries's avatar Dafydd Harries
Browse files

factor out attribute decoding from memory allocation

darcs-hash:20070111161553-c9803-b38789d8d3bc3e0b58fa14d63076f8e581bfb16a.gz
parent ef2a189e
......@@ -35,13 +35,10 @@ stun_attribute_free (StunAttribute *attr)
g_slice_free (StunAttribute, attr);
}
StunAttribute *
stun_attribute_unpack (guint length, const gchar *s)
static void
_stun_attribute_unpack (StunAttribute *attr, guint length, const gchar *s)
{
StunAttribute *attr;
g_assert (length);
attr = stun_attribute_new (ntohs (*(guint16 *)s));
attr->type = ntohs (*(guint16 *) s);
switch (attr->type)
{
......@@ -54,6 +51,16 @@ stun_attribute_unpack (guint length, const gchar *s)
default:
break;
}
}
StunAttribute *
stun_attribute_unpack (guint length, const gchar *s)
{
StunAttribute *attr;
g_assert (length);
attr = stun_attribute_new (0);
_stun_attribute_unpack (attr, length, s);
return attr;
}
......
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