mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 14:04:11 +01:00
seat: simplify a strdup
This commit is contained in:
parent
354e705a7b
commit
32caabc7a1
@ -905,12 +905,9 @@ static void set_workspace(struct sway_seat *seat,
|
|||||||
|
|
||||||
if (seat->workspace) {
|
if (seat->workspace) {
|
||||||
free(seat->prev_workspace_name);
|
free(seat->prev_workspace_name);
|
||||||
seat->prev_workspace_name = malloc(strlen(seat->workspace->name) + 1);
|
seat->prev_workspace_name = strdup(seat->workspace->name);
|
||||||
if (!seat->prev_workspace_name) {
|
if (!seat->prev_workspace_name) {
|
||||||
sway_log(SWAY_ERROR, "Unable to allocate previous workspace name");
|
sway_log(SWAY_ERROR, "Unable to allocate previous workspace name");
|
||||||
seat->prev_workspace_name = NULL;
|
|
||||||
} else {
|
|
||||||
strcpy(seat->prev_workspace_name, seat->workspace->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user