[spice 0/2] utils: Remove the LL suffix from the NSEC_PER_* constants

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

 




The LL suffix forces the expressions these constants are used in to be 
computed in 64 bit. The good thing is that this avoids overflows. The 
downside is that, because the LL suffix is hidden in a far away macro, 
looking at the expression will not reveal whether it operates on 32 or 
64 bit integers.

This is made even more confusing by the fact that not all the NSEC_PER_* 
constants have the LL suffix.

Then when a developper adds a spice_debug() trace using one of these 
constants it also makes it hard to know in advance whether %ld or %lld 
should be used, causing unnecessary compilation errors.

Finally, while the main NSEC_PER_* constants fit in 32 bit some of the 
derived ones such as COMMON_CLIENT_TIMEOUT don't. For those use an 
uint64_t cast rather than an LL suffix to avoid the %ld vs. %lld 
confusion (again for debugging).


Francois Gouget (2):
  utils: Remove the LL suffix from NSEC_PER_MILLISEC
  utils: Remove the LL suffix from NSEC_PER_SEC

 server/common-graphics-channel.h | 2 +-
 server/dcc.h                     | 2 +-
 server/gstreamer-encoder.c       | 2 +-
 server/mjpeg-encoder.c           | 2 +-
 server/utils.h                   | 6 +++---
 server/video-stream.c            | 4 ++--
 server/video-stream.h            | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.20.1
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]