summaryrefslogtreecommitdiff
path: root/printf
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2014-01-19 14:35:25 +0100
committerTorbjorn Granlund <tege@gmplib.org>2014-01-19 14:35:25 +0100
commitfae4e36024f08ed96cb79195935f637bdfc9875b (patch)
tree2c13895a0b54eb7b6d6a5f815b65891acff34961 /printf
parentcf6b3dd7ae4bd3ae91a2a23dcb40361ca2e52f98 (diff)
downloadgmp-fae4e36024f08ed96cb79195935f637bdfc9875b.tar.gz
Get rid of varargs code and references.
Diffstat (limited to 'printf')
-rw-r--r--printf/asprintf.c19
-rw-r--r--printf/asprntffuns.c7
-rw-r--r--printf/doprnt.c7
-rw-r--r--printf/doprntf.c7
-rw-r--r--printf/doprnti.c7
-rw-r--r--printf/fprintf.c20
-rw-r--r--printf/obprintf.c18
-rw-r--r--printf/obprntffuns.c5
-rw-r--r--printf/obvprintf.c5
-rw-r--r--printf/printf.c18
-rw-r--r--printf/printffuns.c7
-rw-r--r--printf/repl-vsnprintf.c5
-rw-r--r--printf/snprintf.c21
-rw-r--r--printf/snprntffuns.c7
-rw-r--r--printf/sprintf.c20
-rw-r--r--printf/sprintffuns.c7
-rw-r--r--printf/vasprintf.c7
-rw-r--r--printf/vfprintf.c7
-rw-r--r--printf/vprintf.c7
-rw-r--r--printf/vsnprintf.c7
-rw-r--r--printf/vsprintf.c7
21 files changed, 1 insertions, 214 deletions
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"