All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [Mini-OS] Safer NSEC_TO_U?SEC
@ 2007-10-24 13:29 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2007-10-24 13:29 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

Hi,

The NSEC_TO_USEC and NSEC_TO_SEC macros are not expression-safe, here is
a patch that adds parenthesis for fewer surprises...

Samuel

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 663 bytes --]

diff -r b28ae5f00553 extras/mini-os/include/time.h
--- a/extras/mini-os/include/time.h	Tue Oct 23 09:26:43 2007 +0100
+++ b/extras/mini-os/include/time.h	Wed Oct 24 14:27:10 2007 +0100
@@ -37,8 +37,8 @@ typedef s64 s_time_t;
 #define MICROSECS(_us)          (((s_time_t)(_us)) * 1000UL )
 #define Time_Max                ((s_time_t) 0x7fffffffffffffffLL)
 #define FOREVER                 Time_Max
-#define NSEC_TO_USEC(_nsec)     (_nsec / 1000UL)
-#define NSEC_TO_SEC(_nsec)      (_nsec / 1000000000ULL)
+#define NSEC_TO_USEC(_nsec)     ((_nsec) / 1000UL)
+#define NSEC_TO_SEC(_nsec)      ((_nsec) / 1000000000ULL)
 
 /* wall clock time  */
 typedef long time_t;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-24 13:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 13:29 [PATCH] [Mini-OS] Safer NSEC_TO_U?SEC Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.