From de9a357de84da4436b263ff6a969eb4ac753af0d Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Tue, 22 Jan 2019 10:43:48 +0000 Subject: util.c: remove numlen function Its uses have been replaced by snprintf, which is more in line with its usage. --- sway/commands/bar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/commands') diff --git a/sway/commands/bar.c b/sway/commands/bar.c index e9360603..82441f9e 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c @@ -1,10 +1,10 @@ #define _POSIX_C_SOURCE 200809 +#include #include #include #include "sway/commands.h" #include "sway/config.h" #include "log.h" -#include "util.h" // Must be in alphabetical order for bsearch static struct cmd_handler bar_handlers[] = { @@ -89,7 +89,7 @@ struct cmd_results *cmd_bar(int argc, char **argv) { } // set bar id - const int len = 5 + numlen(config->bars->length - 1); // "bar-"+i+\0 + const int len = snprintf(NULL, 0, "bar-%d", config->bars->length - 1) + 1; bar->id = malloc(len * sizeof(char)); if (bar->id) { snprintf(bar->id, len, "bar-%d", config->bars->length - 1); -- cgit v1.2.3