Move all portability gunk into stdinc.h. (Issue #18)

pull/29/head
William Pitcock 2012-05-11 13:47:20 -05:00
parent 9775fe8c66
commit 56fbf25c8a
4 changed files with 44 additions and 12 deletions

3
main.c
View File

@ -22,9 +22,6 @@
*/
#include "config.h"
#include <libgen.h>
#include "pkg.h"
#ifdef HAVE_GETOPT_LONG

1
pkg.c
View File

@ -25,7 +25,6 @@
#include "bsdstubs.h"
#ifdef _WIN32
# include <windows.h>
# define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
#endif

9
pkg.h
View File

@ -25,14 +25,7 @@
#define __PKG_H
#include "config.h"
#define _GNU_SOURCE
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <alloca.h>
#include "stdinc.h"
#ifndef BUFSIZ
#define BUFSIZ 65535

43
stdinc.h Normal file
View File

@ -0,0 +1,43 @@
/*
* stdinc.h
* pull in standard headers (including portability hacks)
*
* Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>.
*
* 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 <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <libgen.h>
#ifndef _WIN32
# include <alloca.h>
#else
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <malloc.h>
#endif
#endif