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

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

View file

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