diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index fc2ede5f8..c851e228d 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -697,7 +697,7 @@ static void check_extensions() { if (!extendhash) return; for (ki = First(extendhash); ki.key; ki = Next(ki)) { - if (!Strstr(ki.key,"<")) { + if (!Strchr(ki.key,'<')) { SWIG_WARN_NODE_BEGIN(ki.item); Swig_warning(WARN_PARSE_EXTEND_UNDEF,Getfile(ki.item), Getline(ki.item), "%%extend defined for an undeclared class %s.\n", ki.key); SWIG_WARN_NODE_END(ki.item); @@ -1042,10 +1042,10 @@ static Node *dump_nested(const char *parent) { if (code_ptr) { char *open_bracket_pos; code_ptr += strlen(types_array[i]); - open_bracket_pos = strstr(code_ptr, "{"); + open_bracket_pos = strchr(code_ptr, '{'); if (open_bracket_pos) { /* Make sure we don't have something like struct A a; */ - char* semi_colon_pos = strstr(code_ptr, ";"); + char* semi_colon_pos = strchr(code_ptr, ';'); if (!(semi_colon_pos && (semi_colon_pos < open_bracket_pos))) while (code_ptr < open_bracket_pos) *code_ptr++ = ' '; @@ -1061,7 +1061,7 @@ static Node *dump_nested(const char *parent) { while (code_ptr) { code_ptr = strstr(code_ptr, "%constant"); if (code_ptr) { - char* directive_end_pos = strstr(code_ptr, ";"); + char* directive_end_pos = strchr(code_ptr, ';'); if (directive_end_pos) { while (code_ptr <= directive_end_pos) *code_ptr++ = ' '; @@ -2780,8 +2780,8 @@ c_declaration : c_decl { } | c_enum_decl { $$ = $1; } | c_enum_forward_decl { $$ = $1; } - -/* A an extern C type declaration, disable cparse_cplusplus if needed. */ + +/* An extern C type declaration, disable cparse_cplusplus if needed. */ | EXTERN string LBRACE { if (Strcmp($2,"C") == 0) { @@ -3496,7 +3496,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para if ($$) tname = Getattr($$,k_name); /* Check if the class is a template specialization */ - if (($$) && (Strstr(tname,"<")) && (!is_operator(tname))) { + if (($$) && (Strchr(tname,'<')) && (!is_operator(tname))) { /* If a specialization. Check if defined. */ Node *tempn = 0; { @@ -4022,8 +4022,8 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { /* Check for template names. If the class is a template and the constructor is missing the template part, we add it */ - if (Classprefix && (c = strstr(Char(Classprefix),"<"))) { - if (!Strstr($3,"<")) { + if (Classprefix && (c = strchr(Char(Classprefix),'<'))) { + if (!Strchr($3,'<')) { $3 = NewStringf("%s%s",$3,c); } } diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index 0d8290384..295f2b072 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -141,16 +141,16 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear } Delete(stripped_name); } - if (strstr(Char(name),"<")) { + if (strchr(Char(name),'<')) { Append(patchlist,Getattr(n,k_name)); } else { Append(name,templateargs); } name = Getattr(n,k_symname); if (name) { - if (strstr(Char(name),"<")) { + if (strchr(Char(name),'<')) { Clear(name); - Append(name,rname); + Append(name,rname); } else { String *tmp = Copy(name); Replace(tmp,tname,rname, DOH_REPLACE_ANY); @@ -167,13 +167,13 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear add_parms(Getattr(n,k_throws), cpatchlist, typelist); } else if (StringEqual(nodeType,k_destructor)) { String *name = Getattr(n,k_name); - if (name && strstr(Char(name),"<")) { + if (name && strchr(Char(name),'<')) { Append(patchlist,Getattr(n,k_name)); } else { Append(name,templateargs); } name = Getattr(n,k_symname); - if (name && strstr(Char(name),"<")) { + if (name && strchr(Char(name),'<')) { String *sn = Copy(tname); Setattr(n,k_symname, sn); Delete(sn); @@ -184,7 +184,7 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear Append(cpatchlist,Getattr(n,k_code)); } else if (StringEqual(nodeType,k_using)) { String *uname = Getattr(n,k_uname); - if (uname && strstr(Char(uname),"<")) { + if (uname && strchr(Char(uname),'<')) { Append(patchlist, uname); } if (Getattr(n,k_namespace)) { @@ -218,8 +218,8 @@ String *partial_arg(String *s, String *p) { String *newarg; /* Find the prefix on the partial argument */ - - c = strstr(cp,"$"); + + c = strchr(cp,'$'); if (!c) { return Copy(s); } diff --git a/Source/DOH/fio.c b/Source/DOH/fio.c index 966731604..e8fc025bb 100644 --- a/Source/DOH/fio.c +++ b/Source/DOH/fio.c @@ -55,7 +55,7 @@ static DOH *encode(char *name, DOH *s) { DOH *handle, *ns; DOH *(*fn)(DOH *); long pos; - char *cfmt = strstr(name,":"); + char *cfmt = strchr(name,':'); DOH *tmp = 0; if (cfmt) { tmp = NewString(cfmt + 1); diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index 3f9ca8039..3b471bcd2 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -327,7 +327,7 @@ class Allocate : public Dispatcher { if (!name) continue; String *base_decl = Getattr(nn,"decl"); if (base_decl) base_decl = SwigType_typedef_resolve_all(base_decl); - if (Strstr(name,"~")) continue; /* Don't care about destructors */ + if (Strchr(name,'~')) continue; /* Don't care about destructors */ if (SwigType_isfunction(base_decl)) { search_decl = SwigType_pop_function(base_decl); diff --git a/Source/Modules/contract.cxx b/Source/Modules/contract.cxx index e279dd75b..86abeffd7 100644 --- a/Source/Modules/contract.cxx +++ b/Source/Modules/contract.cxx @@ -89,15 +89,15 @@ Hash *Contracts::ContractSplit(Node *n) { Iterator i; for (i = First(l); i.item; i = Next(i)) { int found = 0; - if (Strstr(i.item,"{")) continue; - if (Strstr(i.item,"}")) continue; + if (Strchr(i.item,'{')) continue; + if (Strchr(i.item,'}')) continue; for (int j = 0; Rules[j].section; j++) { if (Strstr(i.item,Rules[j].section)) { if (Len(current_section)) { Setattr(result,current_section_name,current_section); current_section = Getattr(result,Rules[j].section); if (!current_section) current_section = NewString(""); - } + } current_section_name = Rules[j].section; found = 1; break; diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 453abdd56..cbea9e53a 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -321,7 +321,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) if (c == '(') { argstr = NewStringEmpty(); copy_location(str,argstr); - /* It is a macro. Go extract it's argument string */ + /* It is a macro. Go extract its argument string */ while ((c = StringGetc(str)) != EOF) { if (c == ')') break; else StringPutc(c,argstr); @@ -793,7 +793,7 @@ expand_macro(String *name, List *args) version of the argument except that if the argument is already quoted nothing happens */ - if (strstr(StringChar(ns),"`")) { + if (strchr(StringChar(ns),'`')) { String *rep; char *c; Clear(temp); @@ -884,7 +884,7 @@ expand_macro(String *name, List *args) Printf(f,"/*@%s,%d,%s@*/%s/*@@*/", Getfile(macro), Getline(macro), name, g); #else /* Use simplified around markers to properly count lines in cscanner.c */ - if (strstr(Char(g),"\n")) { + if (strchr(Char(g),'\n')) { Printf(f,"/*@SWIG:%s@*/%s/*@SWIG@*/", name, g); } else { StringAppend(f,g); diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 0f7a28856..bd012a619 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -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,'@'); } } } diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 47aafab29..26e7474ba 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -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 { diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index 58d612471..a5139c352 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -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; diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index f43cd17ee..310c192a5 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -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); } diff --git a/Source/Swig/wrapfunc.c b/Source/Swig/wrapfunc.c index ca5eb7122..6799e7f87 100644 --- a/Source/Swig/wrapfunc.c +++ b/Source/Swig/wrapfunc.c @@ -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 == '(') {