From ce9e8af7ef225042ad9b2690debd6dd9a0b1f300 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 7 May 2006 21:35:22 +0000 Subject: [PATCH] Add va_copy.h header instead of inlining a definition. --- src/libpspp/ChangeLog | 7 +++++++ src/libpspp/automake.mk | 1 + src/libpspp/str.c | 14 +++++++------- src/libpspp/va_copy.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 src/libpspp/va_copy.h diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index e25f3280..ca11f306 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,10 @@ +Sun May 7 14:32:25 2006 Ben Pfaff + + * va_copy.h: New header. + + * str.c: Use header instead of inlining va_copy() macro + implementation. + Sun May 7 10:06:29 WST 2006 John Darrington * array.c array.h: Constness of sort. diff --git a/src/libpspp/automake.mk b/src/libpspp/automake.mk index 82fe0573..1b5c3528 100644 --- a/src/libpspp/automake.mk +++ b/src/libpspp/automake.mk @@ -28,6 +28,7 @@ src_libpspp_libpspp_a_SOURCES = \ src/libpspp/start-date.h \ src/libpspp/str.c \ src/libpspp/str.h \ + src/libpspp/va_copy.h \ src/libpspp/verbose-msg.c \ src/libpspp/verbose-msg.h \ src/libpspp/version.h diff --git a/src/libpspp/str.c b/src/libpspp/str.c index c4ce9c51..cd9f1aa6 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -18,13 +18,17 @@ 02110-1301, USA. */ #include + #include "str.h" -#include "message.h" + #include #include #include -#include "alloc.h" -#include "message.h" + +#include +#include +#include + #include "minmax.h" #include "size_max.h" @@ -714,10 +718,6 @@ ds_vprintf (struct string *st, const char *format, va_list args_) int avail, needed; va_list args; -#ifndef va_copy -#define va_copy(DST, SRC) (DST) = (SRC) -#endif - va_copy (args, args_); avail = st->string != NULL ? st->capacity - st->length + 1 : 0; needed = vsnprintf (st->string + st->length, avail, format, args); diff --git a/src/libpspp/va_copy.h b/src/libpspp/va_copy.h new file mode 100644 index 00000000..fdbf81a2 --- /dev/null +++ b/src/libpspp/va_copy.h @@ -0,0 +1,33 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Ben Pfaff . + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#ifndef VA_COPY_H +#define VA_COPY_H 1 + +#include + +#ifndef va_copy +#ifdef __va_copy +#define va_copy(DST, SRC) __va_copy (DST, SRC) +#else +#define va_copy(DST, SRC) ((DST) = (SRC)) +#endif +#endif + +#endif /* va_copy.h */ -- 2.30.2