Commit e16677a7 authored by Olivier Crête's avatar Olivier Crête
Browse files

Replace g_malloc/g_new with g_alloca where possible

This should reduce the overhead a bit.
parent 9fb4ab90
......@@ -284,8 +284,8 @@ nice_datagram_based_receive_messages (GDatagramBased *datagram_based,
}
/* Convert from #GInputMessages to #NiceInputMessages. */
nice_messages = g_new0 (NiceInputMessage, num_messages);
nice_addresses = g_new0 (NiceAddress, num_messages);
nice_messages = g_alloca (sizeof (NiceInputMessage) * num_messages);
nice_addresses = g_alloca (sizeof (NiceAddress) * num_messages);
for (i = 0; i < num_messages; i++) {
nice_messages[i].buffers = messages[i].vectors;
......@@ -331,9 +331,6 @@ nice_datagram_based_receive_messages (GDatagramBased *datagram_based,
}
}
g_free (nice_addresses);
g_free (nice_messages);
return retval;
}
......@@ -361,7 +358,7 @@ nice_datagram_based_send_messages (GDatagramBased *datagram_based,
}
/* Convert the GOutputMessages to NiceOutputMessages. */
nice_messages = g_new0 (NiceOutputMessage, num_messages);
nice_messages = g_alloca (sizeof (NiceOutputMessage) * num_messages);
for (i = 0; i < num_messages; i++) {
nice_messages[i].buffers = messages[i].vectors;
......@@ -420,7 +417,6 @@ nice_datagram_based_send_messages (GDatagramBased *datagram_based,
}
done:
g_free (nice_messages);
g_clear_object (&agent);
return retval;
......
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