aboutsummaryrefslogtreecommitdiffstats
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) {
80 } 80 }
81 } 81 }
82 82
83 const char *fmt = "%d:%d:%s"; 83 char *identifier = format_str("%d:%d:%s", vendor, product, name);
84 int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
85 char *identifier = malloc(len);
86 if (!identifier) {
87 sway_log(SWAY_ERROR, "Unable to allocate unique input device name");
88 return NULL;
89 }
90
91 snprintf(identifier, len, fmt, vendor, product, name);
92 free(name); 84 free(name);
93 return identifier; 85 return identifier;
94} 86}