[libgweather] Modifying the way of traversing through all Weather-stations
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] Modifying the way of traversing through all Weather-stations
- Date: Mon, 10 Mar 2014 16:54:25 +0000 (UTC)
commit b1527899cfdfb43c6e8c9c46c6f46405a69fd7e7
Author: Saurabh_P <srp201201051 gmail com>
Date: Tue Mar 4 23:14:17 2014 +0530
Modifying the way of traversing through all Weather-stations
Change the way of iterating in for loop.
https://bugzilla.gnome.org/show_bug.cgi?id=725671
libgweather/gweather-location.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 2526a19..5d12982 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -526,9 +526,9 @@ foreach_cities (GWeatherLocation *loc,
if (loc->level == GWEATHER_LOCATION_CITY) {
callback (loc, user_data);
} else if (loc->children) {
- GWeatherLocation *child;
- for (child = *loc->children; child != NULL; child++)
- foreach_cities (child, callback, user_data);
+ int i;
+ for (i = 0; loc->children[i]; i++)
+ foreach_cities (loc->children[i], callback, user_data);
}
}
@@ -558,7 +558,7 @@ find_nearest_city (GWeatherLocation *location,
double distance = location_distance (location->latitude, location->longitude,
data->latitude, data->longitude);
- if (data->location == NULL || data->distance < distance) {
+ if (data->location == NULL || data->distance > distance) {
data->location = location;
data->distance = distance;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]