aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 72d53ff0..e7ddfa71 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -383,9 +383,8 @@ static bool cmd_mode(int argc, char **argv) {
// Create mode if it doesnt exist
if (!mode && argc >= 2 && strncmp(argv[1],"{",1) == 0) {
mode = malloc(sizeof*mode);
- mode->name = malloc(strlen(mode_name) + 1);
+ mode->name = strdup(mode_name);
mode->bindings = create_list();
- strcpy(mode->name, mode_name);
list_add(config->modes, mode);
}
if (!mode) {
@@ -834,10 +833,8 @@ static bool cmd_set(int argc, char **argv) {
return false;
}
struct sway_variable *var = malloc(sizeof(struct sway_variable));
- var->name = malloc(strlen(argv[0]) + 1);
- strcpy(var->name, argv[0]);
- var->value = malloc(strlen(argv[1]) + 1);
- strcpy(var->value, argv[1]);
+ var->name = strdup(argv[0]);
+ var->value = strdup(argv[1]);
list_add(config->symbols, var);
return true;
}