Use strchr() instead of index().

strchr() is more portable and index() is not available under
MinGW so replace index() with strchr().
This commit is contained in:
Cary R 2009-05-25 10:35:55 -07:00 committed by Stephen Williams
parent 4affc6e412
commit 5fc236accc
1 changed files with 4 additions and 2 deletions

View File

@ -481,6 +481,7 @@ S [afpnumkKMGT]
NetNet::Type net_type; NetNet::Type net_type;
size_t wordlen = strcspn(yytext, " \t\f\r\n"); size_t wordlen = strcspn(yytext, " \t\f\r\n");
yytext[wordlen] = 0; yytext[wordlen] = 0;
/* Add support for other wire types and better error detection. */
if (strcmp(yytext,"wire") == 0) { if (strcmp(yytext,"wire") == 0) {
net_type = NetNet::WIRE; net_type = NetNet::WIRE;
@ -994,6 +995,7 @@ static void process_timescale(const char*txt)
char*tmp; char*tmp;
const char*ctmp; const char*ctmp;
// Add beetter error detection. Look at `line
int unit = 0; int unit = 0;
int prec = 0; int prec = 0;
@ -1101,7 +1103,7 @@ static void line_directive()
{ {
char *cpr; char *cpr;
/* Skip any leading space. */ /* Skip any leading space. */
char *cp = index(yytext, '#'); char *cp = strchr(yytext, '#');
/* Skip the #line directive. */ /* Skip the #line directive. */
assert(strncmp(cp, "#line", 5) == 0); assert(strncmp(cp, "#line", 5) == 0);
cp += 5; cp += 5;
@ -1170,7 +1172,7 @@ static void line_directive2()
{ {
char *cpr; char *cpr;
/* Skip any leading space. */ /* Skip any leading space. */
char *cp = index(yytext, '`'); char *cp = strchr(yytext, '`');
/* Skip the `line directive. */ /* Skip the `line directive. */
assert(strncmp(cp, "`line", 5) == 0); assert(strncmp(cp, "`line", 5) == 0);
cp += 5; cp += 5;