From: John Lindgren Date: Fri, 4 Jul 2025 04:42:25 +0000 (-0400) Subject: src: add braces to switch cases containing declarations X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=681f9e9a7bf6e33845967abebb32eb93aa9b5716;p=proto%2Flabwc.git src: add braces to switch cases containing declarations This limits the scope of the declarations to avoid accidents. --- diff --git a/src/img/img-xbm.c b/src/img/img-xbm.c index f01b689b..7f1571e4 100644 --- a/src/img/img-xbm.c +++ b/src/img/img-xbm.c @@ -141,12 +141,13 @@ tokenize_xbm(char *buffer) add_token(&ctx, TOKEN_IDENT); get_identifier_token(&ctx); continue; - case '0' ... '9': + case '0' ... '9': { add_token(&ctx, TOKEN_INT); get_number_token(&ctx); struct token *token = ctx.tokens + ctx.nr_tokens - 1; token->value = (int)strtol(token->name, NULL, 0); continue; + } case '{': add_token(&ctx, TOKEN_SPECIAL); get_special_char_token(&ctx); diff --git a/src/protocols/cosmic_workspaces/cosmic-workspaces.c b/src/protocols/cosmic_workspaces/cosmic-workspaces.c index b39e2d17..20d8b822 100644 --- a/src/protocols/cosmic_workspaces/cosmic-workspaces.c +++ b/src/protocols/cosmic_workspaces/cosmic-workspaces.c @@ -323,11 +323,12 @@ manager_handle_commit(struct wl_client *client, struct wl_resource *resource) struct lab_transaction_op *trans_op, *trans_op_tmp; lab_transaction_for_each_safe(trans_op, trans_op_tmp, addon->ctx) { switch (trans_op->change) { - case CW_PENDING_WS_CREATE: + case CW_PENDING_WS_CREATE: { group = trans_op->src; struct ws_create_workspace_event *ev = trans_op->data; wl_signal_emit_mutable(&group->events.create_workspace, ev->name); break; + } case CW_PENDING_WS_ACTIVATE: workspace = trans_op->src; wl_signal_emit_mutable(&workspace->events.activate, NULL); diff --git a/src/protocols/ext-workspace/ext-workspace.c b/src/protocols/ext-workspace/ext-workspace.c index 92032375..eb02e3dc 100644 --- a/src/protocols/ext-workspace/ext-workspace.c +++ b/src/protocols/ext-workspace/ext-workspace.c @@ -295,11 +295,12 @@ manager_handle_commit(struct wl_client *client, struct wl_resource *resource) struct lab_transaction_op *trans_op, *trans_op_tmp; lab_transaction_for_each_safe(trans_op, trans_op_tmp, addon->ctx) { switch (trans_op->change) { - case WS_PENDING_WS_CREATE: + case WS_PENDING_WS_CREATE: { group = trans_op->src; struct ws_create_workspace_event *ev = trans_op->data; wl_signal_emit_mutable(&group->events.create_workspace, ev->name); break; + } case WS_PENDING_WS_ACTIVATE: workspace = trans_op->src; wl_signal_emit_mutable(&workspace->events.activate, NULL);