aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorConnor E <38229097+c-edw@users.noreply.github.com>2018-11-17 16:11:28 +0000
committerConnor E <38229097+c-edw@users.noreply.github.com>2018-11-17 16:11:28 +0000
commit4bd46fb079fb5a32ee6eb2b297de273b261a9c71 (patch)
tree81dfd95a863ae17de78a6c69a14dd5698c6de862 /common
parent001ec1f3fdd700c23fb6dc91018697130af225ff (diff)
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 f4588b57..abaca17f 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>
@@ -23,7 +23,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 {