]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: support <desktops number="">
authorSachin Bhat <sachubhat17@gmail.com>
Sun, 25 Jun 2023 00:09:28 +0000 (08:09 +0800)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 25 Jun 2023 09:31:13 +0000 (10:31 +0100)
src/config/rcxml.c

index 1a384c9041d13b4380b0743253168c03e9474a2a..2073ebf5f4e5e608313349f1c3d5c984ea8fc278 100644 (file)
@@ -1051,11 +1051,11 @@ post_processing(void)
        int nr_workspaces = wl_list_length(&rc.workspace_config.workspaces);
        if (nr_workspaces < rc.workspace_config.min_nr_workspaces) {
                struct workspace *workspace;
+               char workspace_name[32];
                for (int i = nr_workspaces; i < rc.workspace_config.min_nr_workspaces; i++) {
                        workspace = znew(*workspace);
-                       char *workspace_name = malloc(sizeof(char) * 32);
-                       snprintf(workspace_name, 32, "Workspace %d", i + 1);
-                       workspace->name = workspace_name;
+                       snprintf(workspace_name, sizeof(workspace_name), "Workspace %d", i + 1);
+                       workspace->name = xstrdup(workspace_name);
                        wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
                }
        }