[PATCH 17/20] Convert the scanf directory to __GMP_*_DEFINE and include changes

Richard Henderson rth at twiddle.net
Mon Mar 4 19:41:47 CET 2013


---
 scanf/doscan.c     | 32 ++------------------------------
 scanf/fscanf.c     | 12 +-----------
 scanf/fscanffuns.c |  3 +--
 scanf/scanf.c      | 12 +-----------
 scanf/sscanf.c     | 12 +-----------
 scanf/sscanffuns.c |  4 +---
 scanf/vfscanf.c    | 12 +-----------
 scanf/vscanf.c     | 12 +-----------
 scanf/vsscanf.c    | 12 +-----------
 9 files changed, 10 insertions(+), 101 deletions(-)

diff --git a/scanf/doscan.c b/scanf/doscan.c
index 2c5b1d9..0d2b117 100644
--- a/scanf/doscan.c
+++ b/scanf/doscan.c
@@ -21,21 +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 http://www.gnu.org/licenses/.  */
 
-#define _GNU_SOURCE    /* for DECIMAL_POINT in langinfo.h */
-
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <ctype.h>
-#include <stddef.h>    /* for ptrdiff_t */
-#include <stdio.h>
-#include <stdlib.h>    /* for strtol */
-#include <string.h>
+#include "gmp-impl.h"
 
 #if HAVE_LANGINFO_H
 #include <langinfo.h>  /* for nl_langinfo */
@@ -45,21 +31,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #include <locale.h>    /* for localeconv */
 #endif
 
-#if HAVE_INTTYPES_H
-# include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h> /* for quad_t */
-#endif
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
 
 /* Change this to "#define TRACE(x) x" for some traces. */
 #define TRACE(x)
@@ -760,3 +731,4 @@ __gmp_doscan (const struct gmp_doscan_funs_t *funs, void *data,
   (*__gmp_free_func) (alloc_fmt, alloc_fmt_size);
   return fields;
 }
+__GMP_INTERN_DEFINE (__gmp_doscan)
diff --git a/scanf/fscanf.c b/scanf/fscanf.c
index 596571e..459f360 100644
--- a/scanf/fscanf.c
+++ b/scanf/fscanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -55,3 +44,4 @@ gmp_fscanf (va_alist)
   va_end (ap);
   return ret;
 }
+__GMP_PUBLIC_DEFINE (gmp_fscanf)
diff --git a/scanf/fscanffuns.c b/scanf/fscanffuns.c
index 7459023..d9cf9c5 100644
--- a/scanf/fscanffuns.c
+++ b/scanf/fscanffuns.c
@@ -21,8 +21,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include <stdio.h>
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -49,3 +47,4 @@ const struct gmp_doscan_funs_t  __gmp_fscanf_funs = {
   (gmp_doscan_get_t)   fgetc,
   (gmp_doscan_unget_t) ungetc,
 };
+__GMP_INTERN_DEFINE (__gmp_fscanf_funs)
diff --git a/scanf/scanf.c b/scanf/scanf.c
index b4840d1..e925497 100644
--- a/scanf/scanf.c
+++ b/scanf/scanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -53,3 +42,4 @@ gmp_scanf (va_alist)
   va_end (ap);
   return ret;
 }
+__GMP_PUBLIC_DEFINE (gmp_scanf)
diff --git a/scanf/sscanf.c b/scanf/sscanf.c
index 3eb10ee..61cdafd 100644
--- a/scanf/sscanf.c
+++ b/scanf/sscanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -60,3 +49,4 @@ gmp_sscanf (va_alist)
   va_end (ap);
   return ret;
 }
+__GMP_PUBLIC_DEFINE (gmp_sscanf)
diff --git a/scanf/sscanffuns.c b/scanf/sscanffuns.c
index 008bad7..d4664e4 100644
--- a/scanf/sscanffuns.c
+++ b/scanf/sscanffuns.c
@@ -21,9 +21,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include <stdio.h>
-#include <stdarg.h>
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -111,3 +108,4 @@ const struct gmp_doscan_funs_t  __gmp_sscanf_funs = {
   (gmp_doscan_get_t)   get,
   (gmp_doscan_unget_t) unget,
 };
+__GMP_INTERN_DEFINE (__gmp_sscanf_funs)
diff --git a/scanf/vfscanf.c b/scanf/vfscanf.c
index 2f8684c..a7d9b90 100644
--- a/scanf/vfscanf.c
+++ b/scanf/vfscanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -36,3 +25,4 @@ gmp_vfscanf (FILE *fp, const char *fmt, va_list ap)
 {
   return __gmp_doscan (&__gmp_fscanf_funs, fp, fmt, ap);
 }
+__GMP_PUBLIC_DEFINE (gmp_vfscanf)
diff --git a/scanf/vscanf.c b/scanf/vscanf.c
index a411a7c..35be89e 100644
--- a/scanf/vscanf.c
+++ b/scanf/vscanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -36,3 +25,4 @@ gmp_vscanf (const char *fmt, va_list ap)
 {
   return __gmp_doscan (&__gmp_fscanf_funs, stdin, fmt, ap);
 }
+__GMP_PUBLIC_DEFINE (gmp_vscanf)
diff --git a/scanf/vsscanf.c b/scanf/vsscanf.c
index 160e62d..0951c6c 100644
--- a/scanf/vsscanf.c
+++ b/scanf/vsscanf.c
@@ -17,17 +17,6 @@ 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 http://www.gnu.org/licenses/.  */
 
-#include "config.h"
-
-#if HAVE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include <string.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -54,3 +43,4 @@ gmp_vsscanf (const char *s, const char *fmt, va_list ap)
   return __gmp_doscan (&__gmp_sscanf_funs, (void *) &s, fmt, ap);
 #endif
 }
+__GMP_PUBLIC_DEFINE (gmp_vsscanf)
-- 
1.8.1.2



More information about the gmp-devel mailing list