Use Strchr/strchr instead of Strstr/strstr when searching for a single

character.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9334 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-09-23 22:36:23 +00:00
commit 1e19f11fdc
11 changed files with 38 additions and 38 deletions

View file

@ -892,7 +892,7 @@ String *Swig_string_rxspencer(String *s) {
if (retval != REG_NOMATCH) {
char *spos = 0;
res = NewStringWithSize(cb, ce - cb);
spos = Strstr(res,"@");
spos = Strchr(res,'@');
while (spos) {
char cd = *(++spos);
if (isdigit(cd)) {
@ -908,9 +908,9 @@ String *Swig_string_rxspencer(String *s) {
} else {
Replaceall(res,arg,"");
}
spos = Strstr(res,"@");
spos = Strchr(res,'@');
} else if (cd == '@') {
spos = strstr(spos + 1,"@");
spos = strchr(spos + 1,'@');
}
}
}

View file

@ -997,16 +997,16 @@ int Swig_need_protected(Node* n)
static List *Swig_make_attrlist(const char *ckey) {
List *list = NewList();
const char *cattr = strstr(ckey,"$");
const char *cattr = strchr(ckey,'$');
if (cattr) {
String *nattr;
const char *rattr = strstr(++cattr,"$");
const char *rattr = strchr(++cattr,'$');
while (rattr) {
nattr = NewStringWithSize(cattr, rattr-cattr);
Append(list,nattr);
Delete(nattr);
cattr = rattr + 1;
rattr = strstr(cattr,"$");
rattr = strchr(cattr,'$');
}
nattr = NewString(cattr);
Append(list,nattr);
@ -1158,14 +1158,14 @@ int Swig_name_match_value(String *mvalue, String *value)
int match = 0;
char *cvalue = Char(value);
char *cmvalue = Char(mvalue);
char *sep = strstr(cmvalue,"|");
char *sep = strchr(cmvalue,'|');
while (sep && !match) {
match = strncmp(cvalue,cmvalue, sep - cmvalue) == 0;
#ifdef SWIG_DEBUG
Printf(stderr,"match_value: %s %s %d\n",cvalue,cmvalue, match);
#endif
cmvalue = sep + 1;
sep = strstr(cmvalue,"|");
sep = strchr(cmvalue,'|');
}
if (!match) {
match = strcmp(cvalue,cmvalue) == 0;
@ -1414,7 +1414,7 @@ static String *apply_rename(String *newname, int fullname, String *prefix, Strin
int destructor = name && (*(Char(name)) == '~');
String *fmt = newname;
/* use name as a fmt, but avoid C++ "%" and "%=" operators */
if (Len(newname) > 1 && strstr(cnewname,"%") && !(strcmp(cnewname,"%=") == 0)) {
if (Len(newname) > 1 && strchr(cnewname,'%') && !(strcmp(cnewname,"%=") == 0)) {
if (fullname && prefix) {
result = NewStringf(fmt,prefix,name);
} else {

View file

@ -1664,7 +1664,7 @@ static List *split_embedded(String *s) {
int leading = 1;
args = NewList();
c = strstr(Char(s),"(");
c = strchr(Char(s),'(');
c++;
start = c;
@ -1703,7 +1703,7 @@ static void split_var(String *s, String **name, String **value) {
char *eq;
char *c;
eq = strstr(Char(s),"=");
eq = strchr(Char(s),'=');
if (!eq) {
*name = 0;
*value = 0;

View file

@ -1437,7 +1437,7 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
if (t) {
char *ct = Char(t);
if (strstr(ct,"<") && !(strstr(ct,"<("))) {
if (strchr(ct,'<') && !(strstr(ct,"<("))) {
Printf(stdout,"Bad template type passed to SwigType_remember: %s\n", t);
assert(0);
}

View file

@ -104,7 +104,7 @@ Wrapper_pretty_print(String *str, File *f) {
} else if (c == ':') {
Putc(c,ts);
if ((c = Getc(str)) == '\n') {
if (!empty && !strstr(Char(ts),"?")) label = 1;
if (!empty && !strchr(Char(ts),'?')) label = 1;
}
Ungetc(c,str);
} else if (c == '(') {