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:
dtrg
2006-07-23 20:01:02 +00:00
parent babe9eafad
commit 014be56fb0
40 changed files with 112 additions and 116 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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] == '-') {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;