GET_NUM_DIGITS: Evaluate macro parameter only once.
authorAndre Noll <maan@systemlinux.org>
Tue, 17 Mar 2009 23:00:08 +0000 (00:00 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 17 Mar 2009 23:00:08 +0000 (00:00 +0100)
aft.c

diff --git a/aft.c b/aft.c
index 7bfad50..daa9c73 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -741,7 +741,7 @@ static int get_local_time(uint64_t *seconds, char *buf, size_t size,
 #define GET_NUM_DIGITS(x, num) { \
        typeof((x)) _tmp = PARA_ABS(x); \
        *num = 1; \
 #define GET_NUM_DIGITS(x, num) { \
        typeof((x)) _tmp = PARA_ABS(x); \
        *num = 1; \
-       if ((x)) \
+       if ((_tmp)) \
                while ((_tmp) > 9) { \
                        (_tmp) /= 10; \
                        (*num)++; \
                while ((_tmp) > 9) { \
                        (_tmp) /= 10; \
                        (*num)++; \