From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] [Mini-OS] Safer NSEC_TO_U?SEC Date: Wed, 24 Oct 2007 14:29:23 +0100 Message-ID: <20071024132923.GC3824@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vGgW1X5XWziG23Ko" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --vGgW1X5XWziG23Ko Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --vGgW1X5XWziG23Ko Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch 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; --vGgW1X5XWziG23Ko Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --vGgW1X5XWziG23Ko--