diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-28 23:23:35 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-28 23:23:35 +0000 |
commit | cca462e37f40318bee486687e07fb489370b4ab4 (patch) | |
tree | 8715a6c860658cac9b255cfeaab985075c62d031 /libgfortran | |
parent | a664abf7568b983815ffdddbc8482ee1f61d18ec (diff) | |
download | gcc-cca462e37f40318bee486687e07fb489370b4ab4.tar.gz |
2007-04-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/31501
* io/list_read.c (next_char): Fix whitespace.
* io/io.h: Remove prototypes and define macros for is_array_io,
is_stream_io, and is_internal_unit.
* io/unit.c (is_array_io), (is_internal_unit), (is_stream_io): Delete
these functions.
* io/transfer.c (read_sf): Change handling of internal_unit to make a
single call to salloc_r and use memcpy to transfer the data.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124266 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 11 | ||||
-rw-r--r-- | libgfortran/io/io.h | 17 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 6 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 17 | ||||
-rw-r--r-- | libgfortran/io/unit.c | 27 |
5 files changed, 32 insertions, 46 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 983c64ff86b..409c20d64a0 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,14 @@ +2007-04-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/31501 + * io/list_read.c (next_char): Fix whitespace. + * io/io.h: Remove prototypes and define macros for is_array_io, + is_stream_io, and is_internal_unit. + * io/unit.c (is_array_io), (is_internal_unit), (is_stream_io): Delete + these functions. + * io/transfer.c (read_sf): Change handling of internal_unit to make a + single call to salloc_r and use memcpy to transfer the data. + 2007-04-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/31532 diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 1e5a6c9fdbf..181c1816b61 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -80,6 +80,14 @@ stream; #define sset(s, c, n) ((s)->set)(s, c, n) +/* Macros for testing what kinds of I/O we are doing. */ + +#define is_array_io(dtp) ((dtp)->internal_unit_desc) + +#define is_internal_unit(dtp) ((dtp)->u.p.unit_is_internal) + +#define is_stream_io(dtp) ((dtp)->u.p.current_unit->flags.access == ACCESS_STREAM) + /* The array_loop_spec contains the variables for the loops over index ranges that are encountered. Since the variables can be negative, ssize_t is used. */ @@ -672,15 +680,6 @@ internal_proto(get_internal_unit); extern void free_internal_unit (st_parameter_dt *); internal_proto(free_internal_unit); -extern int is_internal_unit (st_parameter_dt *); -internal_proto(is_internal_unit); - -extern int is_array_io (st_parameter_dt *); -internal_proto(is_array_io); - -extern int is_stream_io (st_parameter_dt *); -internal_proto(is_stream_io); - extern gfc_unit *find_unit (int); internal_proto(find_unit); diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 3203f3116f7..9e2e0f91484 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -165,7 +165,7 @@ next_char (st_parameter_dt *dtp) /* Handle the end-of-record and end-of-file conditions for internal array unit. */ - if (is_array_io(dtp)) + if (is_array_io (dtp)) { if (dtp->u.p.at_eof) longjmp (*dtp->u.p.eof_jump, 1); @@ -201,9 +201,9 @@ next_char (st_parameter_dt *dtp) if (is_stream_io (dtp)) dtp->u.p.current_unit->strm_pos++; - if (is_internal_unit(dtp)) + if (is_internal_unit (dtp)) { - if (is_array_io(dtp)) + if (is_array_io (dtp)) { /* End of record is handled in the next pass through, above. The check for NULL here is cautionary. */ diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index ac5f11b40ff..13bb27206fd 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -164,18 +164,19 @@ read_sf (st_parameter_dt *dtp, int *length, int no_error) return base; } + if (is_internal_unit (dtp)) + { + readlen = *length; + q = salloc_r (dtp->u.p.current_unit->s, &readlen); + memcpy (p, q, readlen); + goto done; + } + readlen = 1; n = 0; do { - if (is_internal_unit (dtp)) - { - /* readlen may be modified inside salloc_r if - is_internal_unit (dtp) is true. */ - readlen = 1; - } - q = salloc_r (dtp->u.p.current_unit->s, &readlen); if (q == NULL) break; @@ -244,6 +245,8 @@ read_sf (st_parameter_dt *dtp, int *length, int no_error) dtp->u.p.sf_seen_eor = 0; } while (n < *length); + + done: dtp->u.p.current_unit->bytes_left -= *length; if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 7a4000d9fb5..c468510b875 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -476,33 +476,6 @@ get_unit (st_parameter_dt *dtp, int do_create) } -/* is_internal_unit()-- Determine if the current unit is internal or not */ - -int -is_internal_unit (st_parameter_dt *dtp) -{ - return dtp->u.p.unit_is_internal; -} - - -/* is_array_io ()-- Determine if the I/O is to/from an array */ - -int -is_array_io (st_parameter_dt *dtp) -{ - return dtp->internal_unit_desc != NULL; -} - - -/* is_stream_io () -- Determine if I/O is access="stream" mode */ - -int -is_stream_io (st_parameter_dt *dtp) -{ - return dtp->u.p.current_unit->flags.access == ACCESS_STREAM; -} - - /*************************/ /* Initialize everything */ |