diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-09-24 14:42:19 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-09-25 09:54:19 +0100 |
commit | 44b332d4495151a5b9fd0603b4a68874c652318e (patch) | |
tree | 5fa82ac1727aeee6c97e37cff4405b60a0688301 /tests | |
parent | 801e6f9a6f5494f1ff39b54f5714a0e24c87ad2f (diff) | |
download | libnice-44b332d4495151a5b9fd0603b4a68874c652318e.tar.gz |
tests: Move a closure from the heap to the stack
There is no need for this to be heap-allocated.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-io-stream-cancelling.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/test-io-stream-cancelling.c b/tests/test-io-stream-cancelling.c index 05cbaa0..b43c0fd 100644 --- a/tests/test-io-stream-cancelling.c +++ b/tests/test-io-stream-cancelling.c @@ -98,7 +98,7 @@ read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) int main (void) { GThread *l_cancellation_thread, *r_cancellation_thread; - CancellationData *l_data, *r_data; + CancellationData l_data, r_data; const TestIOStreamCallbacks callbacks = { read_thread_cb, @@ -114,29 +114,25 @@ int main (void) g_type_init (); g_thread_init (NULL); - l_data = g_malloc0 (sizeof (CancellationData)); - l_data->cancellable = g_cancellable_new (); - l_data->blocking = FALSE; + l_data.cancellable = g_cancellable_new (); + l_data.blocking = FALSE; - r_data = g_malloc0 (sizeof (CancellationData)); - r_data->cancellable = g_cancellable_new (); - r_data->blocking = FALSE; + r_data.cancellable = g_cancellable_new (); + r_data.blocking = FALSE; 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", - 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 (r_cancellation_thread); /* Free things. */ - g_object_unref (r_data->cancellable); - g_free (r_data); - g_object_unref (l_data->cancellable); - g_free (l_data); + g_object_unref (r_data.cancellable); + g_object_unref (l_data.cancellable); #ifdef G_OS_WIN32 WSACleanup (); |