From: Samuel Thibault <samuel.thibault@xensource.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] [Mini-OS] Safer NSEC_TO_U?SEC
Date: Wed, 24 Oct 2007 14:29:23 +0100 [thread overview]
Message-ID: <20071024132923.GC3824@implementation.uk.xensource.com> (raw)
[-- 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
reply other threads:[~2007-10-24 13:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071024132923.GC3824@implementation.uk.xensource.com \
--to=samuel.thibault@xensource.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.