aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-11-19 17:56:18 +0100
committerGitHub <noreply@github.com>2018-11-19 17:56:18 +0100
commitbf7af9c690de1da94a5fa258747cd983cb61b707 (patch)
tree1b731331f1ea6ebb430a9bf4dbc1db482bc7ff5d /common
parent67d24e8fc54b9e091533500de22f02302a4c79fc (diff)
parent4bd46fb079fb5a32ee6eb2b297de273b261a9c71 (diff)
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
Diffstat (limited to 'common')
-rw-r--r--common/util.c5
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 @@
-#define _XOPEN_SOURCE 700
+#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -24,7 +24,8 @@ int numlen(int n) {
if (n == 0) {
return 1;
}
- return log10(n) + 1;
+ // Account for the '-' in negative numbers.
+ return log10(abs(n)) + (n > 0 ? 1 : 2);
}
static struct modifier_key {