summaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-08 16:48:07 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-08 16:48:07 +0000
commite2b8076165efc71ea2dcfadacd63917c5f269fd6 (patch)
treea970504f9831850f9b5d3dc40d4ebab2b7bec39a /libgfortran/runtime
parent3a44a278cd790dbef005fdb5b727969519f34639 (diff)
downloadgcc-e2b8076165efc71ea2dcfadacd63917c5f269fd6.tar.gz
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/string.c (compare0): Use gfc_charlen_type. * runtime/error.c (gfc_itoa): Move to io/write.c (xtoa): Rename to gfc_xtoa. * runtime/backtrace.c (show_backtrace): Call gfc_xtoa. * intrinsics/cshift0.c (cshift0): Use index_type for shift arg. * intrinsics/date_and_time.c (date_and_time): Use index_type. (itime_i4): Likewise. (itime_i8): Likewise. (idate_i4): Likewise. (idate_i8): Likewise. (gmtime_i4): Likewise. (gmtime_i8): Likewise. (ltime_i4): Likewise. (ltime_i8): Likewise. * libgfortran.h (gfc_itoa): Remove prototype. (xtoa): Rename prototype to gfc_xtoa. * io/list_read.c (nml_read_obj): Use size_t for string length. * io/transfer.c (read_block_direct): Change nbytes arg from pointer to value. (unformatted_read): Minor cleanup, call read_block_directly properly. (skip_record): Use ssize_t. (next_record_w_unf): Avoid stell() call by calling sseek with SEEK_CUR. (iolength_transfer): Make sure to multiply before cast. * io/intrinsics.c (fgetc): Remove unnecessary variable. * io/format.c (format_hash): Use gfc_charlen_type. * io/write.c (itoa): Move from runtime/error.c:gfc_itoa, rename, make static. (write_i): Call with pointer to itoa. (write_z): Call with pointer to gfc_xtoa. (write_integer): Pointer to itoa. (nml_write_obj): Type cleanup, don't call strlen in loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145758 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/backtrace.c4
-rw-r--r--libgfortran/runtime/error.c43
-rw-r--r--libgfortran/runtime/string.c4
3 files changed, 7 insertions, 44 deletions
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 4a3388841f8..0dd207466ef 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -152,7 +152,7 @@ show_backtrace (void)
/* Write the list of addresses in hexadecimal format. */
for (i = 0; i < depth; i++)
- addr[i] = xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i],
+ addr[i] = gfc_xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i],
sizeof (addr_buf[i]));
/* Don't output an error message if something goes wrong, we'll simply
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index d75eaf23832..2dede7215c4 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -116,47 +116,10 @@ sys_exit (int code)
* Other error returns are reserved for the STOP statement with a numeric code.
*/
-/* gfc_itoa()-- Integer to decimal conversion. */
+/* gfc_xtoa()-- Integer to hexadecimal conversion. */
const char *
-gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
-{
- int negative;
- char *p;
- GFC_UINTEGER_LARGEST t;
-
- assert (len >= GFC_ITOA_BUF_SIZE);
-
- if (n == 0)
- return "0";
-
- negative = 0;
- t = n;
- if (n < 0)
- {
- negative = 1;
- t = -n; /*must use unsigned to protect from overflow*/
- }
-
- p = buffer + GFC_ITOA_BUF_SIZE - 1;
- *p = '\0';
-
- while (t != 0)
- {
- *--p = '0' + (t % 10);
- t /= 10;
- }
-
- if (negative)
- *--p = '-';
- return p;
-}
-
-
-/* xtoa()-- Integer to hexadecimal conversion. */
-
-const char *
-xtoa (GFC_UINTEGER_LARGEST n, char *buffer, size_t len)
+gfc_xtoa (GFC_UINTEGER_LARGEST n, char *buffer, size_t len)
{
int digit;
char *p;
diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c
index ee7bcfb4be8..a14f82c502f 100644
--- a/libgfortran/runtime/string.c
+++ b/libgfortran/runtime/string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
Contributed by Paul Brook
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -37,7 +37,7 @@ Boston, MA 02110-1301, USA. */
static int
compare0 (const char *s1, gfc_charlen_type s1_len, const char *s2)
{
- size_t len;
+ gfc_charlen_type len;
/* Strip trailing blanks from the Fortran string. */
len = fstrlen (s1, s1_len);