aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorlbonn <bonnans.l@gmail.com>2019-09-07 21:52:48 +0200
committerDrew DeVault <sir@cmpwn.com>2019-11-01 12:18:09 -0400
commit32caabc7a172552a35358d7cde89790ebfa96d48 (patch)
treee272dd14de32d5acbfebd2740a7330aab0792ddc /sway/input
parent354e705a7be9158c6dd14bb4f9751023e2e974b8 (diff)
seat: simplify a strdup
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 7b0fe67d..dc21ce61 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -905,12 +905,9 @@ static void set_workspace(struct sway_seat *seat,
if (seat->workspace) {
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) {
sway_log(SWAY_ERROR, "Unable to allocate previous workspace name");
- seat->prev_workspace_name = NULL;
- } else {
- strcpy(seat->prev_workspace_name, seat->workspace->name);
}
}