aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.h
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-31 14:52:26 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-31 14:52:26 +0000
commit411780149a7445ab51177f7337ac89748a09d143 (patch)
tree9abe59faaeca5c3b0989af7c8a5b04030589fb90 /libgfortran/io/unix.h
parentcc65b133497323602614f80780db62a8dd7e22c8 (diff)
Introduce a size member function to struct stream.
2011-10-31 Janne Blomqvist <jb@gcc.gnu.org> * io/unix.h (struct stream): Add size function pointer. (ssize): New inline function. (file_length): Remove prototype. * io/unix.c (raw_size): New function. (raw_init): Initialize st.size pointer. (buf_size): New function. (buf_init): Initialize st.size pointer. (open_internal): Likewise. (open_internal4): Likewise. (file_length): Remove function. * io/file_pos.c (st_rewind): Use ssize instead of file_length. * io/open.c (test_endfile): Likewise. * io/transfer.c (data_transfer_init): Likewise. (next_record_r): Likewise. (next_record_w): Likewise. * io/unit.c (update_position): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180702 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/unix.h')
-rw-r--r--libgfortran/io/unix.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h
index 08c83e474cf..52f3e0c8111 100644
--- a/libgfortran/io/unix.h
+++ b/libgfortran/io/unix.h
@@ -35,6 +35,7 @@ struct stream
ssize_t (*write) (struct stream *, const void *, ssize_t);
gfc_offset (*seek) (struct stream *, gfc_offset, int);
gfc_offset (*tell) (struct stream *);
+ gfc_offset (*size) (struct stream *);
/* Avoid keyword truncate due to AIX namespace collision. */
int (*trunc) (struct stream *, gfc_offset);
int (*flush) (struct stream *);
@@ -67,6 +68,12 @@ stell (stream * s)
return s->tell (s);
}
+static inline gfc_offset
+ssize (stream * s)
+{
+ return s->size (s);
+}
+
static inline int
struncate (stream * s, gfc_offset length)
{
@@ -155,9 +162,6 @@ internal_proto(inquire_write);
extern const char *inquire_readwrite (const char *, int);
internal_proto(inquire_readwrite);
-extern gfc_offset file_length (stream *);
-internal_proto(file_length);
-
extern void flush_if_preconnected (stream *);
internal_proto(flush_if_preconnected);