]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src: add braces to switch cases containing declarations
authorJohn Lindgren <john@jlindgren.net>
Fri, 4 Jul 2025 04:42:25 +0000 (00:42 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 21 Jul 2025 14:51:10 +0000 (16:51 +0200)
This limits the scope of the declarations to avoid accidents.

src/img/img-xbm.c
src/protocols/cosmic_workspaces/cosmic-workspaces.c
src/protocols/ext-workspace/ext-workspace.c

index f01b689b928f18a33277ea02cad6e58d08f508ae..7f1571e4236273d6ca44b15c28fef60e17cc2506 100644 (file)
@@ -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);
index b39e2d1790778f272bd571fb98d457384bf2e64f..20d8b82214ca3323e793032795553155d3b54f27 100644 (file)
@@ -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);
index 920323752a63582e18b3dd025ac69db3584bb8c9..eb02e3dc686e243bcf457ccb5c4fbad4b3c8916e 100644 (file)
@@ -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);