qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] w32: Add macro timersub to sys/time.h


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 2/3] w32: Add macro timersub to sys/time.h
Date: Sat, 5 Mar 2011 11:34:51 +0200

On Sun, Feb 27, 2011 at 7:52 PM, Stefan Weil <address@hidden> wrote:
> timersub is needed by the latest vnc code.
>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]