diff options
author | Ian Fan <ianfan0@gmail.com> | 2019-01-22 10:43:48 +0000 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-22 13:10:25 +0100 |
commit | de9a357de84da4436b263ff6a969eb4ac753af0d (patch) | |
tree | 6a2f05fe18a6152335c832a20e1f7c543badcf48 /sway/commands | |
parent | 42f8a038c9740bb39690446865406c551c755d96 (diff) | |
download | sway-de9a357de84da4436b263ff6a969eb4ac753af0d.tar.xz |
util.c: remove numlen function
Its uses have been replaced by snprintf, which is more in line with its usage.
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/bar.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 <stdio.h> #include <string.h> #include <strings.h> #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); |