qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Stefan Weil <weil@mail.berlios.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] w32: Add macro timersub to sys/time.h
Date: Sat, 5 Mar 2011 11:34:51 +0200	[thread overview]
Message-ID: <AANLkTinFqP--fJ3zwKzRrMOdwm+MY1D1RrhL5EZU_MTf@mail.gmail.com> (raw)
In-Reply-To: <1298829142-5550-2-git-send-email-weil@mail.berlios.de>

On Sun, Feb 27, 2011 at 7:52 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> timersub is needed by the latest vnc code.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  hosts/w32/include/sys/time.h |   24 ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
>  create mode 100644 hosts/w32/include/sys/time.h
>
> diff --git a/hosts/w32/include/sys/time.h b/hosts/w32/include/sys/time.h
> new file mode 100644
> index 0000000..94056ff
> --- /dev/null
> +++ b/hosts/w32/include/sys/time.h

Nack. The QEMU way of handling host peculiarities is to add wrappers,
for example qemu_timersub in this case, and converting all callers.

> @@ -0,0 +1,24 @@
> +/*
> + * Extensions of MinGW sys/time.h
> + *
> + * Copyright (C) 2011 Stefan Weil
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
> + * See the COPYING.LIB file in the top-level directory.
> + *
> + */
> +
> +#include_next <sys/time.h>

Isn't include_next an extension by GCC?

> +
> +#ifndef timersub
> +/* This is a copy from GNU C Library (GNU LGPL 2.1), sys/time.h. */
> +# define timersub(a, b, result)                                               \
> +  do {                                                                        \
> +    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                             \
> +    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                          \
> +    if ((result)->tv_usec < 0) {                                              \
> +      --(result)->tv_sec;                                                     \
> +      (result)->tv_usec += 1000000;                                           \
> +    }                                                                         \
> +  } while (0)
> +#endif
> --
> 1.7.2.3
>
>
>

  reply	other threads:[~2011-03-05  9:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-27 17:52 [Qemu-devel] [PATCH 1/3] w32: Add new directory hierarchy for MinGW extensions Stefan Weil
2011-02-27 17:52 ` [Qemu-devel] [PATCH 2/3] w32: Add macro timersub to sys/time.h Stefan Weil
2011-03-05  9:34   ` Blue Swirl [this message]
2011-03-05  9:42     ` Peter Maydell
2011-03-05  9:48       ` Blue Swirl
2011-03-05  9:55         ` Peter Maydell
2011-03-05 10:31           ` Blue Swirl
2011-03-06 22:15     ` Stefan Weil
2011-02-27 17:52 ` [Qemu-devel] [PATCH 3/3] osdep: Remove conditional compilation (fixes w32 compilation) Stefan Weil

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=AANLkTinFqP--fJ3zwKzRrMOdwm+MY1D1RrhL5EZU_MTf@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weil@mail.berlios.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).