diff options
author | Tharre <tharre3@gmail.com> | 2014-09-02 18:07:57 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2014-09-02 18:07:57 +0200 |
commit | 08e8afe93796d6682bbc46cb4acd5fb615b1785c (patch) | |
tree | 8c087012593689d41a4d4168568f60d861257843 | |
parent | 02fec99696dedf1a7e4eeafca09644ca4dfdbaab (diff) | |
download | redo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.tar.gz redo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.tar.xz redo-08e8afe93796d6682bbc46cb4acd5fb615b1785c.zip |
Remove random math.h dependency
-rw-r--r-- | out/config.sh | 2 | ||||
-rw-r--r-- | src/redo.c | 5 |
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="" @@ -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[]) { |