[PATCH:xset] Drop usleep fallbacks for ancient OS versions

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 6 17:53:00 PST 2013


On Fri, Jan 04, 2013 at 07:05:03PM -0800, Alan Coopersmith wrote:
> Unix 98 requires usleep() so assume most supported non-Win32 platforms
> have it and don't need old workarounds any more.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

> ---
>  configure.ac |    1 +
>  xset.c       |   27 +++------------------------
>  2 files changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 513b023..f7764bf 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -26,6 +26,7 @@ AC_INIT([xset], [1.2.2],
>          [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xset])
>  AC_CONFIG_SRCDIR([Makefile.am])
>  AC_CONFIG_HEADERS([config.h])
> +AC_USE_SYSTEM_EXTENSIONS
>  
>  # Initialize Automake
>  AM_INIT_AUTOMAKE([foreign dist-bzip2])
> diff --git a/xset.c b/xset.c
> index 906fa95..7e27a09 100644
> --- a/xset.c
> +++ b/xset.c
> @@ -549,35 +549,14 @@ main(int argc, char *argv[])
>  		     * which case the Up transition may immediately
>  		     * turn the display back on.
>  		     *
> -		     * On OS/2, use _sleep2()
>  		     */
>  
>  #ifdef HAVE_USLEEP
>  # define Usleep(us) usleep((us))
> -#else
> -#ifdef SVR4
> -# ifdef sgi
> -#  define Usleep(us) sginap((us) / 1000)
> -# endif
> -#endif
> -#ifdef hpux
> -# ifdef _XPG4_EXTENDED
> -#  define Usleep(us) usleep((us))
> -# endif
> -#endif
> -#ifdef __UNIXOS2__
> -# define Usleep(us) _sleep2((us / 1000 > 0) ? us / 1000 : 1)
> -#endif
> -#ifdef WIN32
> +#elif defined(WIN32)
>  # define Usleep(us) Sleep(us)
> -#endif
> -#ifndef Usleep
> -# if defined(SYSV) || defined(SVR4)
> -#  define Usleep(us) sleep((us / 1000000 > 0) ? us / 1000000 : 1)
> -# else
> -#  define Usleep(us) usleep((us))
> -# endif
> -#endif
> +#else
> +# define Usleep(us) sleep((us / 1000000 > 0) ? us / 1000000 : 1)
>  #endif /* HAVE_USLEEP */
>  
>  		    if (strcmp(arg, "on") == 0) {
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list