aboutsummaryrefslogtreecommitdiff
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r--sway/input/input-manager.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index ea2cc038..1115ba5e 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -80,15 +80,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) {
}
}
- const char *fmt = "%d:%d:%s";
- int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
- char *identifier = malloc(len);
- if (!identifier) {
- sway_log(SWAY_ERROR, "Unable to allocate unique input device name");
- return NULL;
- }
-
- snprintf(identifier, len, fmt, vendor, product, name);
+ char *identifier = format_str("%d:%d:%s", vendor, product, name);
free(name);
return identifier;
}