From: des Date: Tue, 8 Aug 2006 07:17:10 +0000 (+0000) Subject: Split compat.h into one header per function to avoid issues with e.g. the X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=333120597bc65134845241a79f8d5d66d3bbd9df;p=varnish Split compat.h into one header per function to avoid issues with e.g. the vasprintf() prototype needing even when it isn't used. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@761 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/mgt_cli.c b/varnish-cache/bin/varnishd/mgt_cli.c index 41918e4e..10345e0e 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.c +++ b/varnish-cache/bin/varnishd/mgt_cli.c @@ -13,7 +13,7 @@ #include #include -#include "compat.h" +#include "compat/vasprintf.h" #include "cli_priv.h" #include "cli.h" #include "vsb.h" diff --git a/varnish-cache/bin/varnishd/mgt_vcc.c b/varnish-cache/bin/varnishd/mgt_vcc.c index 95c7c6a8..a9fa2495 100644 --- a/varnish-cache/bin/varnishd/mgt_vcc.c +++ b/varnish-cache/bin/varnishd/mgt_vcc.c @@ -11,7 +11,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "vsb.h" #include "queue.h" diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index 47bb31ca..f16b8ae8 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -19,7 +19,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "shmlog.h" #include "cache.h" diff --git a/varnish-cache/bin/varnishd/tcp.c b/varnish-cache/bin/varnishd/tcp.c index 5df51724..61a65272 100644 --- a/varnish-cache/bin/varnishd/tcp.c +++ b/varnish-cache/bin/varnishd/tcp.c @@ -10,6 +10,7 @@ #include #include +#include "compat/strlcpy.h" #include "heritage.h" #include "mgt.h" diff --git a/varnish-cache/include/Makefile.am b/varnish-cache/include/Makefile.am index 2cfcef96..36bd3fe9 100644 --- a/varnish-cache/include/Makefile.am +++ b/varnish-cache/include/Makefile.am @@ -5,7 +5,10 @@ noinst_HEADERS = \ cli.h \ cli_common.h \ cli_priv.h \ - compat.h \ + compat/asprintf.h \ + compat/strlcat.h \ + compat/strlcpy.h \ + compat/vasprintf.h \ hash.h \ http_headers.h \ libvarnish.h \ diff --git a/varnish-cache/include/compat.h b/varnish-cache/include/compat.h deleted file mode 100644 index c6ff735e..00000000 --- a/varnish-cache/include/compat.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * $Id$ - */ - -#ifndef COMPAT_H_INCLUDED -#define COMPAT_H_INCLUDED - -#ifndef HAVE_VASPRINTF -#ifdef va_start /* make sure is in scope */ -int vasprintf(char **strp, const char *fmt, va_list ap); -#endif -#endif - -#ifndef HAVE_ASPRINTF -int asprintf(char **strp, const char *fmt, ...); -#endif - -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t size); -#endif - -#ifndef HAVE_STRLCAT -size_t strlcat(char *dst, const char *src, size_t size); -#endif - -#endif diff --git a/varnish-cache/include/compat/asprintf.h b/varnish-cache/include/compat/asprintf.h new file mode 100644 index 00000000..70a596b7 --- /dev/null +++ b/varnish-cache/include/compat/asprintf.h @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_ASPRINTF_H_INCLUDED +#define COMPAT_ASPRINTF_H_INCLUDED + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...); +#endif + +#endif diff --git a/varnish-cache/include/compat/strlcat.h b/varnish-cache/include/compat/strlcat.h new file mode 100644 index 00000000..11b75660 --- /dev/null +++ b/varnish-cache/include/compat/strlcat.h @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_STRLCAT_H_INCLUDED +#define COMPAT_STRLCAT_H_INCLUDED + +#ifndef HAVE_STRLCAT +size_t strlcat(char *dst, const char *src, size_t size); +#endif + +#endif diff --git a/varnish-cache/include/compat/strlcpy.h b/varnish-cache/include/compat/strlcpy.h new file mode 100644 index 00000000..d6f252eb --- /dev/null +++ b/varnish-cache/include/compat/strlcpy.h @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_STRLCPY_H_INCLUDED +#define COMPAT_STRLCPY_H_INCLUDED + +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t size); +#endif + +#endif diff --git a/varnish-cache/include/compat/vasprintf.h b/varnish-cache/include/compat/vasprintf.h new file mode 100644 index 00000000..59104f1a --- /dev/null +++ b/varnish-cache/include/compat/vasprintf.h @@ -0,0 +1,12 @@ +/* + * $Id$ + */ + +#ifndef COMPAT_VASPRINTF_H_INCLUDED +#define COMPAT_VASPRINTF_H_INCLUDED + +#ifndef HAVE_VASPRINTF +int vasprintf(char **strp, const char *fmt, va_list ap); +#endif + +#endif diff --git a/varnish-cache/lib/libcompat/asprintf.c b/varnish-cache/lib/libcompat/asprintf.c index 2347e327..266e99b2 100644 --- a/varnish-cache/lib/libcompat/asprintf.c +++ b/varnish-cache/lib/libcompat/asprintf.c @@ -3,12 +3,14 @@ * */ +#ifndef HAVE_ASPRINTF + #include #include -#include "compat.h" +#include "compat/asprintf.h" +#include "compat/vasprintf.h" -#ifndef HAVE_ASPRINTF int asprintf(char **strp, const char *fmt, ...) { diff --git a/varnish-cache/lib/libcompat/strlcat.c b/varnish-cache/lib/libcompat/strlcat.c index 21f09e7b..3dd45f87 100644 --- a/varnish-cache/lib/libcompat/strlcat.c +++ b/varnish-cache/lib/libcompat/strlcat.c @@ -17,12 +17,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef HAVE_STRLCAT + #include #include -#include "compat.h" +#include "compat/strlcat.h" -#ifndef HAVE_STRLCAT /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters diff --git a/varnish-cache/lib/libcompat/strlcpy.c b/varnish-cache/lib/libcompat/strlcpy.c index bf22e472..c8c5109b 100644 --- a/varnish-cache/lib/libcompat/strlcpy.c +++ b/varnish-cache/lib/libcompat/strlcpy.c @@ -17,12 +17,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef HAVE_STRLCPY + #include #include -#include "compat.h" +#include "compat/strlcpy.h" -#ifndef HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). diff --git a/varnish-cache/lib/libcompat/vasprintf.c b/varnish-cache/lib/libcompat/vasprintf.c index 08fd6992..99b2df7f 100644 --- a/varnish-cache/lib/libcompat/vasprintf.c +++ b/varnish-cache/lib/libcompat/vasprintf.c @@ -3,13 +3,14 @@ * */ +#ifndef HAVE_VASPRINTF + #include #include #include -#include "compat.h" +#include "compat/vasprintf.h" -#ifndef HAVE_VASPRINTF int vasprintf(char **strp, const char *fmt, va_list ap) { diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index b5a40765..29345998 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -49,7 +49,7 @@ #include #include -#include "compat.h" +#include "compat/asprintf.h" #include "vsb.h" #include "vcc_priv.h"