[gupnp] [PATCH 2/2] Remove redundant code



There's no point in setting "l" to the next list member here as we
are done with it anyway. Remove redundant code and use local variables
to make it clear that the variable is not used afterwards.
---
 libgupnp/gupnp-control-point.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/libgupnp/gupnp-control-point.c b/libgupnp/gupnp-control-point.c
index 3e09583..0b64fd9 100644
--- a/libgupnp/gupnp-control-point.c
+++ b/libgupnp/gupnp-control-point.c
@@ -746,7 +746,6 @@ gupnp_control_point_resource_unavailable
 {
         GUPnPControlPoint *control_point;
         char *udn, *service_type;
-        GList *l, *cur_l;
 
         control_point = GUPNP_CONTROL_POINT (resource_browser);
 
@@ -756,7 +755,7 @@ gupnp_control_point_resource_unavailable
 
         /* Find proxy */
         if (service_type) {
-                l = find_service_node (control_point, udn, service_type);
+                GList *l = find_service_node (control_point, udn, service_type);
 
                 if (l) {
                         GUPnPServiceProxy *proxy;
@@ -764,12 +763,9 @@ gupnp_control_point_resource_unavailable
                         /* Remove proxy */
                         proxy = GUPNP_SERVICE_PROXY (l->data);
 
-                        cur_l = l;
-                        l = l->next;
-
                         control_point->priv->services =
                                 g_list_delete_link
-                                        (control_point->priv->services, cur_l);
+                                        (control_point->priv->services, l);
 
                         g_signal_emit (control_point,
                                        signals[SERVICE_PROXY_UNAVAILABLE],
@@ -779,7 +775,7 @@ gupnp_control_point_resource_unavailable
                         g_object_unref (proxy);
                 }
         } else {
-                l = find_device_node (control_point, udn);
+                GList *l = find_device_node (control_point, udn);
 
                 if (l) {
                         GUPnPDeviceProxy *proxy;
@@ -787,12 +783,9 @@ gupnp_control_point_resource_unavailable
                         /* Remove proxy */
                         proxy = GUPNP_DEVICE_PROXY (l->data);
 
-                        cur_l = l;
-                        l = l->next;
-
                         control_point->priv->devices =
                                  g_list_delete_link
-                                        (control_point->priv->devices, cur_l);
+                                        (control_point->priv->devices, l);
 
                         g_signal_emit (control_point,
                                        signals[DEVICE_PROXY_UNAVAILABLE],
-- 
1.7.1

--
To unsubscribe send a mail to gupnp+unsubscribe\@o-hand.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]