Commit 44b332d4 authored by Philip Withnall's avatar Philip Withnall

tests: Move a closure from the heap to the stack

There is no need for this to be heap-allocated.
parent 801e6f9a
...@@ -98,7 +98,7 @@ read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) ...@@ -98,7 +98,7 @@ read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data)
int main (void) int main (void)
{ {
GThread *l_cancellation_thread, *r_cancellation_thread; GThread *l_cancellation_thread, *r_cancellation_thread;
CancellationData *l_data, *r_data; CancellationData l_data, r_data;
const TestIOStreamCallbacks callbacks = { const TestIOStreamCallbacks callbacks = {
read_thread_cb, read_thread_cb,
...@@ -114,29 +114,25 @@ int main (void) ...@@ -114,29 +114,25 @@ int main (void)
g_type_init (); g_type_init ();
g_thread_init (NULL); g_thread_init (NULL);
l_data = g_malloc0 (sizeof (CancellationData)); l_data.cancellable = g_cancellable_new ();
l_data->cancellable = g_cancellable_new (); l_data.blocking = FALSE;
l_data->blocking = FALSE;
r_data = g_malloc0 (sizeof (CancellationData)); r_data.cancellable = g_cancellable_new ();
r_data->cancellable = g_cancellable_new (); r_data.blocking = FALSE;
r_data->blocking = FALSE;
l_cancellation_thread = spawn_thread ("libnice L cancel", l_cancellation_thread = spawn_thread ("libnice L cancel",
cancellation_thread_cb, l_data); cancellation_thread_cb, &l_data);
r_cancellation_thread = spawn_thread ("libnice R cancel", r_cancellation_thread = spawn_thread ("libnice R cancel",
cancellation_thread_cb, r_data); cancellation_thread_cb, &r_data);
run_io_stream_test (30, TRUE, &callbacks, l_data, NULL, r_data, NULL); run_io_stream_test (30, TRUE, &callbacks, &l_data, NULL, &r_data, NULL);
g_thread_join (l_cancellation_thread); g_thread_join (l_cancellation_thread);
g_thread_join (r_cancellation_thread); g_thread_join (r_cancellation_thread);
/* Free things. */ /* Free things. */
g_object_unref (r_data->cancellable); g_object_unref (r_data.cancellable);
g_free (r_data); g_object_unref (l_data.cancellable);
g_object_unref (l_data->cancellable);
g_free (l_data);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
WSACleanup (); WSACleanup ();
......
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