repo.c (rindex): Add decl unconditionally.

* repo.c (rindex): Add decl unconditionally.
	(get_base_filename, open_repo_file): Don't cast rindex.
	* xref.c (rindex): Add decl unconditionally.
	(index): Remove unused decl.
	(open_xref_file): Don't cast rindex.

fix potential problems with 64-bit compilers and casting an int up to a char*

From-SVN: r16306
This commit is contained in:
Brendan Kehoe 1997-11-03 23:20:24 +00:00 committed by Brendan Kehoe
parent 08bb4b3b2c
commit a8a63732c4
3 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,11 @@
1997-11-03 Brendan Kehoe <brendan@lisa.cygnus.com>
* repo.c (rindex): Add decl unconditionally.
(get_base_filename, open_repo_file): Don't cast rindex.
* xref.c (rindex): Add decl unconditionally.
(index): Remove unused decl.
(open_xref_file): Don't cast rindex.
Sun Nov 2 15:04:12 1997 Jason Merrill <jason@yorick.cygnus.com>
* class.c (build_vbase_path): Propagate the result type properly.

View File

@ -34,15 +34,15 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_STRING_H
#include <string.h>
#else
extern char * rindex ();
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
extern char * getenv ();
#endif
extern char * getpwd PROTO((void));
extern char *rindex ();
extern char *getpwd PROTO((void));
static tree repo_get_id PROTO((tree));
static char *save_string PROTO((char *, int));
@ -277,7 +277,7 @@ get_base_filename (filename)
return NULL;
}
p = (char *) rindex (filename, '/');
p = rindex (filename, '/');
if (p)
return p+1;
else
@ -294,10 +294,10 @@ open_repo_file (filename)
if (s == NULL)
return;
p = (char *) rindex (s, '/');
p = rindex (s, '/');
if (! p)
p = s;
p = (char *) rindex (p, '.');
p = rindex (p, '.');
if (! p)
p = s + strlen (s);

View File

@ -40,11 +40,10 @@ extern char *getpwd PROTO((void));
#ifdef HAVE_STRING_H
#include <string.h>
#else
extern char *index ();
extern char *rindex ();
#endif
extern char *rindex ();
/* The character(s) used to join a directory specification (obtained with
getwd or equivalent) with a non-absolute file name. */
@ -813,14 +812,14 @@ open_xref_file(file)
#ifdef XREF_FILE_NAME
XREF_FILE_NAME (xref_name, file);
#else
s = (char *) rindex (file, '/');
s = rindex (file, '/');
if (s == NULL)
sprintf (xref_name, ".%s.gxref", file);
else
{
++s;
strcpy (xref_name, file);
t = (char *) rindex (xref_name, '/');
t = rindex (xref_name, '/');
++t;
*t++ = '.';
strcpy (t, s);