- Use inline function instead of macro. Modified: trunk/reactos/lib/ntdll/stdio/sprintf.c Modified: trunk/reactos/lib/ntdll/stdio/swprintf.c _____
Modified: trunk/reactos/lib/ntdll/stdio/sprintf.c --- trunk/reactos/lib/ntdll/stdio/sprintf.c 2005-07-27 16:18:06 UTC (rev 16802) +++ trunk/reactos/lib/ntdll/stdio/sprintf.c 2005-07-27 16:34:14 UTC (rev 16803) @@ -20,15 +20,8 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-) */
-#define __NO_CTYPE_INLINES -#include <ctype.h> -#include <limits.h> - #include <ntdll.h> -#define NDEBUG -#include <debug.h>
- #define ZEROPAD 1 /* pad with zero */ #define SIGN 2 /* unsigned/signed long */ #define PLUS 4 /* show plus */ @@ -38,11 +31,16 @@ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
-#define do_div(n,base) ({ \ -int __res; \ -__res = ((unsigned long long) n) % (unsigned) base; \ -n = ((unsigned long long) n) / (unsigned) base; \ -__res; }) +static +__inline +int +do_div(long long *n, int base) +{ + int a; + a = ((unsigned long long) *n) % (unsigned) base; + *n = ((unsigned long long) *n) / (unsigned) base; + return a; +}
static int skip_atoi(const char **s) @@ -94,7 +92,7 @@ if (num == 0) tmp[i++]='0'; else while (num != 0) - tmp[i++] = digits[do_div(num,base)]; + tmp[i++] = digits[do_div(&num,base)]; if (i > precision) precision = i; size -= precision; _____
Modified: trunk/reactos/lib/ntdll/stdio/swprintf.c --- trunk/reactos/lib/ntdll/stdio/swprintf.c 2005-07-27 16:18:06 UTC (rev 16802) +++ trunk/reactos/lib/ntdll/stdio/swprintf.c 2005-07-27 16:34:14 UTC (rev 16803) @@ -37,11 +37,16 @@
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
-#define do_div(n,base) ({ \ -int __res; \ -__res = ((unsigned long long) n) % (unsigned) base; \ -n = ((unsigned long long) n) / (unsigned) base; \ -__res; }) +static +__inline +int +do_div(long long *n, int base) +{ + int a; + a = ((unsigned long long) *n) % (unsigned) base; + *n = ((unsigned long long) *n) / (unsigned) base; + return a; +}
static int skip_atoi(const wchar_t **s) @@ -93,7 +98,7 @@ if (num == 0) tmp[i++] = L'0'; else while (num != 0) - tmp[i++] = digits[do_div(num,base)]; + tmp[i++] = digits[do_div(&num,base)]; if (i > precision) precision = i; size -= precision;