SDL: Add 'wl_list_for_each_safe' to the clang-format macro list

From 717f2978493f1a50e9a4abd4731e8ddda7c04b90 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 14 Mar 2024 10:09:47 -0400
Subject: [PATCH] Add 'wl_list_for_each_safe' to the clang-format macro list

...and fix the formatting when it is used.
---
 .clang-format                              | 1 +
 src/video/wayland/SDL_waylanddatamanager.c | 3 +--
 src/video/wayland/SDL_waylandevents.c      | 3 +--
 src/video/wayland/SDL_waylandvideo.c       | 3 +--
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/.clang-format b/.clang-format
index e98e5cd70af8d..4e932d022dd83 100644
--- a/.clang-format
+++ b/.clang-format
@@ -82,6 +82,7 @@ ForEachMacros:
     "spa_list_for_each",
     "spa_list_for_each_safe",
     "wl_list_for_each",
+    "wl_list_for_each_safe",
     "wl_array_for_each",
     "udev_list_entry_foreach",
   ]
diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c
index eea8c3200d412..0fab6fe21fa47 100644
--- a/src/video/wayland/SDL_waylanddatamanager.c
+++ b/src/video/wayland/SDL_waylanddatamanager.c
@@ -200,8 +200,7 @@ static void mime_data_list_free(struct wl_list *list)
     SDL_MimeDataList *mime_data = NULL;
     SDL_MimeDataList *next = NULL;
 
-    wl_list_for_each_safe(mime_data, next, list, link)
-    {
+    wl_list_for_each_safe (mime_data, next, list, link) {
         if (mime_data->data) {
             SDL_free(mime_data->data);
         }
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index f55c4eb5aba28..00f10a7563fc3 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -3107,8 +3107,7 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
             wl_touch_destroy(input->touch);
         }
 
-        wl_list_for_each_safe(tp, tmp, &touch_points, link)
-        {
+        wl_list_for_each_safe (tp, tmp, &touch_points, link) {
             WAYLAND_wl_list_remove(&tp->link);
             SDL_free(tp);
         }
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 8a30158321830..2054471eb561c 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -201,8 +201,7 @@ static SDL_bool Wayland_GetGNOMEPrimaryDisplayCoordinates(int *x, int *y)
 static void Wayland_FlushOutputOrder(SDL_VideoData *vid)
 {
     SDL_WaylandConnectorName *c, *tmp;
-    wl_list_for_each_safe(c, tmp, &vid->output_order, link)
-    {
+    wl_list_for_each_safe (c, tmp, &vid->output_order, link) {
         WAYLAND_wl_list_remove(&c->link);
         SDL_free(c);
     }