aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-02-28 16:43:05 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2023-04-14 18:34:54 +0200
commit08c1946d71039e583696842c3558b337aede1cbf (patch)
tree3873db2edfb31146bd6cd17dae63f068aef34f05 /sway/input/input-manager.c
parentcommon/gesture: use format_str() (diff)
downloadsway-08c1946d71039e583696842c3558b337aede1cbf.tar.gz
sway-08c1946d71039e583696842c3558b337aede1cbf.tar.zst
sway-08c1946d71039e583696842c3558b337aede1cbf.zip
Use format_str() throughout
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}