aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/misc.c')
-rw-r--r--gcc/fortran/misc.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index dbf27e2..bdc515c 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -1,6 +1,6 @@
/* Miscellaneous stuff that doesn't fit anywhere else.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
- Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of GCC.
@@ -20,12 +20,10 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
-
#include "config.h"
#include "system.h"
#include "gfortran.h"
-
/* Get a block of memory. Many callers assume that the memory we
return is zeroed. */
@@ -54,7 +52,6 @@ gfc_getmem (size_t n)
void
gfc_free (void *p)
{
-
if (p != NULL)
free (p);
}
@@ -63,10 +60,10 @@ gfc_free (void *p)
#undef temp
-/* Get terminal width */
+/* Get terminal width. */
int
-gfc_terminal_width(void)
+gfc_terminal_width (void)
{
return 80;
}
@@ -75,9 +72,8 @@ gfc_terminal_width(void)
/* Initialize a typespec to unknown. */
void
-gfc_clear_ts (gfc_typespec * ts)
+gfc_clear_ts (gfc_typespec *ts)
{
-
ts->type = BT_UNKNOWN;
ts->kind = 0;
ts->derived = NULL;
@@ -154,9 +150,9 @@ gfc_basic_typename (bt type)
the argument list of a single statement. */
const char *
-gfc_typename (gfc_typespec * ts)
+gfc_typename (gfc_typespec *ts)
{
- static char buffer1[60], buffer2[60];
+ static char buffer1[60], buffer2[60]; /* FIXME: Buffer overflow. */
static int flag = 0;
char *buffer;
@@ -204,9 +200,8 @@ gfc_typename (gfc_typespec * ts)
returning a pointer to the string. */
const char *
-gfc_code2string (const mstring * m, int code)
+gfc_code2string (const mstring *m, int code)
{
-
while (m->string != NULL)
{
if (m->tag == code)
@@ -220,13 +215,11 @@ gfc_code2string (const mstring * m, int code)
/* Given an mstring array and a string, returns the value of the tag
- field. Returns the final tag if no matches to the string are
- found. */
+ field. Returns the final tag if no matches to the string are found. */
int
-gfc_string2code (const mstring * m, const char *string)
+gfc_string2code (const mstring *m, const char *string)
{
-
for (; m->string != NULL; m++)
if (strcmp (m->string, string) == 0)
return m->tag;
@@ -237,10 +230,10 @@ gfc_string2code (const mstring * m, const char *string)
/* Convert an intent code to a string. */
/* TODO: move to gfortran.h as define. */
+
const char *
gfc_intent_string (sym_intent i)
{
-
return gfc_code2string (intents, i);
}
@@ -265,7 +258,6 @@ gfc_init_1 (void)
void
gfc_init_2 (void)
{
-
gfc_symbol_init_2 ();
gfc_module_init_2 ();
}
@@ -289,7 +281,6 @@ gfc_done_1 (void)
void
gfc_done_2 (void)
{
-
gfc_symbol_done_2 ();
gfc_module_done_2 ();
}