From 56fbf25c8a822e62d6b0e272ffefbb4dc1d44aba Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 11 May 2012 13:47:20 -0500 Subject: [PATCH] Move all portability gunk into stdinc.h. (Issue #18) --- main.c | 3 --- pkg.c | 1 - pkg.h | 9 +-------- stdinc.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 stdinc.h diff --git a/main.c b/main.c index d1a348e..f3246bb 100644 --- a/main.c +++ b/main.c @@ -22,9 +22,6 @@ */ #include "config.h" - -#include - #include "pkg.h" #ifdef HAVE_GETOPT_LONG diff --git a/pkg.c b/pkg.c index 1e1de11..bbec897 100644 --- a/pkg.c +++ b/pkg.c @@ -25,7 +25,6 @@ #include "bsdstubs.h" #ifdef _WIN32 -# include # define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH" #endif diff --git a/pkg.h b/pkg.h index dcf0b84..c1dbd3c 100644 --- a/pkg.h +++ b/pkg.h @@ -25,14 +25,7 @@ #define __PKG_H #include "config.h" - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include +#include "stdinc.h" #ifndef BUFSIZ #define BUFSIZ 65535 diff --git a/stdinc.h b/stdinc.h new file mode 100644 index 0000000..0262c5b --- /dev/null +++ b/stdinc.h @@ -0,0 +1,43 @@ +/* + * stdinc.h + * pull in standard headers (including portability hacks) + * + * Copyright (c) 2012 William Pitcock . + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __STDINC_H +#define __STDINC_H + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 +# include +#else +# define WIN32_LEAN_AND_MEAN +# include +# include +#endif + +#endif