Replaced calls to the custom strindex() and strrindex() functions with the
exactly equivalent and standard strchr() and strrchr() functions instead.
This commit is contained in:
@@ -66,8 +66,8 @@ enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
|
||||
|
||||
/* Library routines */
|
||||
|
||||
extern char *strindex();
|
||||
extern char *strrindex();
|
||||
extern char *strchr();
|
||||
extern char *strrchr();
|
||||
extern char *strcpy();
|
||||
extern char *strcat();
|
||||
extern int getpid();
|
||||
|
||||
@@ -117,7 +117,7 @@ char *srcvar() {
|
||||
}
|
||||
|
||||
char *getsuffix() {
|
||||
return strrindex(orig.p_path, SUFCHAR) ;
|
||||
return strrchr(orig.p_path, SUFCHAR) ;
|
||||
}
|
||||
|
||||
varinit() {
|
||||
@@ -250,7 +250,7 @@ vieuwargs(argc,argv) char **argv ; {
|
||||
firstarg(argp) register char *argp ; {
|
||||
register char *name ;
|
||||
|
||||
name=strrindex(argp,'/') ;
|
||||
name=strrchr(argp,'/') ;
|
||||
if ( name && *(name+1) ) {
|
||||
name++ ;
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ process(arg) char *arg ; {
|
||||
#ifdef DEBUG
|
||||
if ( debug ) vprint("Processing %s\n",arg) ;
|
||||
#endif
|
||||
p_suffix= strrindex(arg,SUFCHAR) ;
|
||||
p_suffix= strrchr(arg,SUFCHAR) ;
|
||||
orig.p_keep= YES ; /* Don't throw away the original ! */
|
||||
orig.p_keeps= NO;
|
||||
orig.p_path= arg ;
|
||||
|
||||
@@ -36,7 +36,7 @@ int runphase(phase) register trf *phase ; {
|
||||
vprint("%s",phase->t_name) ;
|
||||
if ( !phase->t_combine ) {
|
||||
vprint(" %s%s\n",p_basename,
|
||||
strrindex(in.p_path,SUFCHAR) ) ;
|
||||
strrchr(in.p_path,SUFCHAR) ) ;
|
||||
} else {
|
||||
scanlist(l_first(phase->t_inputs), elem) {
|
||||
vprint(" %s",p_cont(*elem)->p_path);
|
||||
|
||||
@@ -191,7 +191,7 @@ int satisfy(trafo,suffix) register trf *trafo; char *suffix ; {
|
||||
fuerror("Illegal input suffix entry for %s",
|
||||
trafo->t_name) ;
|
||||
}
|
||||
l_char=strindex(f_char+1,SUFCHAR);
|
||||
l_char=strchr(f_char+1,SUFCHAR);
|
||||
if ( l_char ) *l_char = 0;
|
||||
if ( strcmp(f_char,suffix)==0 ) {
|
||||
if ( l_char ) *l_char = SUFCHAR;
|
||||
|
||||
@@ -159,9 +159,9 @@ set_Rflag(argp) register char *argp ; {
|
||||
register int length ;
|
||||
char *eq, *colon ;
|
||||
|
||||
eos= strindex(&argp[2],'-');
|
||||
eq= strindex(&argp[2],EQUAL) ;
|
||||
colon= strindex(&argp[2],':');
|
||||
eos= strchr(&argp[2],'-');
|
||||
eq= strchr(&argp[2],EQUAL) ;
|
||||
colon= strchr(&argp[2],':');
|
||||
if ( !eos ) {
|
||||
eos= eq ;
|
||||
} else {
|
||||
@@ -470,7 +470,7 @@ int mapexpand(mapentry,cflag)
|
||||
register char *space ;
|
||||
int length ;
|
||||
|
||||
star=strindex(mapentry,STAR) ;
|
||||
star=strchr(mapentry,STAR) ;
|
||||
space=firstblank(mapentry) ;
|
||||
if ( star >space ) star= (char *)0 ;
|
||||
if ( star ) {
|
||||
@@ -514,7 +514,7 @@ doassign(line,star,length) char *line, *star ; {
|
||||
for ( ; *ptr && *ptr!=SPACE && *ptr!=TAB && *ptr!=EQUAL ; ptr++ ) {
|
||||
gr_add(&name,*ptr) ;
|
||||
}
|
||||
ptr= strindex(ptr,EQUAL) ;
|
||||
ptr= strchr(ptr,EQUAL) ;
|
||||
if ( !ptr ) {
|
||||
error("Missing %c in assignment %s",EQUAL,line);
|
||||
return ;
|
||||
@@ -602,7 +602,7 @@ addargs(string) char *string ; {
|
||||
register char *temp, *repc ;
|
||||
register list_elem *elem ;
|
||||
|
||||
repc=strindex(string,C_IN) ;
|
||||
repc=strchr(string,C_IN) ;
|
||||
if ( repc ) {
|
||||
/* INPUT FILE TOKEN seen, replace it and scan further */
|
||||
if ( repc==string && string[1]==0 ) {
|
||||
@@ -629,7 +629,7 @@ addargs(string) char *string ; {
|
||||
}
|
||||
return ;
|
||||
}
|
||||
repc=strindex(string,C_OUT) ;
|
||||
repc=strchr(string,C_OUT) ;
|
||||
if ( repc ) {
|
||||
/* replace the outfile token as with the infile token */
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -13,7 +13,7 @@ extern error(char *, ...);
|
||||
/* All the functions in this file will be called by the parser.
|
||||
*/
|
||||
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
|
||||
static struct Op_info { char *name, *type; }
|
||||
op_info[ MAX_OPERANDS] = { { 0, 0}};
|
||||
|
||||
@@ -160,9 +160,9 @@ char *skip_operand( ptr, instr)
|
||||
char *match_ch( c, str, instr)
|
||||
char c, *str, *instr;
|
||||
{
|
||||
char *ptr, *strindex();
|
||||
char *ptr, *strchr();
|
||||
|
||||
ptr = strindex( str, c);
|
||||
ptr = strchr( str, c);
|
||||
if ( ptr == 0) {
|
||||
error( "syntax error in %s : %c expected\n", instr, c);
|
||||
return( str);
|
||||
|
||||
@@ -20,12 +20,12 @@ getwdir(fn)
|
||||
char *fn;
|
||||
{
|
||||
register char *p;
|
||||
char *strrindex();
|
||||
char *strrchr();
|
||||
|
||||
p = strrindex(fn, '/');
|
||||
p = strrchr(fn, '/');
|
||||
while (p && *(p + 1) == '\0') { /* remove trailing /'s */
|
||||
*p = '\0';
|
||||
p = strrindex(fn, '/');
|
||||
p = strrchr(fn, '/');
|
||||
}
|
||||
|
||||
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */
|
||||
|
||||
@@ -93,7 +93,7 @@ compile(argc, argv)
|
||||
}
|
||||
|
||||
struct idf *file_head;
|
||||
extern char *strrindex();
|
||||
extern char *strrchr();
|
||||
|
||||
list_dependencies(source)
|
||||
char *source;
|
||||
@@ -101,7 +101,7 @@ list_dependencies(source)
|
||||
register struct idf *p = file_head;
|
||||
|
||||
if (source) {
|
||||
register char *s = strrindex(source, '.');
|
||||
register char *s = strrchr(source, '.');
|
||||
|
||||
if (s && *(s+1)) {
|
||||
s++;
|
||||
@@ -111,7 +111,7 @@ list_dependencies(source)
|
||||
* object generated, so don't include the pathname
|
||||
* leading to it.
|
||||
*/
|
||||
if (s = strrindex(source, '/')) {
|
||||
if (s = strrchr(source, '/')) {
|
||||
source = s + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ static char *phnames[] = {
|
||||
|
||||
extern char *mktemp();
|
||||
extern char *strcpy(), *strcat();
|
||||
extern char *strrindex();
|
||||
extern char *strrchr();
|
||||
|
||||
static char ddump[128] = TMP_DIR; /* data label dump file */
|
||||
static char pdump[128] = TMP_DIR; /* procedure name dump file */
|
||||
@@ -181,7 +181,7 @@ new_outfiles()
|
||||
register char **dst = &phargs[NTEMPS+1];
|
||||
|
||||
if (! Bindex) {
|
||||
Bindex = strrindex(tmpbufs[0], 'B') - tmpbufs[0];
|
||||
Bindex = strrchr(tmpbufs[0], 'B') - tmpbufs[0];
|
||||
}
|
||||
for (i = 1; i <= NTEMPS; i++) {
|
||||
*dst = tmpbufs[tmpindex];
|
||||
@@ -404,7 +404,7 @@ main(argc, argv)
|
||||
for (i = 2*NTEMPS-1; i >= 1; i--) {
|
||||
(void) strcpy(tmpbufs[i], tmpbufs[0]);
|
||||
}
|
||||
i = strrindex(tmpbufs[0], 'A') - tmpbufs[0];
|
||||
i = strrchr(tmpbufs[0], 'A') - tmpbufs[0];
|
||||
tmpbufs[0][i] = 'p'; tmpbufs[NTEMPS+0][i] = 'p';
|
||||
tmpbufs[1][i] = 'd'; tmpbufs[NTEMPS+1][i] = 'd';
|
||||
tmpbufs[2][i] = 'l'; tmpbufs[NTEMPS+2][i] = 'l';
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "misc.h"
|
||||
|
||||
extern char *Salloc();
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
extern char *strcpy();
|
||||
extern void signal_child();
|
||||
extern FILE *db_in;
|
||||
@@ -329,7 +329,7 @@ format_expression(p_tree *p;)
|
||||
expression(p, 0)
|
||||
[ '\\' name(&p1) { register char *c = p1->t_str;
|
||||
while (*c) {
|
||||
if (! strindex("doshcax", *c)) {
|
||||
if (! strchr("doshcax", *c)) {
|
||||
error("illegal format: %c", *c);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "rd.h"
|
||||
#include "misc.h"
|
||||
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
extern long str2long();
|
||||
extern double atof();
|
||||
|
||||
@@ -873,7 +873,7 @@ DbRead(f)
|
||||
break;
|
||||
#ifdef N_SCOPE
|
||||
case N_SCOPE:
|
||||
if (n->on_mptr && strindex(n->on_mptr, ':')) {
|
||||
if (n->on_mptr && strchr(n->on_mptr, ':')) {
|
||||
n = DbString(n);
|
||||
}
|
||||
break;
|
||||
@@ -898,7 +898,7 @@ DbRead(f)
|
||||
needs_newscope = 0;
|
||||
lbrac_required = 1;
|
||||
}
|
||||
if (n->on_mptr && strindex(n->on_mptr, ':')) {
|
||||
if (n->on_mptr && strchr(n->on_mptr, ':')) {
|
||||
n = DbString(n);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@ FILE *db_out;
|
||||
FILE *db_in;
|
||||
int debug;
|
||||
extern struct tokenname tkidf[];
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
extern void signal_child();
|
||||
extern void init_del();
|
||||
extern void init_run();
|
||||
@@ -56,7 +56,7 @@ main(argc, argv)
|
||||
db_in = stdin;
|
||||
progname = argv[0];
|
||||
init_del();
|
||||
while (p = strindex(progname, '/')) {
|
||||
while (p = strchr(progname, '/')) {
|
||||
progname = p + 1;
|
||||
}
|
||||
while (argv[1] && argv[1][0] == '-') {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "misc.h"
|
||||
|
||||
extern FILE *db_out;
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
extern char *malloc();
|
||||
|
||||
static
|
||||
@@ -24,7 +24,7 @@ print_unsigned(tp, v, format)
|
||||
register char *format;
|
||||
{
|
||||
while (format && *format) {
|
||||
if (strindex("cdohx", *format)) break;
|
||||
if (strchr("cdohx", *format)) break;
|
||||
format++;
|
||||
}
|
||||
switch(format == 0 ? 0 : *format) {
|
||||
@@ -87,7 +87,7 @@ print_integer(tp, v, format)
|
||||
register char *format;
|
||||
{
|
||||
while (format && *format) {
|
||||
if (strindex("cdohx", *format)) break;
|
||||
if (strchr("cdohx", *format)) break;
|
||||
format++;
|
||||
}
|
||||
switch(format == 0 ? 0 : *format) {
|
||||
@@ -203,7 +203,7 @@ print_val(tp, tp_sz, addr, compressed, indent, format)
|
||||
print_val(tp->ty_base, tp_sz, addr, compressed, indent, format);
|
||||
break;
|
||||
case T_ARRAY:
|
||||
if ((!format || strindex(format, 'a') == 0) &&
|
||||
if ((!format || strchr(format, 'a') == 0) &&
|
||||
(tp->ty_elements == char_type ||
|
||||
tp->ty_elements == uchar_type)) {
|
||||
print_val(string_type, tp_sz, addr, compressed, indent, format);
|
||||
@@ -292,7 +292,7 @@ print_val(tp, tp_sz, addr, compressed, indent, format)
|
||||
t_addr a = get_int(addr, tp_sz, T_UNSIGNED);
|
||||
|
||||
fprintf(db_out, currlang->addr_fmt, a);
|
||||
if (format && strindex(format, 's') &&
|
||||
if (format && strchr(format, 's') &&
|
||||
(tp->ty_ptrto == char_type || tp->ty_ptrto == uchar_type)) {
|
||||
char *naddr = malloc(512);
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Lookfromscope(id, class, sc)
|
||||
return (p_symbol) 0;
|
||||
}
|
||||
|
||||
extern char *strrindex();
|
||||
extern char *strrchr();
|
||||
|
||||
p_symbol
|
||||
add_file(s)
|
||||
@@ -112,7 +112,7 @@ add_file(s)
|
||||
|
||||
sym->sy_file = new_file();
|
||||
sym->sy_file->f_sym = sym;
|
||||
p = strrindex(s, '.');
|
||||
p = strrchr(s, '.');
|
||||
if (p) {
|
||||
char c = *p;
|
||||
p_symbol sym1;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
extern FILE *db_out;
|
||||
t_lineno currline;
|
||||
t_lineno listline;
|
||||
extern char *strrindex();
|
||||
extern char *strrchr();
|
||||
extern int interrupted;
|
||||
|
||||
#if __STDC__
|
||||
@@ -465,7 +465,7 @@ newfile(id)
|
||||
listfile = add_file(id->id_text);
|
||||
listfile->sy_file->f_scope = FileScope;
|
||||
}
|
||||
find_language(strrindex(id->id_text, '.'));
|
||||
find_language(strrchr(id->id_text, '.'));
|
||||
}
|
||||
|
||||
int in_wheninvoked;
|
||||
|
||||
@@ -123,7 +123,7 @@ first_pass(argv)
|
||||
int sectno;
|
||||
int h;
|
||||
extern int atoi();
|
||||
extern char *strindex();
|
||||
extern char *strchr();
|
||||
extern int hash();
|
||||
extern struct outname *searchname();
|
||||
|
||||
@@ -144,7 +144,7 @@ first_pass(argv)
|
||||
* section <section number>.
|
||||
*/
|
||||
sectno = atoi(++argp);
|
||||
if ((argp = strindex(argp, ':')) == (char *)0)
|
||||
if ((argp = strchr(argp, ':')) == (char *)0)
|
||||
fatal("usage: -a<section number>:<alignment>");
|
||||
setlign(sectno, number(++argp));
|
||||
break;
|
||||
@@ -157,7 +157,7 @@ first_pass(argv)
|
||||
* <section number>.
|
||||
*/
|
||||
sectno = atoi(++argp);
|
||||
if ((argp = strindex(argp, ':')) == (char *)0)
|
||||
if ((argp = strchr(argp, ':')) == (char *)0)
|
||||
fatal("usage: -b<section number>:<base>");
|
||||
setbase(sectno, number(++argp));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user