]> code.delx.au - spectrwm/blobdiff - linux/tree.h
Improve the bind[] option to accept pointer buttons.
[spectrwm] / linux / tree.h
index 7d20047a00f2acf65269f39e5a8801daa96c88cb..7f5d49e048df2ebb1daf5131206a76d6369c0bad 100644 (file)
@@ -731,6 +731,11 @@ name##_RB_MINMAX(struct name *head, int val)                               \
             (x) != NULL;                                               \
             (x) = name##_RB_NEXT(x))
 
+#define RB_FOREACH_SAFE(x, name, head, y)                              \
+       for ((x) = RB_MIN(name, head);                                  \
+           ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);    \
+            (x) = (y))
+
 #define RB_FOREACH_REVERSE(x, name, head)                              \
        for ((x) = RB_MAX(name, head);                                  \
             (x) != NULL;                                               \