diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2012-03-25 08:48:49 +0300 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2012-03-25 08:48:49 +0300 |
commit | f4471acbe3a0e4aee9aa8144898c593ff4e7b595 (patch) | |
tree | 685cb6240f35fb0058480526772367ef510d1cba /libgfortran/io/unix.c | |
parent | 0651865170b953c49b8acce8ad6de0143c00fc06 (diff) | |
download | gcc-f4471acbe3a0e4aee9aa8144898c593ff4e7b595.zip gcc-f4471acbe3a0e4aee9aa8144898c593ff4e7b595.tar.gz gcc-f4471acbe3a0e4aee9aa8144898c593ff4e7b595.tar.bz2 |
Use calloc instead of malloc and memset.
2012-03-25 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/memory.c (xcalloc): New function.
* libgfortran.h (xcalloc): New prototype.
* io/list_read.c (push_char): Use xcalloc instead of get_mem and
memset.
(l_push_char): Likewise.
* io/unit.c (insert_unit): Likewise.
(get_internal_unit): Likewise.
* io/unix.c (open_internal): Likewise.
(open_internal4): Likewise.
(fd_to_stream): Likewise.
From-SVN: r185773
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r-- | libgfortran/io/unix.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 978c3ff..31fa005 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1,5 +1,5 @@ /* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011 + 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught F2003 I/O support contributed by Jerry DeLisle @@ -919,13 +919,11 @@ open_internal (char *base, int length, gfc_offset offset) { unix_stream *s; - s = get_mem (sizeof (unix_stream)); - memset (s, '\0', sizeof (unix_stream)); + s = xcalloc (1, sizeof (unix_stream)); s->buffer = base; s->buffer_offset = offset; - s->logical_offset = 0; s->active = s->file_length = length; s->st.vptr = &mem_vtable; @@ -941,13 +939,11 @@ open_internal4 (char *base, int length, gfc_offset offset) { unix_stream *s; - s = get_mem (sizeof (unix_stream)); - memset (s, '\0', sizeof (unix_stream)); + s = xcalloc (1, sizeof (unix_stream)); s->buffer = base; s->buffer_offset = offset; - s->logical_offset = 0; s->active = s->file_length = length; s->st.vptr = &mem4_vtable; @@ -965,13 +961,9 @@ fd_to_stream (int fd) struct stat statbuf; unix_stream *s; - s = get_mem (sizeof (unix_stream)); - memset (s, '\0', sizeof (unix_stream)); + s = xcalloc (1, sizeof (unix_stream)); s->fd = fd; - s->buffer_offset = 0; - s->physical_offset = 0; - s->logical_offset = 0; /* Get the current length of the file. */ |