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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to