clang-format: bring back ForeachMacros (#3948)

* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
This commit is contained in:
xzfc
2020-02-19 10:31:09 +00:00
committed by GitHub
parent e3f120c0b6
commit 1f0c628cde
37 changed files with 363 additions and 329 deletions

View File

@@ -160,7 +160,7 @@ static void free_ipc_client(ipc_client *client, int exempt_fd) {
*/
void ipc_send_event(const char *event, uint32_t message_type, const char *payload) {
ipc_client *current;
TAILQ_FOREACH(current, &all_clients, clients) {
TAILQ_FOREACH (current, &all_clients, clients) {
for (int i = 0; i < current->num_events; i++) {
if (strcasecmp(current->events[i], event) == 0) {
ipc_send_client_message(current, strlen(payload), message_type, (uint8_t *)payload);
@@ -415,7 +415,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
y(array_open);
mark_t *mark;
TAILQ_FOREACH(mark, &(con->marks_head), marks) {
TAILQ_FOREACH (mark, &(con->marks_head), marks) {
ystr(mark->name);
}
@@ -595,7 +595,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
y(array_open);
Con *node;
if (con->type != CT_DOCKAREA || !inplace_restart) {
TAILQ_FOREACH(node, &(con->nodes_head), nodes) {
TAILQ_FOREACH (node, &(con->nodes_head), nodes) {
dump_node(gen, node, inplace_restart);
}
}
@@ -603,14 +603,14 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("floating_nodes");
y(array_open);
TAILQ_FOREACH(node, &(con->floating_head), floating_windows) {
TAILQ_FOREACH (node, &(con->floating_head), floating_windows) {
dump_node(gen, node, inplace_restart);
}
y(array_close);
ystr("focus");
y(array_open);
TAILQ_FOREACH(node, &(con->focus_head), focused) {
TAILQ_FOREACH (node, &(con->focus_head), focused) {
y(integer, (uintptr_t)node);
}
y(array_close);
@@ -640,7 +640,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("swallows");
y(array_open);
Match *match;
TAILQ_FOREACH(match, &(con->swallow_head), matches) {
TAILQ_FOREACH (match, &(con->swallow_head), matches) {
/* We will generate a new restart_mode match specification after this
* loop, so skip this one. */
if (match->restart_mode)
@@ -703,7 +703,7 @@ static void dump_bar_bindings(yajl_gen gen, Barconfig *config) {
y(array_open);
struct Barbinding *current;
TAILQ_FOREACH(current, &(config->bar_bindings), bindings) {
TAILQ_FOREACH (current, &(config->bar_bindings), bindings) {
y(map_open);
ystr("input_code");
@@ -752,7 +752,7 @@ static void dump_bar_config(yajl_gen gen, Barconfig *config) {
y(array_open);
struct tray_output_t *tray_output;
TAILQ_FOREACH(tray_output, &(config->tray_outputs), tray_outputs) {
TAILQ_FOREACH (tray_output, &(config->tray_outputs), tray_outputs) {
ystr(canonicalize_output_name(tray_output->output));
}
@@ -898,11 +898,11 @@ IPC_HANDLER(get_workspaces) {
Con *focused_ws = con_get_workspace(focused);
Con *output;
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
if (con_is_internal(output))
continue;
Con *ws;
TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
TAILQ_FOREACH (ws, &(output_get_content(output)->nodes_head), nodes) {
assert(ws->type == CT_WORKSPACE);
y(map_open);
@@ -963,7 +963,7 @@ IPC_HANDLER(get_outputs) {
y(array_open);
Output *output;
TAILQ_FOREACH(output, &outputs, outputs) {
TAILQ_FOREACH (output, &outputs, outputs) {
y(map_open);
ystr("name");
@@ -1017,9 +1017,9 @@ IPC_HANDLER(get_marks) {
y(array_open);
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) {
TAILQ_FOREACH (con, &all_cons, all_cons) {
mark_t *mark;
TAILQ_FOREACH(mark, &(con->marks_head), marks) {
TAILQ_FOREACH (mark, &(con->marks_head), marks) {
ystr(mark->name);
}
}
@@ -1079,7 +1079,7 @@ IPC_HANDLER(get_bar_config) {
if (message_size == 0) {
y(array_open);
Barconfig *current;
TAILQ_FOREACH(current, &barconfigs, configs) {
TAILQ_FOREACH (current, &barconfigs, configs) {
ystr(current->id);
}
y(array_close);
@@ -1099,7 +1099,7 @@ IPC_HANDLER(get_bar_config) {
sasprintf(&bar_id, "%.*s", message_size, message);
LOG("IPC: looking for config for bar ID \"%s\"\n", bar_id);
Barconfig *current, *config = NULL;
TAILQ_FOREACH(current, &barconfigs, configs) {
TAILQ_FOREACH (current, &barconfigs, configs) {
if (strcmp(current->id, bar_id) != 0)
continue;
@@ -1138,7 +1138,7 @@ IPC_HANDLER(get_binding_modes) {
y(array_open);
struct Mode *mode;
SLIST_FOREACH(mode, &modes, modes) {
SLIST_FOREACH (mode, &modes, modes) {
ystr(mode->name);
}
y(array_close);