[libgweather/benzea/wip-variant-backend] Add nice iteration macro



commit 75eae0c2b0e744d3d7e9331d7d46f171005a442a
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]