From 4a61e4901ebc751fea57880424f9045e3bdf238e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Apr 2006 16:05:21 +0000 Subject: r14999: Remove more unused autoconf code Simplify va_copy() replacement code a bit (This used to be commit a5c87360a7f14a90b831ea372277f4f89ee4c5f1) --- source4/lib/appweb/mpr/miniMpr.c | 12 ------------ source4/lib/replace/replace.h | 16 +++++++--------- source4/lib/talloc/talloc.c | 18 ++++++++---------- source4/lib/util/dprintf.c | 2 +- source4/lib/util/select.c | 2 +- source4/lib/util/util_file.c | 2 +- source4/lib/util/xfile.c | 2 +- 7 files changed, 19 insertions(+), 35 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/appweb/mpr/miniMpr.c b/source4/lib/appweb/mpr/miniMpr.c index f4c219fe4c..8df1817bf1 100644 --- a/source4/lib/appweb/mpr/miniMpr.c +++ b/source4/lib/appweb/mpr/miniMpr.c @@ -330,13 +330,7 @@ static int mprCoreStrcat(int alloc, char **destp, int destMax, int existingLen, dest = *destp; sepLen = (delim) ? strlen(delim) : 0; -#ifdef HAVE_VA_COPY va_copy(ap, args); -#elif HAVE___VA_COPY - __va_copy(ap, args); -#else - ap = args; -#endif addBytes = 0; str = src; while (str) { @@ -371,13 +365,7 @@ static int mprCoreStrcat(int alloc, char **destp, int destMax, int existingLen, } if (addBytes > 0) { -#ifdef HAVE_VA_COPY va_copy(ap, args); -#elif HAVE___VA_COPY - __va_copy(ap, args); -#else - ap = args; -#endif str = src; while (str) { strcpy(dp, str); diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 20b73e5b84..f68c5b23a9 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -134,18 +134,16 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3); #define slprintf snprintf -#ifdef HAVE_VA_COPY -#define VA_COPY(dest, src) va_copy(dest, src) -#elif defined(HAVE___VA_COPY) -#define VA_COPY(dest, src) __va_copy(dest, src) +#ifndef HAVE_VA_COPY +#ifdef HAVE___VA_COPY +#define va_copy(dest, src) __va_copy(dest, src) #else -#define VA_COPY(dest, src) (dest) = (src) +#define va_copy(dest, src) (dest) = (src) +#endif #endif -#if defined(HAVE_VOLATILE) -#define VOLATILE volatile -#else -#define VOLATILE +#ifndef HAVE_VOLATILE +#define volatile #endif #ifndef HAVE_COMPARISON_FN_T diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 99ede462b8..8f046a02b8 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -999,13 +999,11 @@ char *talloc_strndup(const void *t, const char *p, size_t n) return ret; } -#ifndef VA_COPY -#ifdef HAVE_VA_COPY -#define VA_COPY(dest, src) va_copy(dest, src) -#elif defined(HAVE___VA_COPY) -#define VA_COPY(dest, src) __va_copy(dest, src) +#ifndef HAVE_VA_COPY +#ifdef HAVE___VA_COPY +#define va_copy(dest, src) __va_copy(dest, src) #else -#define VA_COPY(dest, src) (dest) = (src) +#define va_copy(dest, src) (dest) = (src) #endif #endif @@ -1016,7 +1014,7 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) va_list ap2; char c; - VA_COPY(ap2, ap); + va_copy(ap2, ap); /* this call looks strange, but it makes it work on older solaris boxes */ if ((len = vsnprintf(&c, 1, fmt, ap2)) < 0) { @@ -1025,7 +1023,7 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) ret = _talloc(t, len+1); if (ret) { - VA_COPY(ap2, ap); + va_copy(ap2, ap); vsnprintf(ret, len+1, fmt, ap2); talloc_set_name_const(ret, ret); } @@ -1067,7 +1065,7 @@ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) tc = talloc_chunk_from_ptr(s); - VA_COPY(ap2, ap); + va_copy(ap2, ap); s_len = tc->size - 1; if ((len = vsnprintf(NULL, 0, fmt, ap2)) <= 0) { @@ -1083,7 +1081,7 @@ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) s = talloc_realloc(NULL, s, char, s_len + len+1); if (!s) return NULL; - VA_COPY(ap2, ap); + va_copy(ap2, ap); vsnprintf(s+s_len, len+1, fmt, ap2); talloc_set_name_const(s, s); diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c index 916db3af93..62dc2a227a 100644 --- a/source4/lib/util/dprintf.c +++ b/source4/lib/util/dprintf.c @@ -38,7 +38,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBU va_list ap2; /* do any message translations */ - VA_COPY(ap2, ap); + va_copy(ap2, ap); ret = vasprintf(&p, format, ap2); diff --git a/source4/lib/util/select.c b/source4/lib/util/select.c index a1b2e04065..4f906f2454 100644 --- a/source4/lib/util/select.c +++ b/source4/lib/util/select.c @@ -32,7 +32,7 @@ static pid_t initialised; static int select_pipe[2]; -static VOLATILE unsigned pipe_written, pipe_read; +static volatile unsigned pipe_written, pipe_read; /******************************************************************* Call this from all Samba signal handlers if you want to avoid a diff --git a/source4/lib/util/util_file.c b/source4/lib/util/util_file.c index 3f6a6b3a40..8d8e7c6ec9 100644 --- a/source4/lib/util/util_file.c +++ b/source4/lib/util/util_file.c @@ -371,7 +371,7 @@ _PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) _PRINTF_ATTRIBUTE int len, ret; va_list ap2; - VA_COPY(ap2, ap); + va_copy(ap2, ap); len = vasprintf(&p, format, ap2); if (len <= 0) return len; diff --git a/source4/lib/util/xfile.c b/source4/lib/util/xfile.c index 97bab2ef9a..1cf77a3220 100644 --- a/source4/lib/util/xfile.c +++ b/source4/lib/util/xfile.c @@ -202,7 +202,7 @@ size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) int len, ret; va_list ap2; - VA_COPY(ap2, ap); + va_copy(ap2, ap); len = vasprintf(&p, format, ap2); if (len <= 0) return len; -- cgit