Use gfc_charlen_type instead of int for string lenghts

Message ID 20181006182135.30108-1-blomqvist.janne@gmail.com
State New
Headers show
Series
  • Use gfc_charlen_type instead of int for string lenghts
Related show

Commit Message

Janne Blomqvist Oct. 6, 2018, 6:21 p.m.
This patch cleans up a few places where I noticed the code was still
using int instead gfc_charlen_type for string lengths.  Regtested on
x86_64-pc-linux-gnu, committed as obvious.

libgfortran/ChangeLog:

2018-10-06  Janne Blomqvist  <jb@gcc.gnu.org>

	* io/unix.c (compare_file_filename): Use gfc_charlen_type instead
	of int for string length.
	(inquire_sequential): Likewise.
	(inquire_direct): Likewise.
	(inquire_formatted): Likewise.
	(inquire_unformatted): Likewise.
	(inquire_access): Likewise.
	(inquire_read): Likewise.
	(inquire_write): Likewise.
	(inquire_readwrite): Likewise.
	* io/unix.h (compare_file_filename): Likewise.
	(inquire_sequential): Likewise.
	(inquire_direct): Likewise.
	(inquire_formatted): Likewise.
	(inquire_unformatted): Likewise.
	(inquire_read): Likewise.
	(inquire_write): Likewise.
	(inquire_readwrite): Likewise.
---
 libgfortran/io/unix.c | 18 +++++++++---------
 libgfortran/io/unix.h | 16 ++++++++--------
 2 files changed, 17 insertions(+), 17 deletions(-)

-- 
2.17.1

Patch

diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index ad2577c44a9..35504094e7d 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1622,7 +1622,7 @@  error_stream (void)
    filename. */
 
 int
-compare_file_filename (gfc_unit *u, const char *name, int len)
+compare_file_filename (gfc_unit *u, const char *name, gfc_charlen_type len)
 {
   struct stat st;
   int ret;
@@ -1918,7 +1918,7 @@  static const char yes[] = "YES", no[] = "NO", unknown[] = "UNKNOWN";
    string. */
 
 const char *
-inquire_sequential (const char *string, int len)
+inquire_sequential (const char *string, gfc_charlen_type len)
 {
   struct stat statbuf;
 
@@ -1947,7 +1947,7 @@  inquire_sequential (const char *string, int len)
    suitable for direct access.  Returns a C-style string. */
 
 const char *
-inquire_direct (const char *string, int len)
+inquire_direct (const char *string, gfc_charlen_type len)
 {
   struct stat statbuf;
 
@@ -1976,7 +1976,7 @@  inquire_direct (const char *string, int len)
    is suitable for formatted form.  Returns a C-style string. */
 
 const char *
-inquire_formatted (const char *string, int len)
+inquire_formatted (const char *string, gfc_charlen_type len)
 {
   struct stat statbuf;
 
@@ -2006,7 +2006,7 @@  inquire_formatted (const char *string, int len)
    is suitable for unformatted form.  Returns a C-style string. */
 
 const char *
-inquire_unformatted (const char *string, int len)
+inquire_unformatted (const char *string, gfc_charlen_type len)
 {
   return inquire_formatted (string, len);
 }
@@ -2016,7 +2016,7 @@  inquire_unformatted (const char *string, int len)
    suitable for access. */
 
 static const char *
-inquire_access (const char *string, int len, int mode)
+inquire_access (const char *string, gfc_charlen_type len, int mode)
 {
   if (string == NULL)
     return no;
@@ -2034,7 +2034,7 @@  inquire_access (const char *string, int len, int mode)
    suitable for READ access. */
 
 const char *
-inquire_read (const char *string, int len)
+inquire_read (const char *string, gfc_charlen_type len)
 {
   return inquire_access (string, len, R_OK);
 }
@@ -2044,7 +2044,7 @@  inquire_read (const char *string, int len)
    suitable for READ access. */
 
 const char *
-inquire_write (const char *string, int len)
+inquire_write (const char *string, gfc_charlen_type len)
 {
   return inquire_access (string, len, W_OK);
 }
@@ -2054,7 +2054,7 @@  inquire_write (const char *string, int len)
    suitable for read and write access. */
 
 const char *
-inquire_readwrite (const char *string, int len)
+inquire_readwrite (const char *string, gfc_charlen_type len)
 {
   return inquire_access (string, len, R_OK | W_OK);
 }
diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h
index 9ad6dfa3205..133e3e1c3ed 100644
--- a/libgfortran/io/unix.h
+++ b/libgfortran/io/unix.h
@@ -135,7 +135,7 @@  internal_proto(output_stream);
 extern stream *error_stream (void);
 internal_proto(error_stream);
 
-extern int compare_file_filename (gfc_unit *, const char *, int);
+extern int compare_file_filename (gfc_unit *, const char *, gfc_charlen_type);
 internal_proto(compare_file_filename);
 
 extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
@@ -150,25 +150,25 @@  internal_proto(file_exists);
 extern GFC_IO_INT file_size (const char *file, gfc_charlen_type file_len);
 internal_proto(file_size);
 
-extern const char *inquire_sequential (const char *, int);
+extern const char *inquire_sequential (const char *, gfc_charlen_type);
 internal_proto(inquire_sequential);
 
-extern const char *inquire_direct (const char *, int);
+extern const char *inquire_direct (const char *, gfc_charlen_type);
 internal_proto(inquire_direct);
 
-extern const char *inquire_formatted (const char *, int);
+extern const char *inquire_formatted (const char *, gfc_charlen_type);
 internal_proto(inquire_formatted);
 
-extern const char *inquire_unformatted (const char *, int);
+extern const char *inquire_unformatted (const char *, gfc_charlen_type);
 internal_proto(inquire_unformatted);
 
-extern const char *inquire_read (const char *, int);
+extern const char *inquire_read (const char *, gfc_charlen_type);
 internal_proto(inquire_read);
 
-extern const char *inquire_write (const char *, int);
+extern const char *inquire_write (const char *, gfc_charlen_type);
 internal_proto(inquire_write);
 
-extern const char *inquire_readwrite (const char *, int);
+extern const char *inquire_readwrite (const char *, gfc_charlen_type);
 internal_proto(inquire_readwrite);
 
 extern void flush_if_preconnected (stream *);