From 32caabc7a172552a35358d7cde89790ebfa96d48 Mon Sep 17 00:00:00 2001 From: lbonn Date: Sat, 7 Sep 2019 21:52:48 +0200 Subject: [PATCH] seat: simplify a strdup --- sway/input/seat.c | 5 +---- 1 file changed, 1 insertion(+), 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); } }