aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-09-10 12:19:57 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-09-10 12:19:57 +0000
commita5ad78bbcd97ca09a79505b06582824c09cdf8da (patch)
treefa6f25463795642a1ae7501b4f99317c4a40ee97 /libgfortran
parent996b42ef6a10b944fed3ace4133b165e3265d13c (diff)
downloadgcc-a5ad78bbcd97ca09a79505b06582824c09cdf8da.zip
gcc-a5ad78bbcd97ca09a79505b06582824c09cdf8da.tar.gz
gcc-a5ad78bbcd97ca09a79505b06582824c09cdf8da.tar.bz2
string.c (compare0): Remove.
* runtime/string.c (compare0): Remove. (find_option): Inline string comparison From-SVN: r164168
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/runtime/string.c23
2 files changed, 9 insertions, 19 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 913c0e5..bfd829a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * runtime/string.c (compare0): Remove.
+ (find_option): Inline string comparison
+
2010-09-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE,
diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c
index a102c3b..a372720 100644
--- a/libgfortran/runtime/string.c
+++ b/libgfortran/runtime/string.c
@@ -25,24 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <string.h>
-/* Compare a C-style string with a fortran style string in a case-insensitive
- manner. Used for decoding string options to various statements. Returns
- zero if not equal, nonzero if equal. */
-
-static int
-compare0 (const char *s1, gfc_charlen_type s1_len, const char *s2)
-{
- gfc_charlen_type len;
-
- /* Strip trailing blanks from the Fortran string. */
- len = fstrlen (s1, s1_len);
-
- if ((size_t) len != strlen(s2))
- return 0; /* don't match */
-
- return strncasecmp (s1, s2, len) == 0;
-}
-
/* Given a fortran string, return its length exclusive of the trailing
spaces. */
@@ -116,8 +98,11 @@ int
find_option (st_parameter_common *cmp, const char *s1, gfc_charlen_type s1_len,
const st_option * opts, const char *error_message)
{
+ /* Strip trailing blanks from the Fortran string. */
+ size_t len = (size_t) fstrlen (s1, s1_len);
+
for (; opts->name; opts++)
- if (compare0 (s1, s1_len, opts->name))
+ if (len == strlen(opts->name) && strncasecmp (s1, opts->name, len) == 0)
return opts->value;
generate_error (cmp, LIBERROR_BAD_OPTION, error_message);