diff options
author | Tobias Schlüter <tobi@gcc.gnu.org> | 2007-03-30 00:57:23 +0200 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2007-03-30 00:57:23 +0200 |
commit | b6e2128e2874ef25a1aa1353e96411cca636b5d1 (patch) | |
tree | a5077074ab3565617c5fe0636b407eacfbfe02de | |
parent | 39e6a3779735a3e18895316ecb9280dd9009ff1c (diff) | |
download | gcc-b6e2128e2874ef25a1aa1353e96411cca636b5d1.zip gcc-b6e2128e2874ef25a1aa1353e96411cca636b5d1.tar.gz gcc-b6e2128e2874ef25a1aa1353e96411cca636b5d1.tar.bz2 |
intrinsic.c (conv_name): Let gfc_get_string handle the format.
* intrinsic.c (conv_name): Let gfc_get_string handle the format.
(find_conv): Compare pointers instead of calling strcmp.
(find_sym): Likewise, but ensure that the compared pointer is in
the global string table.
From-SVN: r123346
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/intrinsic.c | 18 |
2 files changed, 17 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index eecbcad..69364bc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2007-03-29 Tobias Schlüter <tobi@gcc.gnu.org> + + * intrinsic.c (conv_name): Let gfc_get_string handle the format. + (find_conv): Compare pointers instead of calling strcmp. + (find_sym): Likewise, but ensure that the compared pointer is in + the global string table. + 2007-03-28 Tobias Schlüter <tobi@gcc.gnu.org> * gfc-internals.texi: Fix output filename. Merge type index into diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 5db319a..7990988 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -120,12 +120,9 @@ gfc_get_intrinsic_sub_symbol (const char *name) static const char * conv_name (gfc_typespec *from, gfc_typespec *to) { - static char name[30]; - - sprintf (name, "__convert_%c%d_%c%d", gfc_type_letter (from->type), - from->kind, gfc_type_letter (to->type), to->kind); - - return gfc_get_string (name); + return gfc_get_string ("__convert_%c%d_%c%d", + gfc_type_letter (from->type), from->kind, + gfc_type_letter (to->type), to->kind); } @@ -144,7 +141,7 @@ find_conv (gfc_typespec *from, gfc_typespec *to) sym = conversion; for (i = 0; i < nconv; i++, sym++) - if (strcmp (target, sym->name) == 0) + if (target == sym->name) return sym; return NULL; @@ -701,9 +698,14 @@ add_sym_5s (const char *name, int elemental, bt type, int kind, int standard, static gfc_intrinsic_sym * find_sym (gfc_intrinsic_sym *start, int n, const char *name) { + /* name may be a user-supplied string, so we must first make sure + that we're comparing against a pointer into the global string + table. */ + const char *p = gfc_get_string (name); + while (n > 0) { - if (strcmp (name, start->name) == 0) + if (p == start->name) return start; start++; |