diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2014-01-19 14:35:25 +0100 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2014-01-19 14:35:25 +0100 |
commit | fae4e36024f08ed96cb79195935f637bdfc9875b (patch) | |
tree | 2c13895a0b54eb7b6d6a5f815b65891acff34961 | |
parent | cf6b3dd7ae4bd3ae91a2a23dcb40361ca2e52f98 (diff) | |
download | gmp-fae4e36024f08ed96cb79195935f637bdfc9875b.tar.gz |
Get rid of varargs code and references.
40 files changed, 9 insertions, 492 deletions
diff --git a/demos/expr/README b/demos/expr/README index ea67992da..c1e71ee5e 100644 --- a/demos/expr/README +++ b/demos/expr/README @@ -90,7 +90,7 @@ hex when base==0. White space, as indicated by <ctype.h> isspace(), is ignored except for the purpose of separating tokens. -Variables can be included in expressions by putting them in the varargs list +Variables can be included in expressions by putting them in the stdarg list after the string. "a", "b", "c" etc in the expression string designate those values. For example, diff --git a/demos/expr/expr-impl.h b/demos/expr/expr-impl.h index 76d7b5a47..ee61d3eec 100644 --- a/demos/expr/expr-impl.h +++ b/demos/expr/expr-impl.h @@ -26,12 +26,8 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ || (defined (__mips) && defined (_SYSTYPE_SVR4)) \ || defined (_MSC_VER) \ || defined (_WIN32) -#define HAVE_STDARG 1 + #include <stdarg.h> -#else -#define HAVE_STDARG 0 -#include <varargs.h> -#endif #include "expr.h" @@ -268,16 +268,14 @@ typedef __mpq_struct *mpq_ptr; #define _GMP_H_HAVE_OBSTACK 1 #endif -/* The prototypes for gmp_vprintf etc are provided only if va_list is - available, via an application having included <stdarg.h> or <varargs.h>. - Usually va_list is a typedef so can't be tested directly, but C99 - specifies that va_start is a macro (and it was normally a macro on past - systems too), so look for that. +/* The prototypes for gmp_vprintf etc are provided only if va_list is defined, + via an application having included <stdarg.h>. Usually va_list is a typedef + so can't be tested directly, but C99 specifies that va_start is a macro. <stdio.h> will define some sort of va_list for vprintf and vfprintf, but let's not bother trying to use that since it's not standard and since application uses for gmp_vprintf etc will almost certainly require the - whole <stdarg.h> or <varargs.h> anyway. */ + whole <stdarg.h> anyway. */ #ifdef va_start #define _GMP_H_HAVE_VA_LIST 1 diff --git a/mpf/clears.c b/mpf/clears.c index 41d7a7564..02244d61f 100644 --- a/mpf/clears.c +++ b/mpf/clears.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpf_clears (mpf_ptr x, ...) -#else -mpf_clears (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpf_ptr x; - va_start (ap); - x = va_arg (ap, mpf_ptr); -#endif while (x != NULL) { diff --git a/mpf/inits.c b/mpf/inits.c index ab993e2b1..3188cd806 100644 --- a/mpf/inits.c +++ b/mpf/inits.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpf_inits (mpf_ptr x, ...) -#else -mpf_inits (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpf_ptr x; - va_start (ap); - x = va_arg (ap, mpf_ptr); -#endif while (x != NULL) { diff --git a/mpq/clears.c b/mpq/clears.c index 2070352bb..c5d8a4d7a 100644 --- a/mpq/clears.c +++ b/mpq/clears.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpq_clears (mpq_ptr x, ...) -#else -mpq_clears (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpq_ptr x; - va_start (ap); - x = va_arg (ap, mpq_ptr); -#endif while (x != NULL) { diff --git a/mpq/inits.c b/mpq/inits.c index a44794e37..c4dd58261 100644 --- a/mpq/inits.c +++ b/mpq/inits.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpq_inits (mpq_ptr x, ...) -#else -mpq_inits (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpq_ptr x; - va_start (ap); - x = va_arg (ap, mpq_ptr); -#endif while (x != NULL) { diff --git a/mpz/clears.c b/mpz/clears.c index bc079e7ca..47137e468 100644 --- a/mpz/clears.c +++ b/mpz/clears.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpz_clears (mpz_ptr x, ...) -#else -mpz_clears (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpz_ptr x; - va_start (ap); - x = va_arg (ap, mpz_ptr); -#endif while (x != NULL) { diff --git a/mpz/inits.c b/mpz/inits.c index a195775dd..f0a8e093c 100644 --- a/mpz/inits.c +++ b/mpz/inits.c @@ -17,35 +17,17 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG mpz_inits (mpz_ptr x, ...) -#else -mpz_inits (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, x); -#else - mpz_ptr x; - va_start (ap); - x = va_arg (ap, mpz_ptr); -#endif while (x != NULL) { diff --git a/printf/asprintf.c b/printf/asprintf.c index 638f7eb8b..d7e4b5b7a 100644 --- a/printf/asprintf.c +++ b/printf/asprintf.c @@ -17,38 +17,19 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include "gmp.h" #include "gmp-impl.h" int -#if HAVE_STDARG gmp_asprintf (char **result, const char *fmt, ...) -#else -gmp_asprintf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - char **result; - const char *fmt; - va_start (ap); - result = va_arg (ap, char **); - fmt = va_arg (ap, const char *); -#endif ret = gmp_vasprintf (result, fmt, ap); va_end (ap); diff --git a/printf/asprntffuns.c b/printf/asprntffuns.c index fd1714eb4..0706f7bb5 100644 --- a/printf/asprntffuns.c +++ b/printf/asprntffuns.c @@ -22,14 +22,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ operator<< routines can avoid dragging vsnprintf into the link (via __gmp_asprintf_format). */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/printf/doprnt.c b/printf/doprnt.c index 2cb76726d..f8a5d5a96 100644 --- a/printf/doprnt.c +++ b/printf/doprnt.c @@ -23,14 +23,9 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #define _GNU_SOURCE /* for DECIMAL_POINT in glibc langinfo.h */ -#include "config.h" +#include "config.h" /* needed for the HAVE_, could also move gmp incls */ -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <ctype.h> /* for isdigit */ #include <stddef.h> /* for ptrdiff_t */ #include <string.h> diff --git a/printf/doprntf.c b/printf/doprntf.c index c2469f023..ce7c2de45 100644 --- a/printf/doprntf.c +++ b/printf/doprntf.c @@ -21,14 +21,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> /* for va_list and hence doprnt_funs_t */ -#else -#include <varargs.h> -#endif - #include <ctype.h> #include <string.h> #include <stdio.h> diff --git a/printf/doprnti.c b/printf/doprnti.c index 99e321f3e..4b322b9d5 100644 --- a/printf/doprnti.c +++ b/printf/doprnti.c @@ -21,14 +21,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> /* for va_list and hence doprnt_funs_t */ -#else -#include <varargs.h> -#endif - #include <string.h> #include <stdio.h> #include <stdlib.h> diff --git a/printf/fprintf.c b/printf/fprintf.c index 0f139e464..5c1829a09 100644 --- a/printf/fprintf.c +++ b/printf/fprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" @@ -32,25 +25,12 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_fprintf (FILE *fp, const char *fmt, ...) -#else -gmp_fprintf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - FILE *fp; - const char *fmt; - va_start (ap); - fp = va_arg (ap, FILE *); - fmt = va_arg (ap, const char *); -#endif ret = __gmp_doprnt (&__gmp_fprintf_funs, fp, fmt, ap); va_end (ap); diff --git a/printf/obprintf.c b/printf/obprintf.c index 19b141c01..9a1e4a31b 100644 --- a/printf/obprintf.c +++ b/printf/obprintf.c @@ -21,12 +21,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #if HAVE_OBSTACK_VPRINTF -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <obstack.h> #include <string.h> @@ -35,25 +30,12 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_obstack_printf (struct obstack *ob, const char *fmt, ...) -#else -gmp_obstack_printf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - struct obstack *ob; - const char *fmt; - va_start (ap); - ob = va_arg (ap, struct obstack *); - fmt = va_arg (ap, const char *); -#endif ASSERT (! MEM_OVERLAP_P (obstack_base(ob), obstack_object_size(ob), fmt, strlen(fmt)+1)); diff --git a/printf/obprntffuns.c b/printf/obprntffuns.c index a1ad9c220..51ec42551 100644 --- a/printf/obprntffuns.c +++ b/printf/obprntffuns.c @@ -28,12 +28,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #define _GNU_SOURCE /* ask glibc <stdio.h> for obstack_vprintf */ -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> /* for obstack_vprintf */ #include <string.h> #include <obstack.h> diff --git a/printf/obvprintf.c b/printf/obvprintf.c index 56a3d4d99..394079379 100644 --- a/printf/obvprintf.c +++ b/printf/obvprintf.c @@ -21,12 +21,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #if HAVE_OBSTACK_VPRINTF -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <obstack.h> #include <string.h> diff --git a/printf/printf.c b/printf/printf.c index 8727dca3b..45795dfa8 100644 --- a/printf/printf.c +++ b/printf/printf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" @@ -32,23 +25,12 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_printf (const char *fmt, ...) -#else -gmp_printf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - const char *fmt; - va_start (ap); - fmt = va_arg (ap, const char *); -#endif ret = __gmp_doprnt (&__gmp_fprintf_funs, stdout, fmt, ap); va_end (ap); diff --git a/printf/printffuns.c b/printf/printffuns.c index 2947082c8..b08a7d2fd 100644 --- a/printf/printffuns.c +++ b/printf/printffuns.c @@ -21,14 +21,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include <string.h> diff --git a/printf/repl-vsnprintf.c b/printf/repl-vsnprintf.c index 5b21e0342..7b15bd7f4 100644 --- a/printf/repl-vsnprintf.c +++ b/printf/repl-vsnprintf.c @@ -29,12 +29,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #define _GNU_SOURCE /* for strnlen prototype */ -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <ctype.h> /* for isdigit */ #include <stddef.h> /* for ptrdiff_t */ #include <string.h> diff --git a/printf/snprintf.c b/printf/snprintf.c index 73ab6398a..a80e1937d 100644 --- a/printf/snprintf.c +++ b/printf/snprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <string.h> /* for strlen */ #include "gmp.h" @@ -32,30 +25,16 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_snprintf (char *buf, size_t size, const char *fmt, ...) -#else -gmp_snprintf (va_alist) - va_dcl -#endif { struct gmp_snprintf_t d; va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); d.buf = buf; d.size = size; -#else - const char *fmt; - va_start (ap); - d.buf = va_arg (ap, char *); - d.size = va_arg (ap, size_t); - fmt = va_arg (ap, const char *); -#endif - ASSERT (! MEM_OVERLAP_P (buf, size, fmt, strlen(fmt)+1)); ret = __gmp_doprnt (&__gmp_snprintf_funs, &d, fmt, ap); diff --git a/printf/snprntffuns.c b/printf/snprntffuns.c index a478e89bd..fe774d684 100644 --- a/printf/snprntffuns.c +++ b/printf/snprntffuns.c @@ -21,14 +21,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include <string.h> diff --git a/printf/sprintf.c b/printf/sprintf.c index 8b7b830a9..3e5ef7ce8 100644 --- a/printf/sprintf.c +++ b/printf/sprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <string.h> /* for strlen */ #include "gmp.h" @@ -32,12 +25,7 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_sprintf (char *buf, const char *fmt, ...) -#else -gmp_sprintf (va_alist) - va_dcl -#endif { #if WANT_ASSERT int fmtlen = strlen(fmt); @@ -45,15 +33,7 @@ gmp_sprintf (va_alist) va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - char *buf; - const char *fmt; - va_start (ap); - buf = va_arg (ap, char *); - fmt = va_arg (ap, const char *); -#endif ret = __gmp_doprnt (&__gmp_sprintf_funs, &buf, fmt, ap); va_end (ap); diff --git a/printf/sprintffuns.c b/printf/sprintffuns.c index 0acd9ef39..80f6099cb 100644 --- a/printf/sprintffuns.c +++ b/printf/sprintffuns.c @@ -21,14 +21,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/printf/vasprintf.c b/printf/vasprintf.c index d733c9b8a..9f4f37019 100644 --- a/printf/vasprintf.c +++ b/printf/vasprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/printf/vfprintf.c b/printf/vfprintf.c index f85e5c267..00fb80bc6 100644 --- a/printf/vfprintf.c +++ b/printf/vfprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" diff --git a/printf/vprintf.c b/printf/vprintf.c index cef76127c..21837f46f 100644 --- a/printf/vprintf.c +++ b/printf/vprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" diff --git a/printf/vsnprintf.c b/printf/vsnprintf.c index cb5e31066..4a045db14 100644 --- a/printf/vsnprintf.c +++ b/printf/vsnprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <string.h> /* for strlen */ #include "gmp.h" diff --git a/printf/vsprintf.c b/printf/vsprintf.c index 3cbb52c82..39129133d 100644 --- a/printf/vsprintf.c +++ b/printf/vsprintf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <string.h> /* for strlen */ #include "gmp.h" diff --git a/rand/rand.c b/rand/rand.c index 4039ac35b..984420224 100644 --- a/rand/rand.c +++ b/rand/rand.c @@ -17,39 +17,16 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#include <stdio.h> /* for NULL */ - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include "gmp.h" #include "gmp-impl.h" void -#if HAVE_STDARG -gmp_randinit (gmp_randstate_t rstate, - gmp_randalg_t alg, - ...) -#else -gmp_randinit (va_alist) - va_dcl -#endif +gmp_randinit (gmp_randstate_t rstate, gmp_randalg_t alg, ...) { va_list ap; -#if HAVE_STDARG va_start (ap, alg); -#else - __gmp_randstate_struct *rstate; - gmp_randalg_t alg; - va_start (ap); - rstate = va_arg (ap, __gmp_randstate_struct *); - alg = va_arg (ap, gmp_randalg_t); -#endif switch (alg) { case GMP_RAND_ALG_LC: diff --git a/scanf/doscan.c b/scanf/doscan.c index 08422ceb9..a340b9b90 100644 --- a/scanf/doscan.c +++ b/scanf/doscan.c @@ -23,14 +23,9 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #define _GNU_SOURCE /* for DECIMAL_POINT in langinfo.h */ -#include "config.h" +#include "config.h" /* needed for the HAVE_, could also move gmp incls */ -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <ctype.h> #include <stddef.h> /* for ptrdiff_t */ #include <stdio.h> diff --git a/scanf/fscanf.c b/scanf/fscanf.c index acd6bbde3..54905d797 100644 --- a/scanf/fscanf.c +++ b/scanf/fscanf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" @@ -32,24 +25,11 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_fscanf (FILE *fp, const char *fmt, ...) -#else -gmp_fscanf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - FILE *fp; - const char *fmt; - va_start (ap); - fp = va_arg (ap, FILE *); - fmt = va_arg (ap, const char *); -#endif ret = __gmp_doscan (&__gmp_fscanf_funs, fp, fmt, ap); va_end (ap); diff --git a/scanf/scanf.c b/scanf/scanf.c index 9797fdf8f..aa212725d 100644 --- a/scanf/scanf.c +++ b/scanf/scanf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" @@ -32,22 +25,11 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_scanf (const char *fmt, ...) -#else -gmp_scanf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - const char *fmt; - va_start (ap); - fmt = va_arg (ap, const char *); -#endif ret = __gmp_doscan (&__gmp_fscanf_funs, stdin, fmt, ap); va_end (ap); diff --git a/scanf/sscanf.c b/scanf/sscanf.c index aeb31d06c..4de838856 100644 --- a/scanf/sscanf.c +++ b/scanf/sscanf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" @@ -32,24 +25,11 @@ along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ int -#if HAVE_STDARG gmp_sscanf (const char *s, const char *fmt, ...) -#else -gmp_sscanf (va_alist) - va_dcl -#endif { va_list ap; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - const char *s; - const char *fmt; - va_start (ap); - s = va_arg (ap, const char *); - fmt = va_arg (ap, const char *); -#endif #if SSCANF_WRITABLE_INPUT /* let gmp_vsscanf handle the copying */ diff --git a/scanf/vfscanf.c b/scanf/vfscanf.c index 44685fe32..a17f8873d 100644 --- a/scanf/vfscanf.c +++ b/scanf/vfscanf.c @@ -17,14 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include <stdio.h> #include "gmp.h" diff --git a/scanf/vscanf.c b/scanf/vscanf.c index 5b7a964a6..242811c66 100644 --- a/scanf/vscanf.c +++ b/scanf/vscanf.c @@ -17,13 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <stdio.h> diff --git a/scanf/vsscanf.c b/scanf/vsscanf.c index 80b31430f..a0f7aa60d 100644 --- a/scanf/vsscanf.c +++ b/scanf/vsscanf.c @@ -17,13 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <string.h> diff --git a/tests/misc/t-printf.c b/tests/misc/t-printf.c index d4b197c69..ce2724ecf 100644 --- a/tests/misc/t-printf.c +++ b/tests/misc/t-printf.c @@ -25,13 +25,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ faulty or strange. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <stddef.h> /* for ptrdiff_t */ #include <stdio.h> @@ -73,12 +67,7 @@ FILE *check_vfprintf_fp; void -#if HAVE_STDARG check_plain (const char *want, const char *fmt_orig, ...) -#else -check_plain (va_alist) - va_dcl -#endif { char got[MAX_OUTPUT]; int got_len, want_len; @@ -86,15 +75,7 @@ check_plain (va_alist) char *fmt, *q; const char *p; va_list ap; -#if HAVE_STDARG va_start (ap, fmt_orig); -#else - const char *want; - const char *fmt_orig; - va_start (ap); - want = va_arg (ap, const char *); - fmt_orig = va_arg (ap, const char *); -#endif if (! option_check_printf) return; @@ -318,23 +299,10 @@ check_obstack_vprintf (const char *want, const char *fmt, va_list ap) void -#if HAVE_STDARG check_one (const char *want, const char *fmt, ...) -#else -check_one (va_alist) - va_dcl -#endif { va_list ap; -#if HAVE_STDARG va_start (ap, fmt); -#else - const char *want; - const char *fmt; - va_start (ap); - want = va_arg (ap, const char *); - fmt = va_arg (ap, const char *); -#endif /* simplest first */ check_vsprintf (want, fmt, ap); diff --git a/tests/misc/t-scanf.c b/tests/misc/t-scanf.c index af04d909c..46c0a5f77 100644 --- a/tests/misc/t-scanf.c +++ b/tests/misc/t-scanf.c @@ -29,13 +29,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ seem like too much trouble. */ -#include "config.h" - -#if HAVE_STDARG #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <stddef.h> /* for ptrdiff_t */ #include <stdio.h> @@ -129,25 +123,12 @@ int fromstring_next_c; /* Call gmp_fscanf, reading the "input" string data provided. */ int -#if HAVE_STDARG fromstring_gmp_fscanf (const char *input, const char *fmt, ...) -#else -fromstring_gmp_fscanf (va_alist) - va_dcl -#endif { va_list ap; FILE *fp; int ret; -#if HAVE_STDARG va_start (ap, fmt); -#else - const char *input; - const char *fmt; - va_start (ap); - input = va_arg (ap, const char *); - fmt = va_arg (ap, const char *); -#endif fp = fopen (TEMPFILE, "w+"); ASSERT_ALWAYS (fp != NULL); |