svn commit: r226151 - head/usr.bin/kdump
Jaakko Heinonen
jh at FreeBSD.org
Mon Oct 10 15:15:02 UTC 2011
Hi,
On 2011-10-08, Dag-Erling Smorgrav wrote:
> Fix casting.
>
> Modified: head/usr.bin/kdump/kdump.c
> ==============================================================================
> --- head/usr.bin/kdump/kdump.c Sat Oct 8 12:10:16 2011 (r226150)
> +++ head/usr.bin/kdump/kdump.c Sat Oct 8 12:21:51 2011 (r226151)
> @@ -110,15 +110,16 @@ struct ktr_header ktr_header;
> #define TIME_FORMAT "%b %e %T %Y"
> #define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
>
> -#define print_number(i,n,c) do { \
> - if (decimal) \
> - printf("%c%ld", c, (long)*i); \
> - else \
> - printf("%c%#lx", c, (long)*i); \
> - i++; \
> - n--; \
> - c = ','; \
> - } while (0);
> +#define print_number(i,n,c) \
> + do { \
> + if (decimal) \
> + printf("%c%jd", c, (intmax_t)*i); \
> + else \
> + printf("%c%#jx", c, (intmax_t)*i); \
> + i++; \
> + n--; \
> + c = ','; \
> + } while (0)
Are you sure that this change doesn't cause a regression on platforms
where sizeof(long) != sizeof(intmax_t)?
For example, previously, on i386 print_number() printed "0xffffffff" for
-1 while after your change it will print "0xffffffffffffffff" (with %#jx).
--
Jaakko
More information about the svn-src-all
mailing list