examples: Remove unnecessary dynamic type casts
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 30 Jun 2014 19:09:30 +0000 (20:09 +0100)
committerOlivier Crête <olivier.crete@collabora.com>
Mon, 7 Jul 2014 19:47:02 +0000 (15:47 -0400)
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.

examples/sdp-example.c
examples/simple-example.c
examples/threaded-example.c

index a1d12bc..b3c5588 100644 (file)
@@ -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
index 76a39c8..936c8f0 100644 (file)
@@ -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
index 621bf18..e672d89 100644 (file)
@@ -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