diff options
author | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-17 16:11:28 +0000 |
---|---|---|
committer | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-17 16:11:28 +0000 |
commit | 4bd46fb079fb5a32ee6eb2b297de273b261a9c71 (patch) | |
tree | 81dfd95a863ae17de78a6c69a14dd5698c6de862 /common/util.c | |
parent | Merge pull request #3046 from tokyovigilante/relative-transform (diff) | |
download | sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.tar.gz sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.tar.zst sway-4bd46fb079fb5a32ee6eb2b297de273b261a9c71.zip |
Implement strip_workspace_name.
Diffstat (limited to 'common/util.c')
-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 f4588b57..abaca17f 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> |
@@ -23,7 +23,8 @@ int numlen(int n) { | |||
23 | if (n == 0) { | 23 | if (n == 0) { |
24 | return 1; | 24 | return 1; |
25 | } | 25 | } |
26 | return log10(n) + 1; | 26 | // Account for the '-' in negative numbers. |
27 | return log10(abs(n)) + (n > 0 ? 1 : 2); | ||
27 | } | 28 | } |
28 | 29 | ||
29 | static struct modifier_key { | 30 | static struct modifier_key { |