diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-06-30 20:09:30 +0100 |
---|---|---|
committer | Olivier Crête <olivier.crete@collabora.com> | 2014-07-07 15:47:02 -0400 |
commit | f80631064fc7c26553d8b6f7a59b602ca4feb648 (patch) | |
tree | 610c34d3b229c291310f91f03211eac44f4769aa /examples | |
parent | 93e18790ca6f9e0120502b43206e227bebe37dc3 (diff) | |
download | libnice-f80631064fc7c26553d8b6f7a59b602ca4feb648.tar.gz |
examples: Remove unnecessary dynamic type casts
We know the agent is a GObject — there is no need to check it at
runtime. This also improves Tartan’s static analysis of signal
connections.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sdp-example.c | 10 | ||||
-rw-r--r-- | examples/simple-example.c | 12 | ||||
-rw-r--r-- | examples/threaded-example.c | 12 |
3 files changed, 17 insertions, 17 deletions
diff --git a/examples/sdp-example.c b/examples/sdp-example.c index a1d12bc..b3c5588 100644 --- a/examples/sdp-example.c +++ b/examples/sdp-example.c @@ -130,15 +130,15 @@ example_thread(void *data) // Set the STUN settings and controlling mode if (stun_addr) { - g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL); - g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL); + g_object_set(agent, "stun-server", stun_addr, NULL); + g_object_set(agent, "stun-server-port", stun_port, NULL); } - g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL); + g_object_set(agent, "controlling-mode", controlling, NULL); // Connect to the signals - g_signal_connect(G_OBJECT(agent), "candidate-gathering-done", + g_signal_connect(agent, "candidate-gathering-done", G_CALLBACK(cb_candidate_gathering_done), NULL); - g_signal_connect(G_OBJECT(agent), "component-state-changed", + g_signal_connect(agent, "component-state-changed", G_CALLBACK(cb_component_state_changed), NULL); // Create a new stream with one component diff --git a/examples/simple-example.c b/examples/simple-example.c index 76a39c8..936c8f0 100644 --- a/examples/simple-example.c +++ b/examples/simple-example.c @@ -116,17 +116,17 @@ main(int argc, char *argv[]) // Set the STUN settings and controlling mode if (stun_addr) { - g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL); - g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL); + g_object_set(agent, "stun-server", stun_addr, NULL); + g_object_set(agent, "stun-server-port", stun_port, NULL); } - g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL); + g_object_set(agent, "controlling-mode", controlling, NULL); // Connect to the signals - g_signal_connect(G_OBJECT(agent), "candidate-gathering-done", + g_signal_connect(agent, "candidate-gathering-done", G_CALLBACK(cb_candidate_gathering_done), NULL); - g_signal_connect(G_OBJECT(agent), "new-selected-pair", + g_signal_connect(agent, "new-selected-pair", G_CALLBACK(cb_new_selected_pair), NULL); - g_signal_connect(G_OBJECT(agent), "component-state-changed", + g_signal_connect(agent, "component-state-changed", G_CALLBACK(cb_component_state_changed), NULL); // Create a new stream with one component diff --git a/examples/threaded-example.c b/examples/threaded-example.c index 621bf18..e672d89 100644 --- a/examples/threaded-example.c +++ b/examples/threaded-example.c @@ -140,17 +140,17 @@ example_thread(void *data) // Set the STUN settings and controlling mode if (stun_addr) { - g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL); - g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL); + g_object_set(agent, "stun-server", stun_addr, NULL); + g_object_set(agent, "stun-server-port", stun_port, NULL); } - g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL); + g_object_set(agent, "controlling-mode", controlling, NULL); // Connect to the signals - g_signal_connect(G_OBJECT(agent), "candidate-gathering-done", + g_signal_connect(agent, "candidate-gathering-done", G_CALLBACK(cb_candidate_gathering_done), NULL); - g_signal_connect(G_OBJECT(agent), "new-selected-pair", + g_signal_connect(agent, "new-selected-pair", G_CALLBACK(cb_new_selected_pair), NULL); - g_signal_connect(G_OBJECT(agent), "component-state-changed", + g_signal_connect(agent, "component-state-changed", G_CALLBACK(cb_component_state_changed), NULL); // Create a new stream with one component |