Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libperfuse





In article <20111229014033.2F339175D0%cvs.netbsd.org@localhost> you write:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  riz
>Date:          Thu Dec 29 01:40:32 UTC 2011
>
>Modified Files:
>       src/lib/libperfuse: debug.c
>
>Log Message:
>Cast time_t to intmax_t for printf purposes, and format with %j.  Fixes
>build on amd64 and probably i386 as well.
> 
>-              fprintf(fp, "%lu.%09ld %s %s%s%s %s ",  
>-                      pt->pt_start.tv_sec, pt->pt_start.tv_nsec,
>+              fprintf(fp, "%ju.%09jd %s %s%s%s %s ",  
>+                      (intmax_t)pt->pt_start.tv_sec,
>+                      (intmax_t)pt->pt_start.tv_nsec,

This is slightly wrong: intmax_t is a signed type so %jd; tv_nsec is guaranteed
to be "long" so %09ld without a cast works (what you have there is ok too,
but slightly less efficient on 32 bit systems).

christos




Home | Main Index | Thread Index | Old Index