avoid Strcmp

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7891 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-28 02:41:59 +00:00
commit 6aabe03ffb
2 changed files with 17 additions and 17 deletions

View file

@ -88,28 +88,28 @@ static Node *new_node(const String_or_char *tag) {
static Node *copy_node(Node *n) { static Node *copy_node(Node *n) {
Node *nn; Node *nn;
String *key;
Iterator k; Iterator k;
nn = NewHash(); nn = NewHash();
Setfile(nn,Getfile(n)); Setfile(nn,Getfile(n));
Setline(nn,Getline(n)); Setline(nn,Getline(n));
for (k = First(n); k.key; k = Next(k)) { for (k = First(n); k.key; k = Next(k)) {
key = k.key; String *key = k.key;
if ((Strcmp(key,"nextSibling") == 0) || char *ckey = Char(key);
(Strcmp(key,"previousSibling") == 0) || if ((strcmp(ckey,"nextSibling") == 0) ||
(Strcmp(key,"parentNode") == 0) || (strcmp(ckey,"previousSibling") == 0) ||
(Strcmp(key,"lastChild") == 0)) { (strcmp(ckey,"parentNode") == 0) ||
(strcmp(ckey,"lastChild") == 0)) {
continue; continue;
} }
if (Strncmp(key,"csym:",5) == 0) continue; if (Strncmp(key,"csym:",5) == 0) continue;
/* We do copy sym:name. For templates */ /* We do copy sym:name. For templates */
if ((Strcmp(key,"sym:name") == 0) || if ((strcmp(ckey,"sym:name") == 0) ||
(Strcmp(key,"sym:weak") == 0) || (strcmp(ckey,"sym:weak") == 0) ||
(Strcmp(key,"sym:typename") == 0)) { (strcmp(ckey,"sym:typename") == 0)) {
Setattr(nn,key, Copy(k.item)); Setattr(nn,key, Copy(k.item));
continue; continue;
} }
if (Strcmp(key,"sym:symtab") == 0) { if (strcmp(ckey,"sym:symtab") == 0) {
Setattr(nn,"sym:needs_symtab", "1"); Setattr(nn,"sym:needs_symtab", "1");
} }
/* We don't copy any other symbol table attributes */ /* We don't copy any other symbol table attributes */
@ -117,7 +117,7 @@ static Node *copy_node(Node *n) {
continue; continue;
} }
/* If children. We copy them recursively using this function */ /* If children. We copy them recursively using this function */
if (Strcmp(key,"firstChild") == 0) { if (strcmp(ckey,"firstChild") == 0) {
/* Copy children */ /* Copy children */
Node *cn = k.item; Node *cn = k.item;
while (cn) { while (cn) {
@ -129,17 +129,17 @@ static Node *copy_node(Node *n) {
/* We don't copy the symbol table. But we drop an attribute /* We don't copy the symbol table. But we drop an attribute
requires_symtab so that functions know it needs to be built */ requires_symtab so that functions know it needs to be built */
if (Strcmp(key,"symtab") == 0) { if (strcmp(ckey,"symtab") == 0) {
/* Node defined a symbol table. */ /* Node defined a symbol table. */
Setattr(nn,"requires_symtab","1"); Setattr(nn,"requires_symtab","1");
continue; continue;
} }
/* Can't copy nodes */ /* Can't copy nodes */
if (Strcmp(key,"node") == 0) { if (strcmp(ckey,"node") == 0) {
continue; continue;
} }
if ((Strcmp(key,"parms") == 0) || (Strcmp(key,"pattern") == 0) || (Strcmp(key,"throws") == 0) if ((strcmp(ckey,"parms") == 0) || (strcmp(ckey,"pattern") == 0) || (strcmp(ckey,"throws") == 0)
|| (Strcmp(key,"kwargs") == 0)) { || (strcmp(ckey,"kwargs") == 0)) {
ParmList *pl = CopyParmList(k.item); ParmList *pl = CopyParmList(k.item);
Setattr(nn,key,pl); Setattr(nn,key,pl);
Delete(pl); Delete(pl);

View file

@ -25,11 +25,11 @@ void Swig_cparse_replace_descriptor(String *s) {
char tmp[512]; char tmp[512];
String *arg = 0; String *arg = 0;
SwigType *t; SwigType *t;
char *c = 0;
while (Strstr(s,"$descriptor(")) { while ((c = strstr(Char(s),"$descriptor("))) {
char *d = tmp; char *d = tmp;
int level = 0; int level = 0;
char *c = Strstr(s,"$descriptor(");
while (*c) { while (*c) {
if (*c == '(') level++; if (*c == '(') level++;
if (*c == ')') { if (*c == ')') {