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
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
)
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))
{
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
q = p;
while (q)
{
- q = index (q,'.');
+ q = strchr (q,'.');
if (q == 0)
{
q = p + strlen (p);
+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.
/* 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
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] != '.')
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
}
}
#ifdef NO_DOT_IN_LABEL
- bufp = (char *) index (bufp, '.');
+ bufp = (char *) strchr (bufp, '.');
if (bufp)
*bufp = '_';
#endif
return;
p = file_name_nondirectory (s);
- p = rindex (p, '.');
+ p = strrchr (p, '.');
if (! p)
p = s + strlen (s);
#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);
+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,
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
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)
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
}
/* 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.
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)
{
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",
}
/* 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)
/* 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. */
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);
{
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);
strcat (bbg_file_name, "/");
}
- cptr = rindex (input_file_name, '/');
+ cptr = strrchr (input_file_name, '/');
if (cptr)
{
strcat (da_file_name, cptr + 1);
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
}
count = strlen (source_file_name);
- cptr = rindex (s_ptr->name, '/');
+ cptr = strrchr (s_ptr->name, '/');
if (cptr)
cptr = cptr + 1;
else
{
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
strcat (gcov_file_name, ".");
- cptr = rindex (source_file_name, '/');
+ cptr = strrchr (source_file_name, '/');
if (cptr)
strcat (gcov_file_name, cptr + 1);
else
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
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);
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. */
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