aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2014-09-02 18:07:57 +0200
committerTharre <tharre3@gmail.com>2014-09-02 18:07:57 +0200
commit08e8afe93796d6682bbc46cb4acd5fb615b1785c (patch)
tree8c087012593689d41a4d4168568f60d861257843
parent02fec99696dedf1a7e4eeafca09644ca4dfdbaab (diff)
downloadredo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.tar.gz
redo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.tar.xz
redo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.zip
Remove random math.h dependency
-rw-r--r--out/config.sh2
-rw-r--r--src/redo.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/out/config.sh b/out/config.sh
index a0a846d..75035a7 100644
--- a/out/config.sh
+++ b/out/config.sh
@@ -5,4 +5,4 @@ else
fi
CC=${CC-$PREF}
CFLAGS="-g -Wall -Wextra -std=c99 -pedantic -Wno-gnu-statement-expression"
-LDFLAGS="-lm"
+LDFLAGS=""
diff --git a/src/redo.c b/src/redo.c
index 514c235..cb6ad19 100644
--- a/src/redo.c
+++ b/src/redo.c
@@ -12,7 +12,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
-#include <math.h>
#include <limits.h>
#include <unistd.h>
@@ -23,8 +22,8 @@
/* Returns the amount of digits a number n has in decimal. */
-static inline int digits(unsigned n) {
- return (int) log10(n) + 1;
+static inline unsigned digits(unsigned n) {
+ return n ? 1 + digits(n/10) : n;
}
int main(int argc, char *argv[]) {