Commit f29876bb by Jerry DeLisle

close.c: Fix white space in pointer declarations and comment formats where applicable.

2017-04-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* close.c: Fix white space in pointer declarations and comment
	formats where applicable.
	* fbuf.c: Likewise.
	* fbuf.h: Likewise.
	* format.c: Likewise.
	* inquire.c: Likewise.
	* intrinsics.c: Likewise.
	* list_read.c: Likewise.
	* lock.c: Likewise.
	* open.c: Likewise.
	* read.c: Likewise.
	* transfer.c: Likewise.
	* unit.c: Likewise.
	* unix.c: Likewise.
	* unix.h: Likewise.
	* write.c: Likewise.

From-SVN: r246842
parent 276ebde7
2017-04-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* close.c: Fix white space in pointer declarations and comment
formats where applicable.
* fbuf.c: Likewise.
* fbuf.h: Likewise.
* format.c: Likewise.
* inquire.c: Likewise.
* intrinsics.c: Likewise.
* list_read.c: Likewise.
* lock.c: Likewise.
* open.c: Likewise.
* read.c: Likewise.
* transfer.c: Likewise.
* unit.c: Likewise.
* unix.c: Likewise.
* unix.h: Likewise.
* write.c: Likewise.
2017-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2017-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/78670 PR libgfortran/78670
......
...@@ -46,7 +46,7 @@ st_close (st_parameter_close *clp) ...@@ -46,7 +46,7 @@ st_close (st_parameter_close *clp)
close_status status; close_status status;
gfc_unit *u; gfc_unit *u;
#if !HAVE_UNLINK_OPEN_FILE #if !HAVE_UNLINK_OPEN_FILE
char * path; char *path;
path = NULL; path = NULL;
#endif #endif
......
...@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
void void
fbuf_init (gfc_unit * u, int len) fbuf_init (gfc_unit *u, int len)
{ {
if (len == 0) if (len == 0)
len = 512; /* Default size. */ len = 512; /* Default size. */
...@@ -46,7 +46,7 @@ fbuf_init (gfc_unit * u, int len) ...@@ -46,7 +46,7 @@ fbuf_init (gfc_unit * u, int len)
void void
fbuf_destroy (gfc_unit * u) fbuf_destroy (gfc_unit *u)
{ {
if (u->fbuf == NULL) if (u->fbuf == NULL)
return; return;
...@@ -58,7 +58,7 @@ fbuf_destroy (gfc_unit * u) ...@@ -58,7 +58,7 @@ fbuf_destroy (gfc_unit * u)
static void static void
#ifdef FBUF_DEBUG #ifdef FBUF_DEBUG
fbuf_debug (gfc_unit * u, const char * format, ...) fbuf_debug (gfc_unit *u, const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
...@@ -73,8 +73,8 @@ fbuf_debug (gfc_unit * u, const char * format, ...) ...@@ -73,8 +73,8 @@ fbuf_debug (gfc_unit * u, const char * format, ...)
fprintf (stderr, "''\n"); fprintf (stderr, "''\n");
} }
#else #else
fbuf_debug (gfc_unit * u __attribute__ ((unused)), fbuf_debug (gfc_unit *u __attribute__ ((unused)),
const char * format __attribute__ ((unused)), const char *format __attribute__ ((unused)),
...) {} ...) {}
#endif #endif
...@@ -85,7 +85,7 @@ fbuf_debug (gfc_unit * u __attribute__ ((unused)), ...@@ -85,7 +85,7 @@ fbuf_debug (gfc_unit * u __attribute__ ((unused)),
modified. */ modified. */
int int
fbuf_reset (gfc_unit * u) fbuf_reset (gfc_unit *u)
{ {
int seekval = 0; int seekval = 0;
...@@ -111,7 +111,7 @@ fbuf_reset (gfc_unit * u) ...@@ -111,7 +111,7 @@ fbuf_reset (gfc_unit * u)
reallocating if necessary. */ reallocating if necessary. */
char * char *
fbuf_alloc (gfc_unit * u, int len) fbuf_alloc (gfc_unit *u, int len)
{ {
int newlen; int newlen;
char *dest; char *dest;
...@@ -119,7 +119,7 @@ fbuf_alloc (gfc_unit * u, int len) ...@@ -119,7 +119,7 @@ fbuf_alloc (gfc_unit * u, int len)
if (u->fbuf->pos + len > u->fbuf->len) if (u->fbuf->pos + len > u->fbuf->len)
{ {
/* Round up to nearest multiple of the current buffer length. */ /* Round up to nearest multiple of the current buffer length. */
newlen = ((u->fbuf->pos + len) / u->fbuf->len + 1) * u->fbuf->len; newlen = ((u->fbuf->pos + len) / u->fbuf->len + 1) *u->fbuf->len;
u->fbuf->buf = xrealloc (u->fbuf->buf, newlen); u->fbuf->buf = xrealloc (u->fbuf->buf, newlen);
u->fbuf->len = newlen; u->fbuf->len = newlen;
} }
...@@ -136,7 +136,7 @@ fbuf_alloc (gfc_unit * u, int len) ...@@ -136,7 +136,7 @@ fbuf_alloc (gfc_unit * u, int len)
mode. Return value is 0 for success, -1 on failure. */ mode. Return value is 0 for success, -1 on failure. */
int int
fbuf_flush (gfc_unit * u, unit_mode mode) fbuf_flush (gfc_unit *u, unit_mode mode)
{ {
int nwritten; int nwritten;
...@@ -175,7 +175,7 @@ fbuf_flush (gfc_unit * u, unit_mode mode) ...@@ -175,7 +175,7 @@ fbuf_flush (gfc_unit * u, unit_mode mode)
Return value is 0 for success, -1 on failure. */ Return value is 0 for success, -1 on failure. */
int int
fbuf_flush_list (gfc_unit * u, unit_mode mode) fbuf_flush_list (gfc_unit *u, unit_mode mode)
{ {
int nwritten; int nwritten;
...@@ -207,7 +207,7 @@ fbuf_flush_list (gfc_unit * u, unit_mode mode) ...@@ -207,7 +207,7 @@ fbuf_flush_list (gfc_unit * u, unit_mode mode)
int int
fbuf_seek (gfc_unit * u, int off, int whence) fbuf_seek (gfc_unit *u, int off, int whence)
{ {
if (!u->fbuf) if (!u->fbuf)
return -1; return -1;
...@@ -248,7 +248,7 @@ fbuf_seek (gfc_unit * u, int off, int whence) ...@@ -248,7 +248,7 @@ fbuf_seek (gfc_unit * u, int off, int whence)
of bytes actually processed. */ of bytes actually processed. */
char * char *
fbuf_read (gfc_unit * u, int * len) fbuf_read (gfc_unit *u, int *len)
{ {
char *ptr; char *ptr;
int oldact, oldpos; int oldact, oldpos;
...@@ -279,7 +279,7 @@ fbuf_read (gfc_unit * u, int * len) ...@@ -279,7 +279,7 @@ fbuf_read (gfc_unit * u, int * len)
reading. Never call this function directly. */ reading. Never call this function directly. */
int int
fbuf_getc_refill (gfc_unit * u) fbuf_getc_refill (gfc_unit *u)
{ {
int nread; int nread;
char *p; char *p;
......
...@@ -53,7 +53,7 @@ internal_proto(fbuf_destroy); ...@@ -53,7 +53,7 @@ internal_proto(fbuf_destroy);
extern int fbuf_reset (gfc_unit *); extern int fbuf_reset (gfc_unit *);
internal_proto(fbuf_reset); internal_proto(fbuf_reset);
extern char * fbuf_alloc (gfc_unit *, int); extern char *fbuf_alloc (gfc_unit *, int);
internal_proto(fbuf_alloc); internal_proto(fbuf_alloc);
extern int fbuf_flush (gfc_unit *, unit_mode); extern int fbuf_flush (gfc_unit *, unit_mode);
...@@ -65,7 +65,7 @@ internal_proto(fbuf_flush_list); ...@@ -65,7 +65,7 @@ internal_proto(fbuf_flush_list);
extern int fbuf_seek (gfc_unit *, int, int); extern int fbuf_seek (gfc_unit *, int, int);
internal_proto(fbuf_seek); internal_proto(fbuf_seek);
extern char * fbuf_read (gfc_unit *, int *); extern char *fbuf_read (gfc_unit *, int *);
internal_proto(fbuf_read); internal_proto(fbuf_read);
/* Never call this function, only use fbuf_getc(). */ /* Never call this function, only use fbuf_getc(). */
...@@ -73,7 +73,7 @@ extern int fbuf_getc_refill (gfc_unit *); ...@@ -73,7 +73,7 @@ extern int fbuf_getc_refill (gfc_unit *);
internal_proto(fbuf_getc_refill); internal_proto(fbuf_getc_refill);
static inline int static inline int
fbuf_getc (gfc_unit * u) fbuf_getc (gfc_unit *u)
{ {
if (u->fbuf->pos < u->fbuf->act) if (u->fbuf->pos < u->fbuf->act)
return (unsigned char) u->fbuf->buf[u->fbuf->pos++]; return (unsigned char) u->fbuf->buf[u->fbuf->pos++];
...@@ -81,7 +81,7 @@ fbuf_getc (gfc_unit * u) ...@@ -81,7 +81,7 @@ fbuf_getc (gfc_unit * u)
} }
static inline char * static inline char *
fbuf_getptr (gfc_unit * u) fbuf_getptr (gfc_unit *u)
{ {
return (char*) (u->fbuf->buf + u->fbuf->pos); return (char*) (u->fbuf->buf + u->fbuf->pos);
} }
......
...@@ -25,7 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -25,7 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* format.c-- parse a FORMAT string into a binary format suitable for /* format.c-- parse a FORMAT string into a binary format suitable for
* interpretation during I/O statements */ interpretation during I/O statements. */
#include "io.h" #include "io.h"
#include "format.h" #include "format.h"
...@@ -179,8 +179,8 @@ find_parsed_format (st_parameter_dt *dtp) ...@@ -179,8 +179,8 @@ find_parsed_format (st_parameter_dt *dtp)
/* next_char()-- Return the next character in the format string. /* next_char()-- Return the next character in the format string.
* Returns -1 when the string is done. If the literal flag is set, Returns -1 when the string is done. If the literal flag is set,
* spaces are significant, otherwise they are not. */ spaces are significant, otherwise they are not. */
static int static int
next_char (format_data *fmt, int literal) next_char (format_data *fmt, int literal)
...@@ -209,8 +209,8 @@ next_char (format_data *fmt, int literal) ...@@ -209,8 +209,8 @@ next_char (format_data *fmt, int literal)
/* get_fnode()-- Allocate a new format node, inserting it into the /* get_fnode()-- Allocate a new format node, inserting it into the
* current singly linked list. These are initially allocated from the current singly linked list. These are initially allocated from the
* static buffer. */ static buffer. */
static fnode * static fnode *
get_fnode (format_data *fmt, fnode **head, fnode **tail, format_token t) get_fnode (format_data *fmt, fnode **head, fnode **tail, format_token t)
...@@ -286,8 +286,8 @@ free_format_data (format_data *fmt) ...@@ -286,8 +286,8 @@ free_format_data (format_data *fmt)
/* format_lex()-- Simple lexical analyzer for getting the next token /* format_lex()-- Simple lexical analyzer for getting the next token
* in a FORMAT string. We support a one-level token pushback in the in a FORMAT string. We support a one-level token pushback in the
* fmt->saved_token variable. */ fmt->saved_token variable. */
static format_token static format_token
format_lex (format_data *fmt) format_lex (format_data *fmt)
...@@ -605,8 +605,8 @@ format_lex (format_data *fmt) ...@@ -605,8 +605,8 @@ format_lex (format_data *fmt)
/* parse_format_list()-- Parse a format list. Assumes that a left /* parse_format_list()-- Parse a format list. Assumes that a left
* paren has already been seen. Returns a list representing the paren has already been seen. Returns a list representing the
* parenthesis node which contains the rest of the list. */ parenthesis node which contains the rest of the list. */
static fnode * static fnode *
parse_format_list (st_parameter_dt *dtp, bool *seen_dd) parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
...@@ -1196,13 +1196,13 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd) ...@@ -1196,13 +1196,13 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
/* format_error()-- Generate an error message for a format statement. /* format_error()-- Generate an error message for a format statement.
* If the node that gives the location of the error is NULL, the error If the node that gives the location of the error is NULL, the error
* is assumed to happen at parse time, and the current location of the is assumed to happen at parse time, and the current location of the
* parser is shown. parser is shown.
*
* We generate a message showing where the problem is. We take extra We generate a message showing where the problem is. We take extra
* care to print only the relevant part of the format if it is longer care to print only the relevant part of the format if it is longer
* than a standard 80 column display. */ than a standard 80 column display. */
void void
format_error (st_parameter_dt *dtp, const fnode *f, const char *message) format_error (st_parameter_dt *dtp, const fnode *f, const char *message)
...@@ -1254,11 +1254,11 @@ format_error (st_parameter_dt *dtp, const fnode *f, const char *message) ...@@ -1254,11 +1254,11 @@ format_error (st_parameter_dt *dtp, const fnode *f, const char *message)
/* revert()-- Do reversion of the format. Control reverts to the left /* revert()-- Do reversion of the format. Control reverts to the left
* parenthesis that matches the rightmost right parenthesis. From our parenthesis that matches the rightmost right parenthesis. From our
* tree structure, we are looking for the rightmost parenthesis node tree structure, we are looking for the rightmost parenthesis node
* at the second level, the first level always being a single at the second level, the first level always being a single
* parenthesis node. If this node doesn't exit, we use the top parenthesis node. If this node doesn't exit, we use the top
* level. */ level. */
static void static void
revert (st_parameter_dt *dtp) revert (st_parameter_dt *dtp)
...@@ -1360,12 +1360,12 @@ parse_format (st_parameter_dt *dtp) ...@@ -1360,12 +1360,12 @@ parse_format (st_parameter_dt *dtp)
/* next_format0()-- Get the next format node without worrying about /* next_format0()-- Get the next format node without worrying about
* reversion. Returns NULL when we hit the end of the list. reversion. Returns NULL when we hit the end of the list.
* Parenthesis nodes are incremented after the list has been Parenthesis nodes are incremented after the list has been
* exhausted, other nodes are incremented before they are returned. */ exhausted, other nodes are incremented before they are returned. */
static const fnode * static const fnode *
next_format0 (fnode * f) next_format0 (fnode *f)
{ {
const fnode *r; const fnode *r;
...@@ -1418,11 +1418,11 @@ next_format0 (fnode * f) ...@@ -1418,11 +1418,11 @@ next_format0 (fnode * f)
/* next_format()-- Return the next format node. If the format list /* next_format()-- Return the next format node. If the format list
* ends up being exhausted, we do reversion. Reversion is only ends up being exhausted, we do reversion. Reversion is only
* allowed if we've seen a data descriptor since the allowed if we've seen a data descriptor since the
* initialization or the last reversion. We return NULL if there initialization or the last reversion. We return NULL if there
* are no more data descriptors to return (which is an error are no more data descriptors to return (which is an error
* condition). */ condition). */
const fnode * const fnode *
next_format (st_parameter_dt *dtp) next_format (st_parameter_dt *dtp)
...@@ -1455,7 +1455,7 @@ next_format (st_parameter_dt *dtp) ...@@ -1455,7 +1455,7 @@ next_format (st_parameter_dt *dtp)
} }
/* Push the first reverted token and return a colon node in case /* Push the first reverted token and return a colon node in case
* there are no more data items. */ there are no more data items. */
fmt->saved_format = f; fmt->saved_format = f;
return &colon_node; return &colon_node;
...@@ -1475,11 +1475,11 @@ next_format (st_parameter_dt *dtp) ...@@ -1475,11 +1475,11 @@ next_format (st_parameter_dt *dtp)
/* unget_format()-- Push the given format back so that it will be /* unget_format()-- Push the given format back so that it will be
* returned on the next call to next_format() without affecting returned on the next call to next_format() without affecting
* counts. This is necessary when we've encountered a data counts. This is necessary when we've encountered a data
* descriptor, but don't know what the data item is yet. The format descriptor, but don't know what the data item is yet. The format
* node is pushed back, and we return control to the main program, node is pushed back, and we return control to the main program,
* which calls the library back with the data item (or not). */ which calls the library back with the data item (or not). */
void void
unget_format (st_parameter_dt *dtp, const fnode *f) unget_format (st_parameter_dt *dtp, const fnode *f)
......
...@@ -36,7 +36,7 @@ static const char yes[] = "YES", no[] = "NO", undefined[] = "UNDEFINED"; ...@@ -36,7 +36,7 @@ static const char yes[] = "YES", no[] = "NO", undefined[] = "UNDEFINED";
/* inquire_via_unit()-- Inquiry via unit number. The unit might not exist. */ /* inquire_via_unit()-- Inquiry via unit number. The unit might not exist. */
static void static void
inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u)
{ {
const char *p; const char *p;
GFC_INTEGER_4 cf = iqp->common.flags; GFC_INTEGER_4 cf = iqp->common.flags;
...@@ -631,7 +631,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) ...@@ -631,7 +631,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
/* inquire_via_filename()-- Inquiry via filename. This subroutine is /* inquire_via_filename()-- Inquiry via filename. This subroutine is
* only used if the filename is *not* connected to a unit number. */ only used if the filename is *not* connected to a unit number. */
static void static void
inquire_via_filename (st_parameter_inquire *iqp) inquire_via_filename (st_parameter_inquire *iqp)
......
...@@ -36,10 +36,10 @@ extern int PREFIX(fgetc) (const int *, char *, gfc_charlen_type); ...@@ -36,10 +36,10 @@ extern int PREFIX(fgetc) (const int *, char *, gfc_charlen_type);
export_proto_np(PREFIX(fgetc)); export_proto_np(PREFIX(fgetc));
int int
PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len) PREFIX(fgetc) (const int *unit, char *c, gfc_charlen_type c_len)
{ {
int ret; int ret;
gfc_unit * u = find_unit (*unit); gfc_unit *u = find_unit (*unit);
if (u == NULL) if (u == NULL)
return -1; return -1;
...@@ -70,7 +70,7 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len) ...@@ -70,7 +70,7 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
(const int *, char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \ (const int *, char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \
export_proto(fgetc_i ## kind ## _sub); \ export_proto(fgetc_i ## kind ## _sub); \
void fgetc_i ## kind ## _sub \ void fgetc_i ## kind ## _sub \
(const int * unit, char * c, GFC_INTEGER_ ## kind * st, gfc_charlen_type c_len) \ (const int *unit, char *c, GFC_INTEGER_ ## kind *st, gfc_charlen_type c_len) \
{ if (st != NULL) \ { if (st != NULL) \
*st = PREFIX(fgetc) (unit, c, c_len); \ *st = PREFIX(fgetc) (unit, c, c_len); \
else \ else \
...@@ -86,7 +86,7 @@ extern int PREFIX(fget) (char *, gfc_charlen_type); ...@@ -86,7 +86,7 @@ extern int PREFIX(fget) (char *, gfc_charlen_type);
export_proto_np(PREFIX(fget)); export_proto_np(PREFIX(fget));
int int
PREFIX(fget) (char * c, gfc_charlen_type c_len) PREFIX(fget) (char *c, gfc_charlen_type c_len)
{ {
return PREFIX(fgetc) (&five, c, c_len); return PREFIX(fgetc) (&five, c, c_len);
} }
...@@ -97,7 +97,7 @@ PREFIX(fget) (char * c, gfc_charlen_type c_len) ...@@ -97,7 +97,7 @@ PREFIX(fget) (char * c, gfc_charlen_type c_len)
(char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \ (char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \
export_proto(fget_i ## kind ## _sub); \ export_proto(fget_i ## kind ## _sub); \
void fget_i ## kind ## _sub \ void fget_i ## kind ## _sub \
(char * c, GFC_INTEGER_ ## kind * st, gfc_charlen_type c_len) \ (char *c, GFC_INTEGER_ ## kind *st, gfc_charlen_type c_len) \
{ if (st != NULL) \ { if (st != NULL) \
*st = PREFIX(fgetc) (&five, c, c_len); \ *st = PREFIX(fgetc) (&five, c, c_len); \
else \ else \
...@@ -114,11 +114,11 @@ extern int PREFIX(fputc) (const int *, char *, gfc_charlen_type); ...@@ -114,11 +114,11 @@ extern int PREFIX(fputc) (const int *, char *, gfc_charlen_type);
export_proto_np(PREFIX(fputc)); export_proto_np(PREFIX(fputc));
int int
PREFIX(fputc) (const int * unit, char * c, PREFIX(fputc) (const int *unit, char *c,
gfc_charlen_type c_len __attribute__((unused))) gfc_charlen_type c_len __attribute__((unused)))
{ {
ssize_t s; ssize_t s;
gfc_unit * u = find_unit (*unit); gfc_unit *u = find_unit (*unit);
if (u == NULL) if (u == NULL)
return -1; return -1;
...@@ -143,7 +143,7 @@ PREFIX(fputc) (const int * unit, char * c, ...@@ -143,7 +143,7 @@ PREFIX(fputc) (const int * unit, char * c,
(const int *, char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \ (const int *, char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \
export_proto(fputc_i ## kind ## _sub); \ export_proto(fputc_i ## kind ## _sub); \
void fputc_i ## kind ## _sub \ void fputc_i ## kind ## _sub \
(const int * unit, char * c, GFC_INTEGER_ ## kind * st, gfc_charlen_type c_len) \ (const int *unit, char *c, GFC_INTEGER_ ## kind *st, gfc_charlen_type c_len) \
{ if (st != NULL) \ { if (st != NULL) \
*st = PREFIX(fputc) (unit, c, c_len); \ *st = PREFIX(fputc) (unit, c, c_len); \
else \ else \
...@@ -159,7 +159,7 @@ extern int PREFIX(fput) (char *, gfc_charlen_type); ...@@ -159,7 +159,7 @@ extern int PREFIX(fput) (char *, gfc_charlen_type);
export_proto_np(PREFIX(fput)); export_proto_np(PREFIX(fput));
int int
PREFIX(fput) (char * c, gfc_charlen_type c_len) PREFIX(fput) (char *c, gfc_charlen_type c_len)
{ {
return PREFIX(fputc) (&six, c, c_len); return PREFIX(fputc) (&six, c, c_len);
} }
...@@ -170,7 +170,7 @@ PREFIX(fput) (char * c, gfc_charlen_type c_len) ...@@ -170,7 +170,7 @@ PREFIX(fput) (char * c, gfc_charlen_type c_len)
(char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \ (char *, GFC_INTEGER_ ## kind *, gfc_charlen_type); \
export_proto(fput_i ## kind ## _sub); \ export_proto(fput_i ## kind ## _sub); \
void fput_i ## kind ## _sub \ void fput_i ## kind ## _sub \
(char * c, GFC_INTEGER_ ## kind * st, gfc_charlen_type c_len) \ (char *c, GFC_INTEGER_ ## kind *st, gfc_charlen_type c_len) \
{ if (st != NULL) \ { if (st != NULL) \
*st = PREFIX(fputc) (&six, c, c_len); \ *st = PREFIX(fputc) (&six, c, c_len); \
else \ else \
...@@ -236,9 +236,9 @@ extern void fseek_sub (int *, GFC_IO_INT *, int *, int *); ...@@ -236,9 +236,9 @@ extern void fseek_sub (int *, GFC_IO_INT *, int *, int *);
export_proto(fseek_sub); export_proto(fseek_sub);
void void
fseek_sub (int * unit, GFC_IO_INT * offset, int * whence, int * status) fseek_sub (int *unit, GFC_IO_INT *offset, int *whence, int *status)
{ {
gfc_unit * u = find_unit (*unit); gfc_unit *u = find_unit (*unit);
ssize_t result = -1; ssize_t result = -1;
if (u != NULL) if (u != NULL)
...@@ -259,7 +259,7 @@ fseek_sub (int * unit, GFC_IO_INT * offset, int * whence, int * status) ...@@ -259,7 +259,7 @@ fseek_sub (int * unit, GFC_IO_INT * offset, int * whence, int * status)
static gfc_offset static gfc_offset
gf_ftell (int unit) gf_ftell (int unit)
{ {
gfc_unit * u = find_unit (unit); gfc_unit *u = find_unit (unit);
if (u == NULL) if (u == NULL)
return -1; return -1;
int pos = fbuf_reset (u); int pos = fbuf_reset (u);
...@@ -275,7 +275,7 @@ extern GFC_IO_INT PREFIX(ftell) (int *); ...@@ -275,7 +275,7 @@ extern GFC_IO_INT PREFIX(ftell) (int *);
export_proto_np(PREFIX(ftell)); export_proto_np(PREFIX(ftell));
GFC_IO_INT GFC_IO_INT
PREFIX(ftell) (int * unit) PREFIX(ftell) (int *unit)
{ {
return gf_ftell (*unit); return gf_ftell (*unit);
} }
...@@ -285,7 +285,7 @@ PREFIX(ftell) (int * unit) ...@@ -285,7 +285,7 @@ PREFIX(ftell) (int * unit)
extern void ftell_i ## kind ## _sub (int *, GFC_INTEGER_ ## kind *); \ extern void ftell_i ## kind ## _sub (int *, GFC_INTEGER_ ## kind *); \
export_proto(ftell_i ## kind ## _sub); \ export_proto(ftell_i ## kind ## _sub); \
void \ void \
ftell_i ## kind ## _sub (int * unit, GFC_INTEGER_ ## kind * offset) \ ftell_i ## kind ## _sub (int *unit, GFC_INTEGER_ ## kind *offset) \
{ \ { \
*offset = gf_ftell (*unit); \ *offset = gf_ftell (*unit); \
} }
...@@ -346,7 +346,7 @@ extern void ttynam_sub (int *, char *, gfc_charlen_type); ...@@ -346,7 +346,7 @@ extern void ttynam_sub (int *, char *, gfc_charlen_type);
export_proto(ttynam_sub); export_proto(ttynam_sub);
void void
ttynam_sub (int *unit, char * name, gfc_charlen_type name_len) ttynam_sub (int *unit, char *name, gfc_charlen_type name_len)
{ {
gfc_unit *u; gfc_unit *u;
int nlen; int nlen;
...@@ -373,7 +373,7 @@ extern void ttynam (char **, gfc_charlen_type *, int); ...@@ -373,7 +373,7 @@ extern void ttynam (char **, gfc_charlen_type *, int);
export_proto(ttynam); export_proto(ttynam);
void void
ttynam (char ** name, gfc_charlen_type * name_len, int unit) ttynam (char **name, gfc_charlen_type *name_len, int unit)
{ {
gfc_unit *u; gfc_unit *u;
......
...@@ -1506,7 +1506,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) ...@@ -1506,7 +1506,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
what it is right away. */ what it is right away. */
static void static void
read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size) read_complex (st_parameter_dt *dtp, void *dest, int kind, size_t size)
{ {
char message[MSGLEN]; char message[MSGLEN];
int c; int c;
...@@ -1615,7 +1615,7 @@ eol_4: ...@@ -1615,7 +1615,7 @@ eol_4:
/* Parse a real number with a possible repeat count. */ /* Parse a real number with a possible repeat count. */
static void static void
read_real (st_parameter_dt *dtp, void * dest, int length) read_real (st_parameter_dt *dtp, void *dest, int length)
{ {
char message[MSGLEN]; char message[MSGLEN];
int c; int c;
...@@ -2382,11 +2382,11 @@ calls: ...@@ -2382,11 +2382,11 @@ calls:
namelist_info **prev_nl, char *, size_t) namelist_info **prev_nl, char *, size_t)
calls: calls:
static void nml_untouch_nodes (st_parameter_dt *dtp) static void nml_untouch_nodes (st_parameter_dt *dtp)
static namelist_info * find_nml_node (st_parameter_dt *dtp, static namelist_info *find_nml_node (st_parameter_dt *dtp,
char * var_name) char *var_name)
static int nml_parse_qualifier(descriptor_dimension * ad, static int nml_parse_qualifier(descriptor_dimension *ad,
array_loop_spec * ls, int rank, char *) array_loop_spec *ls, int rank, char *)
static void nml_touch_nodes (namelist_info * nl) static void nml_touch_nodes (namelist_info *nl)
static int nml_read_obj (namelist_info *nl, index_type offset, static int nml_read_obj (namelist_info *nl, index_type offset,
namelist_info **prev_nl, char *, size_t, namelist_info **prev_nl, char *, size_t,
index_type clow, index_type chigh) index_type clow, index_type chigh)
...@@ -2671,9 +2671,9 @@ strcmp_extended_type (char *p, char *q) ...@@ -2671,9 +2671,9 @@ strcmp_extended_type (char *p, char *q)
static namelist_info * static namelist_info *
find_nml_node (st_parameter_dt *dtp, char * var_name) find_nml_node (st_parameter_dt *dtp, char *var_name)
{ {
namelist_info * t = dtp->u.p.ionml; namelist_info *t = dtp->u.p.ionml;
while (t != NULL) while (t != NULL)
{ {
if (strcmp (var_name, t->var_name) == 0) if (strcmp (var_name, t->var_name) == 0)
...@@ -2697,11 +2697,11 @@ find_nml_node (st_parameter_dt *dtp, char * var_name) ...@@ -2697,11 +2697,11 @@ find_nml_node (st_parameter_dt *dtp, char * var_name)
to default values */ to default values */
static void static void
nml_touch_nodes (namelist_info * nl) nml_touch_nodes (namelist_info *nl)
{ {
index_type len = strlen (nl->var_name) + 1; index_type len = strlen (nl->var_name) + 1;
int dim; int dim;
char * ext_name = xmalloc (len + 1); char *ext_name = xmalloc (len + 1);
memcpy (ext_name, nl->var_name, len-1); memcpy (ext_name, nl->var_name, len-1);
memcpy (ext_name + len - 1, "%", 2); memcpy (ext_name + len - 1, "%", 2);
for (nl = nl->next; nl; nl = nl->next) for (nl = nl->next; nl; nl = nl->next)
...@@ -2730,7 +2730,7 @@ nml_touch_nodes (namelist_info * nl) ...@@ -2730,7 +2730,7 @@ nml_touch_nodes (namelist_info * nl)
static void static void
nml_untouch_nodes (st_parameter_dt *dtp) nml_untouch_nodes (st_parameter_dt *dtp)
{ {
namelist_info * t; namelist_info *t;
for (t = dtp->u.p.ionml; t; t = t->next) for (t = dtp->u.p.ionml; t; t = t->next)
t->touched = 0; t->touched = 0;
return; return;
...@@ -2765,10 +2765,10 @@ nml_match_name (st_parameter_dt *dtp, const char *name, index_type len) ...@@ -2765,10 +2765,10 @@ nml_match_name (st_parameter_dt *dtp, const char *name, index_type len)
static void static void
nml_query (st_parameter_dt *dtp, char c) nml_query (st_parameter_dt *dtp, char c)
{ {
gfc_unit * temp_unit; gfc_unit *temp_unit;
namelist_info * nl; namelist_info *nl;
index_type len; index_type len;
char * p; char *p;
#ifdef HAVE_CRLF #ifdef HAVE_CRLF
static const index_type endlen = 2; static const index_type endlen = 2;
static const char endl[] = "\r\n"; static const char endl[] = "\r\n";
...@@ -2858,19 +2858,19 @@ query_return: ...@@ -2858,19 +2858,19 @@ query_return:
error. */ error. */
static bool static bool
nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset,
namelist_info **pprev_nl, char *nml_err_msg, namelist_info **pprev_nl, char *nml_err_msg,
size_t nml_err_msg_size, index_type clow, index_type chigh) size_t nml_err_msg_size, index_type clow, index_type chigh)
{ {
namelist_info * cmp; namelist_info *cmp;
char * obj_name; char *obj_name;
int nml_carry; int nml_carry;
int len; int len;
int dim; int dim;
index_type dlen; index_type dlen;
index_type m; index_type m;
size_t obj_name_len; size_t obj_name_len;
void * pdata; void *pdata;
/* If we have encountered a previous read error or this object has not been /* If we have encountered a previous read error or this object has not been
touched in name parsing, just return. */ touched in name parsing, just return. */
...@@ -3191,9 +3191,9 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, ...@@ -3191,9 +3191,9 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl,
char *nml_err_msg, size_t nml_err_msg_size) char *nml_err_msg, size_t nml_err_msg_size)
{ {
int c; int c;
namelist_info * nl; namelist_info *nl;
namelist_info * first_nl = NULL; namelist_info *first_nl = NULL;
namelist_info * root_nl = NULL; namelist_info *root_nl = NULL;
int dim, parsed_rank; int dim, parsed_rank;
int component_flag, qualifier_flag; int component_flag, qualifier_flag;
index_type clow, chigh; index_type clow, chigh;
......
...@@ -41,7 +41,7 @@ library_start (st_parameter_common *cmp) ...@@ -41,7 +41,7 @@ library_start (st_parameter_common *cmp)
void void
free_ionml (st_parameter_dt *dtp) free_ionml (st_parameter_dt *dtp)
{ {
namelist_info * t1, *t2; namelist_info *t1, *t2;
/* Delete the namelist, if it exists. */ /* Delete the namelist, if it exists. */
......
...@@ -168,7 +168,7 @@ static const st_option async_opt[] = ...@@ -168,7 +168,7 @@ static const st_option async_opt[] =
AT_ENDFILE. */ AT_ENDFILE. */
static void static void
test_endfile (gfc_unit * u) test_endfile (gfc_unit *u)
{ {
if (u->endfile == NO_ENDFILE) if (u->endfile == NO_ENDFILE)
{ {
...@@ -183,7 +183,7 @@ test_endfile (gfc_unit * u) ...@@ -183,7 +183,7 @@ test_endfile (gfc_unit * u)
changed. */ changed. */
static void static void
edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) edit_modes (st_parameter_open *opp, gfc_unit *u, unit_flags *flags)
{ {
/* Complain about attempts to change the unchangeable. */ /* Complain about attempts to change the unchangeable. */
...@@ -329,7 +329,7 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) ...@@ -329,7 +329,7 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
/* Open an unused unit. */ /* Open an unused unit. */
gfc_unit * gfc_unit *
new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags *flags)
{ {
gfc_unit *u2; gfc_unit *u2;
stream *s; stream *s;
...@@ -671,7 +671,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) ...@@ -671,7 +671,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
modes or closing what is there now and opening the new file. */ modes or closing what is there now and opening the new file. */
static void static void
already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) already_open (st_parameter_open *opp, gfc_unit *u, unit_flags *flags)
{ {
if ((opp->common.flags & IOPARM_OPEN_HAS_FILE) == 0) if ((opp->common.flags & IOPARM_OPEN_HAS_FILE) == 0)
{ {
......
...@@ -565,7 +565,7 @@ read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length) ...@@ -565,7 +565,7 @@ read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length)
} }
/* eat_leading_spaces()-- Given a character pointer and a width, /* eat_leading_spaces()-- Given a character pointer and a width,
* ignore the leading spaces. */ ignore the leading spaces. */
static char * static char *
eat_leading_spaces (int *width, char *p) eat_leading_spaces (int *width, char *p)
...@@ -617,7 +617,7 @@ next_char (st_parameter_dt *dtp, char **p, int *w) ...@@ -617,7 +617,7 @@ next_char (st_parameter_dt *dtp, char **p, int *w)
/* read_decimal()-- Read a decimal integer value. The values here are /* read_decimal()-- Read a decimal integer value. The values here are
* signed values. */ signed values. */
void void
read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
...@@ -722,9 +722,9 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length) ...@@ -722,9 +722,9 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
/* read_radix()-- This function reads values for non-decimal radixes. /* read_radix()-- This function reads values for non-decimal radixes.
* The difference here is that we treat the values here as unsigned The difference here is that we treat the values here as unsigned
* values for the purposes of overflow. If minus sign is present and values for the purposes of overflow. If minus sign is present and
* the top bit is set, the value will be incorrect. */ the top bit is set, the value will be incorrect. */
void void
read_radix (st_parameter_dt *dtp, const fnode *f, char *dest, int length, read_radix (st_parameter_dt *dtp, const fnode *f, char *dest, int length,
...@@ -1227,7 +1227,7 @@ bad_float: ...@@ -1227,7 +1227,7 @@ bad_float:
/* read_x()-- Deal with the X/TR descriptor. We just read some data /* read_x()-- Deal with the X/TR descriptor. We just read some data
* and never look at it. */ and never look at it. */
void void
read_x (st_parameter_dt *dtp, int n) read_x (st_parameter_dt *dtp, int n)
......
...@@ -223,7 +223,7 @@ current_mode (st_parameter_dt *dtp) ...@@ -223,7 +223,7 @@ current_mode (st_parameter_dt *dtp)
/* Read sequential file - internal unit */ /* Read sequential file - internal unit */
static char * static char *
read_sf_internal (st_parameter_dt *dtp, int * length) read_sf_internal (st_parameter_dt *dtp, int *length)
{ {
static char *empty_string[0]; static char *empty_string[0];
char *base = NULL; char *base = NULL;
...@@ -303,7 +303,7 @@ read_sf_internal (st_parameter_dt *dtp, int * length) ...@@ -303,7 +303,7 @@ read_sf_internal (st_parameter_dt *dtp, int * length)
/* Read sequential file - external unit */ /* Read sequential file - external unit */
static char * static char *
read_sf (st_parameter_dt *dtp, int * length) read_sf (st_parameter_dt *dtp, int *length)
{ {
static char *empty_string[0]; static char *empty_string[0];
int q, q2; int q, q2;
...@@ -445,7 +445,7 @@ read_sf (st_parameter_dt *dtp, int * length) ...@@ -445,7 +445,7 @@ read_sf (st_parameter_dt *dtp, int * length)
short reads. */ short reads. */
void * void *
read_block_form (st_parameter_dt *dtp, int * nbytes) read_block_form (st_parameter_dt *dtp, int *nbytes)
{ {
char *source; char *source;
int norig; int norig;
...@@ -527,7 +527,7 @@ read_block_form (st_parameter_dt *dtp, int * nbytes) ...@@ -527,7 +527,7 @@ read_block_form (st_parameter_dt *dtp, int * nbytes)
a character(kind=4) variable. Note: Portions of this code borrowed from a character(kind=4) variable. Note: Portions of this code borrowed from
read_sf_internal. */ read_sf_internal. */
void * void *
read_block_form4 (st_parameter_dt *dtp, int * nbytes) read_block_form4 (st_parameter_dt *dtp, int *nbytes)
{ {
static gfc_char4_t *empty_string[0]; static gfc_char4_t *empty_string[0];
gfc_char4_t *source; gfc_char4_t *source;
...@@ -3584,7 +3584,7 @@ next_record_w_unf (st_parameter_dt *dtp, int next_subrecord) ...@@ -3584,7 +3584,7 @@ next_record_w_unf (st_parameter_dt *dtp, int next_subrecord)
value is same as for POSIX write(). */ value is same as for POSIX write(). */
static ssize_t static ssize_t
sset (stream * s, int c, ssize_t nbyte) sset (stream *s, int c, ssize_t nbyte)
{ {
#define WRITE_CHUNK 256 #define WRITE_CHUNK 256
char p[WRITE_CHUNK]; char p[WRITE_CHUNK];
...@@ -3622,7 +3622,7 @@ next_record_cc (st_parameter_dt *dtp) ...@@ -3622,7 +3622,7 @@ next_record_cc (st_parameter_dt *dtp)
fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END); fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END);
if (dtp->u.p.cc.len > 0) if (dtp->u.p.cc.len > 0)
{ {
char * p = fbuf_alloc (dtp->u.p.current_unit, dtp->u.p.cc.len); char *p = fbuf_alloc (dtp->u.p.current_unit, dtp->u.p.cc.len);
if (!p) if (!p)
generate_error (&dtp->common, LIBERROR_OS, NULL); generate_error (&dtp->common, LIBERROR_OS, NULL);
...@@ -3795,7 +3795,7 @@ next_record_w (st_parameter_dt *dtp, int done) ...@@ -3795,7 +3795,7 @@ next_record_w (st_parameter_dt *dtp, int done)
fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END); fbuf_seek (dtp->u.p.current_unit, 0, SEEK_END);
if (dtp->u.p.current_unit->flags.cc != CC_NONE) if (dtp->u.p.current_unit->flags.cc != CC_NONE)
{ {
char * p = fbuf_alloc (dtp->u.p.current_unit, len); char *p = fbuf_alloc (dtp->u.p.current_unit, len);
if (!p) if (!p)
goto io_error; goto io_error;
#ifdef HAVE_CRLF #ifdef HAVE_CRLF
...@@ -4182,7 +4182,7 @@ st_wait (st_parameter_wait *wtp __attribute__((unused))) ...@@ -4182,7 +4182,7 @@ st_wait (st_parameter_wait *wtp __attribute__((unused)))
in a linked list of namelist_info types. */ in a linked list of namelist_info types. */
static void static void
set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name, set_nml_var (st_parameter_dt *dtp, void *var_addr, char *var_name,
GFC_INTEGER_4 len, gfc_charlen_type string_length, GFC_INTEGER_4 len, gfc_charlen_type string_length,
GFC_INTEGER_4 dtype, void *dtio_sub, void *vtable) GFC_INTEGER_4 dtype, void *dtio_sub, void *vtable)
{ {
...@@ -4239,7 +4239,7 @@ extern void st_set_nml_var (st_parameter_dt *dtp, void *, char *, ...@@ -4239,7 +4239,7 @@ extern void st_set_nml_var (st_parameter_dt *dtp, void *, char *,
export_proto(st_set_nml_var); export_proto(st_set_nml_var);
void void
st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name, st_set_nml_var (st_parameter_dt *dtp, void *var_addr, char *var_name,
GFC_INTEGER_4 len, gfc_charlen_type string_length, GFC_INTEGER_4 len, gfc_charlen_type string_length,
GFC_INTEGER_4 dtype) GFC_INTEGER_4 dtype)
{ {
...@@ -4257,7 +4257,7 @@ export_proto(st_set_nml_dtio_var); ...@@ -4257,7 +4257,7 @@ export_proto(st_set_nml_dtio_var);
void void
st_set_nml_dtio_var (st_parameter_dt *dtp, void * var_addr, char * var_name, st_set_nml_dtio_var (st_parameter_dt *dtp, void *var_addr, char *var_name,
GFC_INTEGER_4 len, gfc_charlen_type string_length, GFC_INTEGER_4 len, gfc_charlen_type string_length,
GFC_INTEGER_4 dtype, void *dtio_sub, void *vtable) GFC_INTEGER_4 dtype, void *dtio_sub, void *vtable)
{ {
...@@ -4276,7 +4276,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim, ...@@ -4276,7 +4276,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim,
index_type stride, index_type lbound, index_type stride, index_type lbound,
index_type ubound) index_type ubound)
{ {
namelist_info * nml; namelist_info *nml;
int n; int n;
n = (int)n_dim; n = (int)n_dim;
...@@ -4295,7 +4295,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim, ...@@ -4295,7 +4295,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim,
9.10.2 in F2003. */ 9.10.2 in F2003. */
void void
hit_eof (st_parameter_dt * dtp) hit_eof (st_parameter_dt *dtp)
{ {
dtp->u.p.current_unit->flags.position = POSITION_APPEND; dtp->u.p.current_unit->flags.position = POSITION_APPEND;
......
...@@ -141,11 +141,11 @@ __gthread_mutex_t old_locale_lock; ...@@ -141,11 +141,11 @@ __gthread_mutex_t old_locale_lock;
/* This implementation is based on Stefan Nilsson's article in the /* This implementation is based on Stefan Nilsson's article in the
* July 1997 Doctor Dobb's Journal, "Treaps in Java". */ July 1997 Doctor Dobb's Journal, "Treaps in Java". */
/* pseudo_random()-- Simple linear congruential pseudorandom number /* pseudo_random()-- Simple linear congruential pseudorandom number
* generator. The period of this generator is 44071, which is plenty generator. The period of this generator is 44071, which is plenty
* for our purposes. */ for our purposes. */
static int static int
pseudo_random (void) pseudo_random (void)
...@@ -160,7 +160,7 @@ pseudo_random (void) ...@@ -160,7 +160,7 @@ pseudo_random (void)
/* rotate_left()-- Rotate the treap left */ /* rotate_left()-- Rotate the treap left */
static gfc_unit * static gfc_unit *
rotate_left (gfc_unit * t) rotate_left (gfc_unit *t)
{ {
gfc_unit *temp; gfc_unit *temp;
...@@ -175,7 +175,7 @@ rotate_left (gfc_unit * t) ...@@ -175,7 +175,7 @@ rotate_left (gfc_unit * t)
/* rotate_right()-- Rotate the treap right */ /* rotate_right()-- Rotate the treap right */
static gfc_unit * static gfc_unit *
rotate_right (gfc_unit * t) rotate_right (gfc_unit *t)
{ {
gfc_unit *temp; gfc_unit *temp;
...@@ -257,7 +257,7 @@ insert_unit (int n) ...@@ -257,7 +257,7 @@ insert_unit (int n)
/* destroy_unit_mutex()-- Destroy the mutex and free memory of unit. */ /* destroy_unit_mutex()-- Destroy the mutex and free memory of unit. */
static void static void
destroy_unit_mutex (gfc_unit * u) destroy_unit_mutex (gfc_unit *u)
{ {
__gthread_mutex_destroy (&u->lock); __gthread_mutex_destroy (&u->lock);
free (u); free (u);
...@@ -265,7 +265,7 @@ destroy_unit_mutex (gfc_unit * u) ...@@ -265,7 +265,7 @@ destroy_unit_mutex (gfc_unit * u)
static gfc_unit * static gfc_unit *
delete_root (gfc_unit * t) delete_root (gfc_unit *t)
{ {
gfc_unit *temp; gfc_unit *temp;
...@@ -290,12 +290,12 @@ delete_root (gfc_unit * t) ...@@ -290,12 +290,12 @@ delete_root (gfc_unit * t)
/* delete_treap()-- Delete an element from a tree. The 'old' value /* delete_treap()-- Delete an element from a tree. The 'old' value
* does not necessarily have to point to the element to be deleted, it does not necessarily have to point to the element to be deleted, it
* must just point to a treap structure with the key to be deleted. must just point to a treap structure with the key to be deleted.
* Returns the new root node of the tree. */ Returns the new root node of the tree. */
static gfc_unit * static gfc_unit *
delete_treap (gfc_unit * old, gfc_unit * t) delete_treap (gfc_unit *old, gfc_unit *t)
{ {
int c; int c;
...@@ -318,15 +318,15 @@ delete_treap (gfc_unit * old, gfc_unit * t) ...@@ -318,15 +318,15 @@ delete_treap (gfc_unit * old, gfc_unit * t)
/* delete_unit()-- Delete a unit from a tree */ /* delete_unit()-- Delete a unit from a tree */
static void static void
delete_unit (gfc_unit * old) delete_unit (gfc_unit *old)
{ {
unit_root = delete_treap (old, unit_root); unit_root = delete_treap (old, unit_root);
} }
/* get_gfc_unit()-- Given an integer, return a pointer to the unit /* get_gfc_unit()-- Given an integer, return a pointer to the unit
* structure. Returns NULL if the unit does not exist, structure. Returns NULL if the unit does not exist,
* otherwise returns a locked unit. */ otherwise returns a locked unit. */
static gfc_unit * static gfc_unit *
get_gfc_unit (int n, int do_create) get_gfc_unit (int n, int do_create)
...@@ -560,7 +560,7 @@ stash_internal_unit (st_parameter_dt *dtp) ...@@ -560,7 +560,7 @@ stash_internal_unit (st_parameter_dt *dtp)
gfc_unit * gfc_unit *
get_unit (st_parameter_dt *dtp, int do_create) get_unit (st_parameter_dt *dtp, int do_create)
{ {
gfc_unit * unit; gfc_unit *unit;
if ((dtp->common.flags & IOPARM_DT_HAS_INTERNAL_UNIT) != 0) if ((dtp->common.flags & IOPARM_DT_HAS_INTERNAL_UNIT) != 0)
{ {
...@@ -852,7 +852,7 @@ close_units (void) ...@@ -852,7 +852,7 @@ close_units (void)
ftruncate, returns 0 on success, -1 on failure. */ ftruncate, returns 0 on success, -1 on failure. */
int int
unit_truncate (gfc_unit * u, gfc_offset pos, st_parameter_common * common) unit_truncate (gfc_unit *u, gfc_offset pos, st_parameter_common *common)
{ {
int ret; int ret;
......
...@@ -212,11 +212,11 @@ unix_stream; ...@@ -212,11 +212,11 @@ unix_stream;
/* fix_fd()-- Given a file descriptor, make sure it is not one of the /* fix_fd()-- Given a file descriptor, make sure it is not one of the
* standard descriptors, returning a non-standard descriptor. If the standard descriptors, returning a non-standard descriptor. If the
* user specifies that system errors should go to standard output, user specifies that system errors should go to standard output,
* then closes standard output, we don't want the system errors to a then closes standard output, we don't want the system errors to a
* file that has been given file descriptor 1 or 0. We want to send file that has been given file descriptor 1 or 0. We want to send
* the error to the invalid descriptor. */ the error to the invalid descriptor. */
static int static int
fix_fd (int fd) fix_fd (int fd)
...@@ -260,7 +260,7 @@ fix_fd (int fd) ...@@ -260,7 +260,7 @@ fix_fd (int fd)
corresponding C stream. This is bugware for mixed C-Fortran codes corresponding C stream. This is bugware for mixed C-Fortran codes
where the C code doesn't flush I/O before returning. */ where the C code doesn't flush I/O before returning. */
void void
flush_if_preconnected (stream * s) flush_if_preconnected (stream *s)
{ {
int fd; int fd;
...@@ -287,13 +287,13 @@ than size_t as for POSIX read/write. ...@@ -287,13 +287,13 @@ than size_t as for POSIX read/write.
*********************************************************************/ *********************************************************************/
static int static int
raw_flush (unix_stream * s __attribute__ ((unused))) raw_flush (unix_stream *s __attribute__ ((unused)))
{ {
return 0; return 0;
} }
static ssize_t static ssize_t
raw_read (unix_stream * s, void * buf, ssize_t nbyte) raw_read (unix_stream *s, void *buf, ssize_t nbyte)
{ {
/* For read we can't do I/O in a loop like raw_write does, because /* For read we can't do I/O in a loop like raw_write does, because
that will break applications that wait for interactive I/O. We that will break applications that wait for interactive I/O. We
...@@ -308,7 +308,7 @@ raw_read (unix_stream * s, void * buf, ssize_t nbyte) ...@@ -308,7 +308,7 @@ raw_read (unix_stream * s, void * buf, ssize_t nbyte)
} }
static ssize_t static ssize_t
raw_write (unix_stream * s, const void * buf, ssize_t nbyte) raw_write (unix_stream *s, const void *buf, ssize_t nbyte)
{ {
ssize_t trans, bytes_left; ssize_t trans, bytes_left;
char *buf_st; char *buf_st;
...@@ -336,7 +336,7 @@ raw_write (unix_stream * s, const void * buf, ssize_t nbyte) ...@@ -336,7 +336,7 @@ raw_write (unix_stream * s, const void * buf, ssize_t nbyte)
} }
static gfc_offset static gfc_offset
raw_seek (unix_stream * s, gfc_offset offset, int whence) raw_seek (unix_stream *s, gfc_offset offset, int whence)
{ {
while (true) while (true)
{ {
...@@ -348,7 +348,7 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence) ...@@ -348,7 +348,7 @@ raw_seek (unix_stream * s, gfc_offset offset, int whence)
} }
static gfc_offset static gfc_offset
raw_tell (unix_stream * s) raw_tell (unix_stream *s)
{ {
while (true) while (true)
{ {
...@@ -360,7 +360,7 @@ raw_tell (unix_stream * s) ...@@ -360,7 +360,7 @@ raw_tell (unix_stream * s)
} }
static gfc_offset static gfc_offset
raw_size (unix_stream * s) raw_size (unix_stream *s)
{ {
struct stat statbuf; struct stat statbuf;
if (TEMP_FAILURE_RETRY (fstat (s->fd, &statbuf)) == -1) if (TEMP_FAILURE_RETRY (fstat (s->fd, &statbuf)) == -1)
...@@ -372,7 +372,7 @@ raw_size (unix_stream * s) ...@@ -372,7 +372,7 @@ raw_size (unix_stream * s)
} }
static int static int
raw_truncate (unix_stream * s, gfc_offset length) raw_truncate (unix_stream *s, gfc_offset length)
{ {
#ifdef __MINGW32__ #ifdef __MINGW32__
HANDLE h; HANDLE h;
...@@ -418,7 +418,7 @@ raw_truncate (unix_stream * s, gfc_offset length) ...@@ -418,7 +418,7 @@ raw_truncate (unix_stream * s, gfc_offset length)
} }
static int static int
raw_close (unix_stream * s) raw_close (unix_stream *s)
{ {
int retval; int retval;
...@@ -445,7 +445,7 @@ raw_close (unix_stream * s) ...@@ -445,7 +445,7 @@ raw_close (unix_stream * s)
} }
static int static int
raw_markeor (unix_stream * s __attribute__ ((unused))) raw_markeor (unix_stream *s __attribute__ ((unused)))
{ {
return 0; return 0;
} }
...@@ -463,7 +463,7 @@ static const struct stream_vtable raw_vtable = { ...@@ -463,7 +463,7 @@ static const struct stream_vtable raw_vtable = {
}; };
static int static int
raw_init (unix_stream * s) raw_init (unix_stream *s)
{ {
s->st.vptr = &raw_vtable; s->st.vptr = &raw_vtable;
...@@ -480,7 +480,7 @@ reading to writing and vice versa. ...@@ -480,7 +480,7 @@ reading to writing and vice versa.
*********************************************************************/ *********************************************************************/
static int static int
buf_flush (unix_stream * s) buf_flush (unix_stream *s)
{ {
int writelen; int writelen;
...@@ -509,7 +509,7 @@ buf_flush (unix_stream * s) ...@@ -509,7 +509,7 @@ buf_flush (unix_stream * s)
} }
static ssize_t static ssize_t
buf_read (unix_stream * s, void * buf, ssize_t nbyte) buf_read (unix_stream *s, void *buf, ssize_t nbyte)
{ {
if (s->active == 0) if (s->active == 0)
s->buffer_offset = s->logical_offset; s->buffer_offset = s->logical_offset;
...@@ -580,7 +580,7 @@ buf_read (unix_stream * s, void * buf, ssize_t nbyte) ...@@ -580,7 +580,7 @@ buf_read (unix_stream * s, void * buf, ssize_t nbyte)
} }
static ssize_t static ssize_t
buf_write (unix_stream * s, const void * buf, ssize_t nbyte) buf_write (unix_stream *s, const void *buf, ssize_t nbyte)
{ {
if (s->ndirty == 0) if (s->ndirty == 0)
s->buffer_offset = s->logical_offset; s->buffer_offset = s->logical_offset;
...@@ -640,7 +640,7 @@ buf_write (unix_stream * s, const void * buf, ssize_t nbyte) ...@@ -640,7 +640,7 @@ buf_write (unix_stream * s, const void * buf, ssize_t nbyte)
when writing sequential unformatted. */ when writing sequential unformatted. */
static int static int
buf_markeor (unix_stream * s) buf_markeor (unix_stream *s)
{ {
if (s->unbuffered || s->ndirty >= BUFFER_SIZE / 2) if (s->unbuffered || s->ndirty >= BUFFER_SIZE / 2)
return buf_flush (s); return buf_flush (s);
...@@ -648,7 +648,7 @@ buf_markeor (unix_stream * s) ...@@ -648,7 +648,7 @@ buf_markeor (unix_stream * s)
} }
static gfc_offset static gfc_offset
buf_seek (unix_stream * s, gfc_offset offset, int whence) buf_seek (unix_stream *s, gfc_offset offset, int whence)
{ {
switch (whence) switch (whence)
{ {
...@@ -673,19 +673,19 @@ buf_seek (unix_stream * s, gfc_offset offset, int whence) ...@@ -673,19 +673,19 @@ buf_seek (unix_stream * s, gfc_offset offset, int whence)
} }
static gfc_offset static gfc_offset
buf_tell (unix_stream * s) buf_tell (unix_stream *s)
{ {
return buf_seek (s, 0, SEEK_CUR); return buf_seek (s, 0, SEEK_CUR);
} }
static gfc_offset static gfc_offset
buf_size (unix_stream * s) buf_size (unix_stream *s)
{ {
return s->file_length; return s->file_length;
} }
static int static int
buf_truncate (unix_stream * s, gfc_offset length) buf_truncate (unix_stream *s, gfc_offset length)
{ {
int r; int r;
...@@ -698,7 +698,7 @@ buf_truncate (unix_stream * s, gfc_offset length) ...@@ -698,7 +698,7 @@ buf_truncate (unix_stream * s, gfc_offset length)
} }
static int static int
buf_close (unix_stream * s) buf_close (unix_stream *s)
{ {
if (buf_flush (s) != 0) if (buf_flush (s) != 0)
return -1; return -1;
...@@ -719,7 +719,7 @@ static const struct stream_vtable buf_vtable = { ...@@ -719,7 +719,7 @@ static const struct stream_vtable buf_vtable = {
}; };
static int static int
buf_init (unix_stream * s) buf_init (unix_stream *s)
{ {
s->st.vptr = &buf_vtable; s->st.vptr = &buf_vtable;
...@@ -739,9 +739,9 @@ buf_init (unix_stream * s) ...@@ -739,9 +739,9 @@ buf_init (unix_stream * s)
*********************************************************************/ *********************************************************************/
char * char *
mem_alloc_r (stream * strm, int * len) mem_alloc_r (stream *strm, int *len)
{ {
unix_stream * s = (unix_stream *) strm; unix_stream *s = (unix_stream *) strm;
gfc_offset n; gfc_offset n;
gfc_offset where = s->logical_offset; gfc_offset where = s->logical_offset;
...@@ -759,9 +759,9 @@ mem_alloc_r (stream * strm, int * len) ...@@ -759,9 +759,9 @@ mem_alloc_r (stream * strm, int * len)
char * char *
mem_alloc_r4 (stream * strm, int * len) mem_alloc_r4 (stream *strm, int *len)
{ {
unix_stream * s = (unix_stream *) strm; unix_stream *s = (unix_stream *) strm;
gfc_offset n; gfc_offset n;
gfc_offset where = s->logical_offset; gfc_offset where = s->logical_offset;
...@@ -779,9 +779,9 @@ mem_alloc_r4 (stream * strm, int * len) ...@@ -779,9 +779,9 @@ mem_alloc_r4 (stream * strm, int * len)
char * char *
mem_alloc_w (stream * strm, int * len) mem_alloc_w (stream *strm, int *len)
{ {
unix_stream * s = (unix_stream *) strm; unix_stream *s = (unix_stream *)strm;
gfc_offset m; gfc_offset m;
gfc_offset where = s->logical_offset; gfc_offset where = s->logical_offset;
...@@ -800,9 +800,9 @@ mem_alloc_w (stream * strm, int * len) ...@@ -800,9 +800,9 @@ mem_alloc_w (stream * strm, int * len)
gfc_char4_t * gfc_char4_t *
mem_alloc_w4 (stream * strm, int * len) mem_alloc_w4 (stream *strm, int *len)
{ {
unix_stream * s = (unix_stream *) strm; unix_stream *s = (unix_stream *)strm;
gfc_offset m; gfc_offset m;
gfc_offset where = s->logical_offset; gfc_offset where = s->logical_offset;
gfc_char4_t *result = (gfc_char4_t *) s->buffer; gfc_char4_t *result = (gfc_char4_t *) s->buffer;
...@@ -823,7 +823,7 @@ mem_alloc_w4 (stream * strm, int * len) ...@@ -823,7 +823,7 @@ mem_alloc_w4 (stream * strm, int * len)
/* Stream read function for character(kind=1) internal units. */ /* Stream read function for character(kind=1) internal units. */
static ssize_t static ssize_t
mem_read (stream * s, void * buf, ssize_t nbytes) mem_read (stream *s, void *buf, ssize_t nbytes)
{ {
void *p; void *p;
int nb = nbytes; int nb = nbytes;
...@@ -842,7 +842,7 @@ mem_read (stream * s, void * buf, ssize_t nbytes) ...@@ -842,7 +842,7 @@ mem_read (stream * s, void * buf, ssize_t nbytes)
/* Stream read function for chracter(kind=4) internal units. */ /* Stream read function for chracter(kind=4) internal units. */
static ssize_t static ssize_t
mem_read4 (stream * s, void * buf, ssize_t nbytes) mem_read4 (stream *s, void *buf, ssize_t nbytes)
{ {
void *p; void *p;
int nb = nbytes; int nb = nbytes;
...@@ -861,7 +861,7 @@ mem_read4 (stream * s, void * buf, ssize_t nbytes) ...@@ -861,7 +861,7 @@ mem_read4 (stream * s, void * buf, ssize_t nbytes)
/* Stream write function for character(kind=1) internal units. */ /* Stream write function for character(kind=1) internal units. */
static ssize_t static ssize_t
mem_write (stream * s, const void * buf, ssize_t nbytes) mem_write (stream *s, const void *buf, ssize_t nbytes)
{ {
void *p; void *p;
int nb = nbytes; int nb = nbytes;
...@@ -880,7 +880,7 @@ mem_write (stream * s, const void * buf, ssize_t nbytes) ...@@ -880,7 +880,7 @@ mem_write (stream * s, const void * buf, ssize_t nbytes)
/* Stream write function for character(kind=4) internal units. */ /* Stream write function for character(kind=4) internal units. */
static ssize_t static ssize_t
mem_write4 (stream * s, const void * buf, ssize_t nwords) mem_write4 (stream *s, const void *buf, ssize_t nwords)
{ {
gfc_char4_t *p; gfc_char4_t *p;
int nw = nwords; int nw = nwords;
...@@ -898,9 +898,9 @@ mem_write4 (stream * s, const void * buf, ssize_t nwords) ...@@ -898,9 +898,9 @@ mem_write4 (stream * s, const void * buf, ssize_t nwords)
static gfc_offset static gfc_offset
mem_seek (stream * strm, gfc_offset offset, int whence) mem_seek (stream *strm, gfc_offset offset, int whence)
{ {
unix_stream * s = (unix_stream *) strm; unix_stream *s = (unix_stream *)strm;
switch (whence) switch (whence)
{ {
case SEEK_SET: case SEEK_SET:
...@@ -935,14 +935,14 @@ mem_seek (stream * strm, gfc_offset offset, int whence) ...@@ -935,14 +935,14 @@ mem_seek (stream * strm, gfc_offset offset, int whence)
static gfc_offset static gfc_offset
mem_tell (stream * s) mem_tell (stream *s)
{ {
return ((unix_stream *)s)->logical_offset; return ((unix_stream *)s)->logical_offset;
} }
static int static int
mem_truncate (unix_stream * s __attribute__ ((unused)), mem_truncate (unix_stream *s __attribute__ ((unused)),
gfc_offset length __attribute__ ((unused))) gfc_offset length __attribute__ ((unused)))
{ {
return 0; return 0;
...@@ -950,14 +950,14 @@ mem_truncate (unix_stream * s __attribute__ ((unused)), ...@@ -950,14 +950,14 @@ mem_truncate (unix_stream * s __attribute__ ((unused)),
static int static int
mem_flush (unix_stream * s __attribute__ ((unused))) mem_flush (unix_stream *s __attribute__ ((unused)))
{ {
return 0; return 0;
} }
static int static int
mem_close (unix_stream * s) mem_close (unix_stream *s)
{ {
free (s); free (s);
...@@ -1034,12 +1034,12 @@ open_internal4 (char *base, int length, gfc_offset offset) ...@@ -1034,12 +1034,12 @@ open_internal4 (char *base, int length, gfc_offset offset)
s->st.vptr = &mem4_vtable; s->st.vptr = &mem4_vtable;
return (stream *) s; return (stream *)s;
} }
/* fd_to_stream()-- Given an open file descriptor, build a stream /* fd_to_stream()-- Given an open file descriptor, build a stream
* around it. */ around it. */
static stream * static stream *
fd_to_stream (int fd, bool unformatted) fd_to_stream (int fd, bool unformatted)
...@@ -1150,7 +1150,7 @@ tempfile_open (const char *tempdir, char **fname) ...@@ -1150,7 +1150,7 @@ tempfile_open (const char *tempdir, char **fname)
slash = ""; slash = "";
/* Take care that the template is longer in the mktemp() branch. */ /* Take care that the template is longer in the mktemp() branch. */
char * template = xmalloc (tempdirlen + 23); char *template = xmalloc (tempdirlen + 23);
#ifdef HAVE_MKSTEMP #ifdef HAVE_MKSTEMP
snprintf (template, tempdirlen + 23, "%s%sgfortrantmpXXXXXX", snprintf (template, tempdirlen + 23, "%s%sgfortrantmpXXXXXX",
...@@ -1220,11 +1220,11 @@ tempfile_open (const char *tempdir, char **fname) ...@@ -1220,11 +1220,11 @@ tempfile_open (const char *tempdir, char **fname)
/* tempfile()-- Generate a temporary filename for a scratch file and /* tempfile()-- Generate a temporary filename for a scratch file and
* open it. mkstemp() opens the file for reading and writing, but the open it. mkstemp() opens the file for reading and writing, but the
* library mode prevents anything that is not allowed. The descriptor library mode prevents anything that is not allowed. The descriptor
* is returned, which is -1 on error. The template is pointed to by is returned, which is -1 on error. The template is pointed to by
* opp->file, which is copied into the unit structure opp->file, which is copied into the unit structure
* and freed later. */ and freed later. */
static int static int
tempfile (st_parameter_open *opp) tempfile (st_parameter_open *opp)
...@@ -1273,9 +1273,9 @@ tempfile (st_parameter_open *opp) ...@@ -1273,9 +1273,9 @@ tempfile (st_parameter_open *opp)
/* regular_file2()-- Open a regular file. /* regular_file2()-- Open a regular file.
* Change flags->action if it is ACTION_UNSPECIFIED on entry, Change flags->action if it is ACTION_UNSPECIFIED on entry,
* unless an error occurs. unless an error occurs.
* Returns the descriptor, which is less than zero on error. */ Returns the descriptor, which is less than zero on error. */
static int static int
regular_file2 (const char *path, st_parameter_open *opp, unit_flags *flags) regular_file2 (const char *path, st_parameter_open *opp, unit_flags *flags)
...@@ -1486,8 +1486,8 @@ regular_file (st_parameter_open *opp, unit_flags *flags) ...@@ -1486,8 +1486,8 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
} }
/* open_external()-- Open an external file, unix specific version. /* open_external()-- Open an external file, unix specific version.
* Change flags->action if it is ACTION_UNSPECIFIED on entry. Change flags->action if it is ACTION_UNSPECIFIED on entry.
* Returns NULL on operating system error. */ Returns NULL on operating system error. */
stream * stream *
open_external (st_parameter_open *opp, unit_flags *flags) open_external (st_parameter_open *opp, unit_flags *flags)
...@@ -1509,7 +1509,7 @@ open_external (st_parameter_open *opp, unit_flags *flags) ...@@ -1509,7 +1509,7 @@ open_external (st_parameter_open *opp, unit_flags *flags)
else else
{ {
/* regular_file resets flags->action if it is ACTION_UNSPECIFIED and /* regular_file resets flags->action if it is ACTION_UNSPECIFIED and
* if it succeeds */ if it succeeds */
fd = regular_file (opp, flags); fd = regular_file (opp, flags);
#ifndef O_CLOEXEC #ifndef O_CLOEXEC
set_close_on_exec (fd); set_close_on_exec (fd);
...@@ -1528,7 +1528,7 @@ open_external (st_parameter_open *opp, unit_flags *flags) ...@@ -1528,7 +1528,7 @@ open_external (st_parameter_open *opp, unit_flags *flags)
/* input_stream()-- Return a stream pointer to the default input stream. /* input_stream()-- Return a stream pointer to the default input stream.
* Called on initialization. */ Called on initialization. */
stream * stream *
input_stream (void) input_stream (void)
...@@ -1538,12 +1538,12 @@ input_stream (void) ...@@ -1538,12 +1538,12 @@ input_stream (void)
/* output_stream()-- Return a stream pointer to the default output stream. /* output_stream()-- Return a stream pointer to the default output stream.
* Called on initialization. */ Called on initialization. */
stream * stream *
output_stream (void) output_stream (void)
{ {
stream * s; stream *s;
#if defined(HAVE_CRLF) && defined(HAVE_SETMODE) #if defined(HAVE_CRLF) && defined(HAVE_SETMODE)
setmode (STDOUT_FILENO, O_BINARY); setmode (STDOUT_FILENO, O_BINARY);
...@@ -1555,12 +1555,12 @@ output_stream (void) ...@@ -1555,12 +1555,12 @@ output_stream (void)
/* error_stream()-- Return a stream pointer to the default error stream. /* error_stream()-- Return a stream pointer to the default error stream.
* Called on initialization. */ Called on initialization. */
stream * stream *
error_stream (void) error_stream (void)
{ {
stream * s; stream *s;
#if defined(HAVE_CRLF) && defined(HAVE_SETMODE) #if defined(HAVE_CRLF) && defined(HAVE_SETMODE)
setmode (STDERR_FILENO, O_BINARY); setmode (STDERR_FILENO, O_BINARY);
...@@ -1572,8 +1572,8 @@ error_stream (void) ...@@ -1572,8 +1572,8 @@ error_stream (void)
/* compare_file_filename()-- Given an open stream and a fortran string /* compare_file_filename()-- Given an open stream and a fortran string
* that is a filename, figure out if the file is the same as the that is a filename, figure out if the file is the same as the
* filename. */ filename. */
int int
compare_file_filename (gfc_unit *u, const char *name, int len) compare_file_filename (gfc_unit *u, const char *name, int len)
...@@ -1591,7 +1591,7 @@ compare_file_filename (gfc_unit *u, const char *name, int len) ...@@ -1591,7 +1591,7 @@ compare_file_filename (gfc_unit *u, const char *name, int len)
char *path = fc_strdup (name, len); char *path = fc_strdup (name, len);
/* If the filename doesn't exist, then there is no match with the /* If the filename doesn't exist, then there is no match with the
* existing file. */ existing file. */
if (TEMP_FAILURE_RETRY (stat (path, &st)) < 0) if (TEMP_FAILURE_RETRY (stat (path, &st)) < 0)
{ {
...@@ -1682,7 +1682,7 @@ find_file0 (gfc_unit *u, FIND_FILE0_DECL) ...@@ -1682,7 +1682,7 @@ find_file0 (gfc_unit *u, FIND_FILE0_DECL)
/* find_file()-- Take the current filename and see if there is a unit /* find_file()-- Take the current filename and see if there is a unit
* that has the file already open. Returns a pointer to the unit if so. */ that has the file already open. Returns a pointer to the unit if so. */
gfc_unit * gfc_unit *
find_file (const char *file, gfc_charlen_type file_len) find_file (const char *file, gfc_charlen_type file_len)
...@@ -1838,7 +1838,7 @@ close_share (gfc_unit *u __attribute__ ((unused))) ...@@ -1838,7 +1838,7 @@ close_share (gfc_unit *u __attribute__ ((unused)))
/* file_exists()-- Returns nonzero if the current filename exists on /* file_exists()-- Returns nonzero if the current filename exists on
* the system */ the system */
int int
file_exists (const char *file, gfc_charlen_type file_len) file_exists (const char *file, gfc_charlen_type file_len)
...@@ -1868,8 +1868,8 @@ file_size (const char *file, gfc_charlen_type file_len) ...@@ -1868,8 +1868,8 @@ file_size (const char *file, gfc_charlen_type file_len)
static const char yes[] = "YES", no[] = "NO", unknown[] = "UNKNOWN"; static const char yes[] = "YES", no[] = "NO", unknown[] = "UNKNOWN";
/* inquire_sequential()-- Given a fortran string, determine if the /* inquire_sequential()-- Given a fortran string, determine if the
* file is suitable for sequential access. Returns a C-style file is suitable for sequential access. Returns a C-style
* string. */ string. */
const char * const char *
inquire_sequential (const char *string, int len) inquire_sequential (const char *string, int len)
...@@ -1898,7 +1898,7 @@ inquire_sequential (const char *string, int len) ...@@ -1898,7 +1898,7 @@ inquire_sequential (const char *string, int len)
/* inquire_direct()-- Given a fortran string, determine if the file is /* inquire_direct()-- Given a fortran string, determine if the file is
* suitable for direct access. Returns a C-style string. */ suitable for direct access. Returns a C-style string. */
const char * const char *
inquire_direct (const char *string, int len) inquire_direct (const char *string, int len)
...@@ -1927,7 +1927,7 @@ inquire_direct (const char *string, int len) ...@@ -1927,7 +1927,7 @@ inquire_direct (const char *string, int len)
/* inquire_formatted()-- Given a fortran string, determine if the file /* inquire_formatted()-- Given a fortran string, determine if the file
* is suitable for formatted form. Returns a C-style string. */ is suitable for formatted form. Returns a C-style string. */
const char * const char *
inquire_formatted (const char *string, int len) inquire_formatted (const char *string, int len)
...@@ -1957,7 +1957,7 @@ inquire_formatted (const char *string, int len) ...@@ -1957,7 +1957,7 @@ inquire_formatted (const char *string, int len)
/* inquire_unformatted()-- Given a fortran string, determine if the file /* inquire_unformatted()-- Given a fortran string, determine if the file
* is suitable for unformatted form. Returns a C-style string. */ is suitable for unformatted form. Returns a C-style string. */
const char * const char *
inquire_unformatted (const char *string, int len) inquire_unformatted (const char *string, int len)
...@@ -1967,7 +1967,7 @@ inquire_unformatted (const char *string, int len) ...@@ -1967,7 +1967,7 @@ inquire_unformatted (const char *string, int len)
/* inquire_access()-- Given a fortran string, determine if the file is /* inquire_access()-- Given a fortran string, determine if the file is
* suitable for access. */ suitable for access. */
static const char * static const char *
inquire_access (const char *string, int len, int mode) inquire_access (const char *string, int len, int mode)
...@@ -1985,7 +1985,7 @@ inquire_access (const char *string, int len, int mode) ...@@ -1985,7 +1985,7 @@ inquire_access (const char *string, int len, int mode)
/* inquire_read()-- Given a fortran string, determine if the file is /* inquire_read()-- Given a fortran string, determine if the file is
* suitable for READ access. */ suitable for READ access. */
const char * const char *
inquire_read (const char *string, int len) inquire_read (const char *string, int len)
...@@ -1995,7 +1995,7 @@ inquire_read (const char *string, int len) ...@@ -1995,7 +1995,7 @@ inquire_read (const char *string, int len)
/* inquire_write()-- Given a fortran string, determine if the file is /* inquire_write()-- Given a fortran string, determine if the file is
* suitable for READ access. */ suitable for READ access. */
const char * const char *
inquire_write (const char *string, int len) inquire_write (const char *string, int len)
...@@ -2005,7 +2005,7 @@ inquire_write (const char *string, int len) ...@@ -2005,7 +2005,7 @@ inquire_write (const char *string, int len)
/* inquire_readwrite()-- Given a fortran string, determine if the file is /* inquire_readwrite()-- Given a fortran string, determine if the file is
* suitable for read and write access. */ suitable for read and write access. */
const char * const char *
inquire_readwrite (const char *string, int len) inquire_readwrite (const char *string, int len)
...@@ -2022,15 +2022,15 @@ stream_isatty (stream *s) ...@@ -2022,15 +2022,15 @@ stream_isatty (stream *s)
int int
stream_ttyname (stream *s __attribute__ ((unused)), stream_ttyname (stream *s __attribute__ ((unused)),
char * buf __attribute__ ((unused)), char *buf __attribute__ ((unused)),
size_t buflen __attribute__ ((unused))) size_t buflen __attribute__ ((unused)))
{ {
#ifdef HAVE_TTYNAME_R #ifdef HAVE_TTYNAME_R
return ttyname_r (((unix_stream *) s)->fd, buf, buflen); return ttyname_r (((unix_stream *)s)->fd, buf, buflen);
#elif defined HAVE_TTYNAME #elif defined HAVE_TTYNAME
char *p; char *p;
size_t plen; size_t plen;
p = ttyname (((unix_stream *) s)->fd); p = ttyname (((unix_stream *)s)->fd);
if (!p) if (!p)
return errno; return errno;
plen = strlen (p); plen = strlen (p);
......
...@@ -48,55 +48,55 @@ struct stream ...@@ -48,55 +48,55 @@ struct stream
/* Inline functions for doing file I/O given a stream. */ /* Inline functions for doing file I/O given a stream. */
static inline ssize_t static inline ssize_t
sread (stream * s, void * buf, ssize_t nbyte) sread (stream *s, void *buf, ssize_t nbyte)
{ {
return s->vptr->read (s, buf, nbyte); return s->vptr->read (s, buf, nbyte);
} }
static inline ssize_t static inline ssize_t
swrite (stream * s, const void * buf, ssize_t nbyte) swrite (stream *s, const void *buf, ssize_t nbyte)
{ {
return s->vptr->write (s, buf, nbyte); return s->vptr->write (s, buf, nbyte);
} }
static inline gfc_offset static inline gfc_offset
sseek (stream * s, gfc_offset offset, int whence) sseek (stream *s, gfc_offset offset, int whence)
{ {
return s->vptr->seek (s, offset, whence); return s->vptr->seek (s, offset, whence);
} }
static inline gfc_offset static inline gfc_offset
stell (stream * s) stell (stream *s)
{ {
return s->vptr->tell (s); return s->vptr->tell (s);
} }
static inline gfc_offset static inline gfc_offset
ssize (stream * s) ssize (stream *s)
{ {
return s->vptr->size (s); return s->vptr->size (s);
} }
static inline int static inline int
struncate (stream * s, gfc_offset length) struncate (stream *s, gfc_offset length)
{ {
return s->vptr->trunc (s, length); return s->vptr->trunc (s, length);
} }
static inline int static inline int
sflush (stream * s) sflush (stream *s)
{ {
return s->vptr->flush (s); return s->vptr->flush (s);
} }
static inline int static inline int
sclose (stream * s) sclose (stream *s)
{ {
return s->vptr->close (s); return s->vptr->close (s);
} }
static inline int static inline int
smarkeor (stream * s) smarkeor (stream *s)
{ {
return s->vptr->markeor (s); return s->vptr->markeor (s);
} }
...@@ -114,16 +114,16 @@ internal_proto(open_internal); ...@@ -114,16 +114,16 @@ internal_proto(open_internal);
extern stream *open_internal4 (char *, int, gfc_offset); extern stream *open_internal4 (char *, int, gfc_offset);
internal_proto(open_internal4); internal_proto(open_internal4);
extern char * mem_alloc_w (stream *, int *); extern char *mem_alloc_w (stream *, int *);
internal_proto(mem_alloc_w); internal_proto(mem_alloc_w);
extern char * mem_alloc_r (stream *, int *); extern char *mem_alloc_r (stream *, int *);
internal_proto(mem_alloc_r); internal_proto(mem_alloc_r);
extern gfc_char4_t * mem_alloc_w4 (stream *, int *); extern gfc_char4_t *mem_alloc_w4 (stream *, int *);
internal_proto(mem_alloc_w4); internal_proto(mem_alloc_w4);
extern char * mem_alloc_r4 (stream *, int *); extern char *mem_alloc_r4 (stream *, int *);
internal_proto(mem_alloc_r4); internal_proto(mem_alloc_r4);
extern stream *input_stream (void); extern stream *input_stream (void);
......
...@@ -863,7 +863,7 @@ write_decimal (st_parameter_dt *dtp, const fnode *f, const char *source, ...@@ -863,7 +863,7 @@ write_decimal (st_parameter_dt *dtp, const fnode *f, const char *source,
if (unlikely (is_char4_unit (dtp))) if (unlikely (is_char4_unit (dtp)))
{ {
gfc_char4_t * p4 = (gfc_char4_t *) p; gfc_char4_t *p4 = (gfc_char4_t *)p;
if (nblank < 0) if (nblank < 0)
{ {
memset4 (p4, '*', w); memset4 (p4, '*', w);
...@@ -2040,8 +2040,8 @@ namelist_write_newline (st_parameter_dt *dtp) ...@@ -2040,8 +2040,8 @@ namelist_write_newline (st_parameter_dt *dtp)
static namelist_info * static namelist_info *
nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, nml_write_obj (st_parameter_dt *dtp, namelist_info *obj, index_type offset,
namelist_info * base, char * base_name) namelist_info *base, char *base_name)
{ {
int rep_ctr; int rep_ctr;
int num; int num;
...@@ -2053,15 +2053,15 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, ...@@ -2053,15 +2053,15 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
size_t clen; size_t clen;
index_type elem_ctr; index_type elem_ctr;
size_t obj_name_len; size_t obj_name_len;
void * p; void *p;
char cup; char cup;
char * obj_name; char *obj_name;
char * ext_name; char *ext_name;
char * q; char *q;
size_t ext_name_len; size_t ext_name_len;
char rep_buff[NML_DIGITS]; char rep_buff[NML_DIGITS];
namelist_info * cmp; namelist_info *cmp;
namelist_info * retval = obj->next; namelist_info *retval = obj->next;
size_t base_name_len; size_t base_name_len;
size_t base_var_name_len; size_t base_var_name_len;
size_t tot_len; size_t tot_len;
...@@ -2156,7 +2156,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, ...@@ -2156,7 +2156,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
if ((elem_ctr < (nelem - 1)) && if ((elem_ctr < (nelem - 1)) &&
(obj->type != BT_DERIVED) && (obj->type != BT_DERIVED) &&
!memcmp (p, (void*)(p + obj_size ), obj_size )) !memcmp (p, (void *)(p + obj_size ), obj_size ))
{ {
rep_ctr++; rep_ctr++;
} }
...@@ -2393,11 +2393,11 @@ obj_loop: ...@@ -2393,11 +2393,11 @@ obj_loop:
void void
namelist_write (st_parameter_dt *dtp) namelist_write (st_parameter_dt *dtp)
{ {
namelist_info * t1, *t2, *dummy = NULL; namelist_info *t1, *t2, *dummy = NULL;
index_type i; index_type i;
index_type dummy_offset = 0; index_type dummy_offset = 0;
char c; char c;
char * dummy_name = NULL; char *dummy_name = NULL;
/* Set the delimiter for namelist output. */ /* Set the delimiter for namelist output. */
switch (dtp->u.p.current_unit->delim_status) switch (dtp->u.p.current_unit->delim_status)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment