diff options
author | emersion <contact@emersion.fr> | 2018-11-19 17:56:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 17:56:18 +0100 |
commit | bf7af9c690de1da94a5fa258747cd983cb61b707 (patch) | |
tree | 1b731331f1ea6ebb430a9bf4dbc1db482bc7ff5d /common | |
parent | Merge pull request #3152 from camoz/master (diff) | |
parent | Implement strip_workspace_name. (diff) | |
download | sway-bf7af9c690de1da94a5fa258747cd983cb61b707.tar.gz sway-bf7af9c690de1da94a5fa258747cd983cb61b707.tar.zst sway-bf7af9c690de1da94a5fa258747cd983cb61b707.zip |
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
Diffstat (limited to 'common')
-rw-r--r-- | common/util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/util.c b/common/util.c index 0caafb39..40c64230 100644 --- a/common/util.c +++ b/common/util.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 700 | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <assert.h> | 2 | #include <assert.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <sys/stat.h> | 4 | #include <sys/stat.h> |
@@ -24,7 +24,8 @@ int numlen(int n) { | |||
24 | if (n == 0) { | 24 | if (n == 0) { |
25 | return 1; | 25 | return 1; |
26 | } | 26 | } |
27 | return log10(n) + 1; | 27 | // Account for the '-' in negative numbers. |
28 | return log10(abs(n)) + (n > 0 ? 1 : 2); | ||
28 | } | 29 | } |
29 | 30 | ||
30 | static struct modifier_key { | 31 | static struct modifier_key { |