aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-11-02 19:03:59 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2000-11-02 19:03:59 +0000
commit9473c5226bfe4c2a3d0045028921a00a167e5c40 (patch)
tree79fd392a778483e0dba0d31c32d9d005dc4fdeeb
parent0304bbad379d530d08ca2aa11289875e71a44aa6 (diff)
downloadgcc-9473c5226bfe4c2a3d0045028921a00a167e5c40.zip
gcc-9473c5226bfe4c2a3d0045028921a00a167e5c40.tar.gz
gcc-9473c5226bfe4c2a3d0045028921a00a167e5c40.tar.bz2
* collect2.c (main, write_c_file_stat), gcc.c (translate_options,
process_command, main), gcov.c (open_files, output_data), tlink.c (frob_extension, scan_linker_output), toplev.c (file_name_nondirectory): Use strchr () and strrchr () instead of index () and rindex (). cp: * dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c (build_overload_value), repo.c (open_repo_file), xref.c (open_xref_file): Use strchr () and strrchr () instead of index () and rindex (). f: * com.c (open_include_file, ffecom_open_include_): Use strchr () and strrchr () instead of index () and rindex (). From-SVN: r37206
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/collect2.c8
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/dump.c2
-rw-r--r--gcc/cp/lex.c2
-rw-r--r--gcc/cp/method.c4
-rw-r--r--gcc/cp/repo.c2
-rw-r--r--gcc/cp/xref.c4
-rw-r--r--gcc/f/ChangeLog5
-rw-r--r--gcc/f/com.c20
-rw-r--r--gcc/gcc.c18
-rw-r--r--gcc/gcov.c16
-rw-r--r--gcc/tlink.c12
-rw-r--r--gcc/toplev.c4
14 files changed, 66 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e6c21f7..c6b37df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
+ * collect2.c (main, write_c_file_stat), gcc.c (translate_options,
+ process_command, main), gcov.c (open_files, output_data), tlink.c
+ (frob_extension, scan_linker_output), toplev.c
+ (file_name_nondirectory): Use strchr () and strrchr () instead of
+ index () and rindex ().
+
+2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
* c-common.c (get_flag_spec, check_format_info_main,
check_format_types): Use strchr () instead of index (). Compare
against error_mark_node instead of comparing the TREE_CODE against
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 4180e83..139e6e8 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1172,7 +1172,7 @@ main (argc, argv)
output_file = *ld1++ = *ld2++ = *++argv;
else if (1
#ifdef SWITCHES_NEED_SPACES
- && ! index (SWITCHES_NEED_SPACES, arg[1])
+ && ! strchr (SWITCHES_NEED_SPACES, arg[1])
#endif
)
@@ -1201,7 +1201,7 @@ main (argc, argv)
break;
}
}
- else if ((p = rindex (arg, '.')) != (char *) 0
+ else if ((p = strrchr (arg, '.')) != (char *) 0
&& (strcmp (p, ".o") == 0 || strcmp (p, ".a") == 0
|| strcmp (p, ".so") == 0 || strcmp (p, ".lo") == 0))
{
@@ -1829,7 +1829,7 @@ write_c_file_stat (stream, name)
int frames = (frame_tables.number > 0);
/* Figure out name of output_file, stripping off .so version. */
- p = rindex (output_file, '/');
+ p = strrchr (output_file, '/');
if (p == 0)
p = output_file;
else
@@ -1837,7 +1837,7 @@ write_c_file_stat (stream, name)
q = p;
while (q)
{
- q = index (q,'.');
+ q = strchr (q,'.');
if (q == 0)
{
q = p + strlen (p);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9846778..0b1a322 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c
+ (build_overload_value), repo.c (open_repo_file), xref.c
+ (open_xref_file): Use strchr () and strrchr () instead of index ()
+ and rindex ().
+
2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
* call.c (build_over_call): Call fold on the CALL_EXPR.
diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c
index d528e1c..618a714 100644
--- a/gcc/cp/dump.c
+++ b/gcc/cp/dump.c
@@ -378,7 +378,7 @@ dequeue_and_dump (di)
/* And a source position. */
if (DECL_SOURCE_FILE (t))
{
- const char *filename = rindex (DECL_SOURCE_FILE (t), '/');
+ const char *filename = strrchr (DECL_SOURCE_FILE (t), '/');
if (!filename)
filename = DECL_SOURCE_FILE (t);
else
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index e5cdbf1..8d0f5e6 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1022,7 +1022,7 @@ interface_strcmp (s)
return 0;
/* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
- if (index (s1, '.') || index (t1, '.'))
+ if (strchr (s1, '.') || strchr (t1, '.'))
continue;
if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index c389748..532e451 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -770,7 +770,7 @@ build_overload_value (type, value, flags)
else
{
REAL_VALUE_TO_DECIMAL (val, "%.20e", bufp);
- bufp = (char *) index (bufp, 'e');
+ bufp = (char *) strchr (bufp, 'e');
if (!bufp)
strcat (digit_buffer, "e0");
else
@@ -799,7 +799,7 @@ build_overload_value (type, value, flags)
}
}
#ifdef NO_DOT_IN_LABEL
- bufp = (char *) index (bufp, '.');
+ bufp = (char *) strchr (bufp, '.');
if (bufp)
*bufp = '_';
#endif
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 32812ec..8feab83 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -301,7 +301,7 @@ open_repo_file (filename)
return;
p = file_name_nondirectory (s);
- p = rindex (p, '.');
+ p = strrchr (p, '.');
if (! p)
p = s + strlen (s);
diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c
index 9a1fd97..cf99fcd 100644
--- a/gcc/cp/xref.c
+++ b/gcc/cp/xref.c
@@ -811,14 +811,14 @@ open_xref_file(file)
#ifdef XREF_FILE_NAME
XREF_FILE_NAME (xref_name, file);
#else
- s = rindex (file, '/');
+ s = strrchr (file, '/');
if (s == NULL)
sprintf (xref_name, ".%s.gxref", file);
else
{
++s;
strcpy (xref_name, file);
- t = rindex (xref_name, '/');
+ t = strrchr (xref_name, '/');
++t;
*t++ = '.';
strcpy (t, s);
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index ec1f2a8..fcb06af 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * com.c (open_include_file, ffecom_open_include_): Use strchr ()
+ and strrchr () instead of index () and rindex ().
+
2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
* Make-lang.in: Move all build rules here from Makefile.in,
diff --git a/gcc/f/com.c b/gcc/f/com.c
index 495f168..d158fed 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -15794,11 +15794,11 @@ open_include_file (filename, searchptr)
looking in. Thus #include <sys/types.h> will look up sys/types.h
in /usr/include/header.gcc and look up types.h in
/usr/include/sys/header.gcc. */
- p = rindex (filename, '/');
+ p = strrchr (filename, '/');
#ifdef DIR_SEPARATOR
- if (! p) p = rindex (filename, DIR_SEPARATOR);
+ if (! p) p = strrchr (filename, DIR_SEPARATOR);
else {
- char *tmp = rindex (filename, DIR_SEPARATOR);
+ char *tmp = strrchr (filename, DIR_SEPARATOR);
if (tmp != NULL && tmp > p) p = tmp;
}
#endif
@@ -16139,18 +16139,18 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c)
dsp[0].next = search_start;
search_start = dsp;
#ifndef VMS
- ep = rindex (nam, '/');
+ ep = strrchr (nam, '/');
#ifdef DIR_SEPARATOR
- if (ep == NULL) ep = rindex (nam, DIR_SEPARATOR);
+ if (ep == NULL) ep = strrchr (nam, DIR_SEPARATOR);
else {
- char *tmp = rindex (nam, DIR_SEPARATOR);
+ char *tmp = strrchr (nam, DIR_SEPARATOR);
if (tmp != NULL && tmp > ep) ep = tmp;
}
#endif
#else /* VMS */
- ep = rindex (nam, ']');
- if (ep == NULL) ep = rindex (nam, '>');
- if (ep == NULL) ep = rindex (nam, ':');
+ ep = strrchr (nam, ']');
+ if (ep == NULL) ep = strrchr (nam, '>');
+ if (ep == NULL) ep = strrchr (nam, ':');
if (ep != NULL) ep++;
#endif /* VMS */
if (ep != NULL)
@@ -16229,7 +16229,7 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c)
fname[flen] = 0;
#if 0 /* Not for g77. */
/* if it's '#include filename', add the missing .h */
- if (index (fname, '.') == NULL)
+ if (strchr (fname, '.') == NULL)
strcat (fname, ".h");
#endif
}
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 22bf907..bd8d70a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -946,7 +946,7 @@ translate_options (argcp, argvp)
/* If this mapping requires extra text at end of name,
accept that as "argument". */
- else if (index (arginfo, '*') != 0)
+ else if (strchr (arginfo, '*') != 0)
arg = argv[i] + optlen;
/* Otherwise, extra text at end means mismatch.
@@ -955,14 +955,14 @@ translate_options (argcp, argvp)
continue;
}
- else if (index (arginfo, '*') != 0)
+ else if (strchr (arginfo, '*') != 0)
{
error ("Incomplete `%s' option", option_map[j].name);
break;
}
/* Handle arguments. */
- if (index (arginfo, 'a') != 0)
+ if (strchr (arginfo, 'a') != 0)
{
if (arg == 0)
{
@@ -976,9 +976,9 @@ translate_options (argcp, argvp)
arg = argv[++i];
}
}
- else if (index (arginfo, '*') != 0)
+ else if (strchr (arginfo, '*') != 0)
;
- else if (index (arginfo, 'o') == 0)
+ else if (strchr (arginfo, 'o') == 0)
{
if (arg != 0)
error ("Extraneous argument to `%s' option",
@@ -987,7 +987,7 @@ translate_options (argcp, argvp)
}
/* Store the translation as one argv elt or as two. */
- if (arg != 0 && index (arginfo, 'j') != 0)
+ if (arg != 0 && strchr (arginfo, 'j') != 0)
newv[newindex++] = concat (option_map[j].equivalent, arg,
NULL_PTR);
else if (arg != 0)
@@ -3646,7 +3646,7 @@ process_command (argc, argv)
/* Null-terminate the vector. */
switches[n_switches].args[j] = 0;
}
- else if (index (switches_need_spaces, c))
+ else if (strchr (switches_need_spaces, c))
{
/* On some systems, ld cannot handle some options without
a space. So split the option from its argument. */
@@ -5288,7 +5288,7 @@ main (argc, argv)
first_time = FALSE;
obstack_grow (&collect_obstack, "'-", 2);
q = switches[i].part1;
- while ((p = index (q, '\'')))
+ while ((p = strchr (q, '\'')))
{
obstack_grow (&collect_obstack, q, p - q);
obstack_grow (&collect_obstack, "'\\''", 4);
@@ -5301,7 +5301,7 @@ main (argc, argv)
{
obstack_grow (&collect_obstack, " '", 2);
q = *args;
- while ((p = index (q, '\'')))
+ while ((p = strchr (q, '\'')))
{
obstack_grow (&collect_obstack, q, p - q);
obstack_grow (&collect_obstack, "'\\''", 4);
diff --git a/gcc/gcov.c b/gcc/gcov.c
index d10108d..a1c57e5 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -376,7 +376,7 @@ open_files ()
strcat (bbg_file_name, "/");
}
- cptr = rindex (input_file_name, '/');
+ cptr = strrchr (input_file_name, '/');
if (cptr)
{
strcat (da_file_name, cptr + 1);
@@ -397,19 +397,19 @@ open_files ()
strcpy (bbg_file_name, input_file_name);
}
- cptr = rindex (bb_file_name, '.');
+ cptr = strrchr (bb_file_name, '.');
if (cptr)
strcpy (cptr, ".bb");
else
strcat (bb_file_name, ".bb");
- cptr = rindex (da_file_name, '.');
+ cptr = strrchr (da_file_name, '.');
if (cptr)
strcpy (cptr, ".da");
else
strcat (da_file_name, ".da");
- cptr = rindex (bbg_file_name, '.');
+ cptr = strrchr (bbg_file_name, '.');
if (cptr)
strcpy (cptr, ".bbg");
else
@@ -1249,7 +1249,7 @@ output_data ()
}
count = strlen (source_file_name);
- cptr = rindex (s_ptr->name, '/');
+ cptr = strrchr (s_ptr->name, '/');
if (cptr)
cptr = cptr + 1;
else
@@ -1258,7 +1258,7 @@ output_data ()
{
gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
- cptr = rindex (input_file_name, '/');
+ cptr = strrchr (input_file_name, '/');
if (cptr)
strcpy (gcov_file_name, cptr + 1);
else
@@ -1266,7 +1266,7 @@ output_data ()
strcat (gcov_file_name, ".");
- cptr = rindex (source_file_name, '/');
+ cptr = strrchr (source_file_name, '/');
if (cptr)
strcat (gcov_file_name, cptr + 1);
else
@@ -1275,7 +1275,7 @@ output_data ()
else
{
gcov_file_name = xmalloc (count + 6);
- cptr = rindex (source_file_name, '/');
+ cptr = strrchr (source_file_name, '/');
if (cptr)
strcpy (gcov_file_name, cptr + 1);
else
diff --git a/gcc/tlink.c b/gcc/tlink.c
index e96f6dc..8758556 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -327,10 +327,10 @@ frob_extension (s, ext)
const char *s;
const char *ext;
{
- const char *p = rindex (s, '/');
+ const char *p = strrchr (s, '/');
if (! p)
p = s;
- p = rindex (p, '.');
+ p = strrchr (p, '.');
if (! p)
p = s + strlen (s);
@@ -652,12 +652,12 @@ scan_linker_output (fname)
q = 0;
/* First try `GNU style'. */
- p = index (oldq, '`');
+ p = strchr (oldq, '`');
if (p)
- p++, q = index (p, '\'');
+ p++, q = strchr (p, '\'');
/* Then try "double quotes". */
- else if (p = index (oldq, '"'), p)
- p++, q = index (p, '"');
+ else if (p = strchr (oldq, '"'), p)
+ p++, q = strchr (p, '"');
/* Don't let the strstr's below see the demangled name; we
might get spurious matches. */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 580b51c..aa8c4ba 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1717,9 +1717,9 @@ char *
file_name_nondirectory (x)
const char *x;
{
- char *tmp = (char *) rindex (x, '/');
+ char *tmp = (char *) strrchr (x, '/');
if (DIR_SEPARATOR != '/' && ! tmp)
- tmp = (char *) rindex (x, DIR_SEPARATOR);
+ tmp = (char *) strrchr (x, DIR_SEPARATOR);
if (tmp)
return (char *) (tmp + 1);
else