[libgweather/benzea/wip-variant-backend: 9/15] Add nice iteration macro
- From: Benjamin Berg <bberg src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [libgweather/benzea/wip-variant-backend: 9/15] Add nice iteration macro
 
- Date: Sun, 26 Apr 2020 15:52:04 +0000 (UTC)
 
commit decd2c672f3fdca198b9645a4a7dc97c1c56e27e
Author: Benjamin Berg <bberg redhat com>
Date:   Sun Apr 26 16:05:58 2020 +0200
    Add nice iteration macro
 libgweather/gweather-location.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 44f6e69..8dea507 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -40,6 +40,17 @@
  * airport to a city, see also test_distance() */
 #define AIRPORT_MAX_DISTANCE 100.0
 
+static inline GWeatherLocation*
+_iter_up(GWeatherLocation *loc)
+{
+    GWeatherLocation *tmp;
+
+    tmp = gweather_location_dup_parent (loc);
+    gweather_location_unref (loc);
+    return tmp;
+}
+#define ITER_UP(start, _p) for ((_p) = gweather_location_ref (start); (_p); (_p) = _iter_up(_p))
+
 /**
  * SECTION:gweatherlocation
  * @Title: GWeatherLocation
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]