summaryrefslogtreecommitdiff
path: root/libgfortran/libgfortran.h
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gmail.com>2021-12-25 15:07:12 +0100
committerFrancois-Xavier Coudert <fxcoudert@gmail.com>2021-12-25 15:07:12 +0100
commit4ae906e46c4c173b79c9c60c6157ff68e05f7464 (patch)
tree30547d298d8ea29320e37d7e765c363ff22135ee /libgfortran/libgfortran.h
parentffb5418fb79e951e4a8cc818e2408106aa58b9a8 (diff)
downloadgcc-4ae906e46c4c173b79c9c60c6157ff68e05f7464.tar.gz
Fortran: simplify library code for integer-to-decimal conversion
libgfortran/ChangeLog: PR libfortran/81986 PR libfortran/99191 * libgfortran.h: Remove gfc_xtoa(), adjust gfc_itoa() and GFC_ITOA_BUF_SIZE. * io/write.c (write_decimal): conversion parameter is always gfc_itoa(), so remove it. Protect from overflow. (xtoa): Move gfc_xtoa and update its name. (xtoa_big): Renamed from ztoa_big for consistency. (write_z): Adjust to new function names. (write_i, write_integer): Remove last arg of write_decimal. * runtime/backtrace.c (error_callback): Comment on the use of gfc_itoa(). * runtime/error.c (gfc_xtoa): Move to io/write.c. * runtime/string.c (gfc_itoa): Take an unsigned argument, remove the handling of negative values.
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r--libgfortran/libgfortran.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 93e3591b21f..6d60a9ca314 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -710,7 +710,7 @@ internal_proto(show_backtrace);
#define GFC_LARGEST_BUF (sizeof (GFC_INTEGER_LARGEST))
#endif
-#define GFC_ITOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 2)
+#define GFC_ITOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 1)
#define GFC_XTOA_BUF_SIZE (GFC_LARGEST_BUF * 2 + 1)
#define GFC_OTOA_BUF_SIZE (GFC_LARGEST_BUF * 3 + 1)
#define GFC_BTOA_BUF_SIZE (GFC_LARGEST_BUF * 8 + 1)
@@ -738,9 +738,6 @@ extern int st_printf (const char *, ...)
__attribute__((format (gfc_printf, 1, 2)));
internal_proto(st_printf);
-extern const char *gfc_xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
-internal_proto(gfc_xtoa);
-
extern _Noreturn void os_error (const char *);
iexport_proto(os_error);
@@ -896,7 +893,7 @@ internal_proto(fc_strdup);
extern char *fc_strdup_notrim(const char *, gfc_charlen_type);
internal_proto(fc_strdup_notrim);
-extern const char *gfc_itoa(GFC_INTEGER_LARGEST, char *, size_t);
+extern const char *gfc_itoa(GFC_UINTEGER_LARGEST, char *, size_t);
internal_proto(gfc_itoa);
/* io/intrinsics.c */