Fix Strcmp - it didn't have consistent null pointer handling - revert to what it used to be - a lightweight wrapper around strcmp which means functions once again must not pass in null to it.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13943 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
18ef95083d
commit
89052f3b0a
8 changed files with 18 additions and 17 deletions
|
|
@ -1225,7 +1225,7 @@ void emit_full_class(Node *n) {
|
|||
// hack. why would decl have a value of "variableHandler" and now "0"?
|
||||
String *childDecl = Getattr(c, "decl");
|
||||
// Printf(stderr,"childDecl = '%s' (%s)\n", childDecl, Getattr(c,"view"));
|
||||
if (!Strcmp(childDecl, "0"))
|
||||
if (!childDecl || !Strcmp(childDecl, "0"))
|
||||
childDecl = NewString("");
|
||||
|
||||
SwigType *childType;
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ void CFFI::emit_struct_union(Node *n, bool un = false) {
|
|||
String *typespec = tm ? NewString(tm) : NewString("");
|
||||
|
||||
String *slot_name = lispify_name(c, Getattr(c, "sym:name"), "'slotname");
|
||||
if (Strcmp(slot_name, "t") == 0 || Strcmp(slot_name, "T") == 0)
|
||||
if (slot_name && (Strcmp(slot_name, "t") == 0 || Strcmp(slot_name, "T") == 0))
|
||||
slot_name = NewStringf("t_var");
|
||||
|
||||
Printf(f_cl, "\n\t(%s %s)", slot_name, typespec);
|
||||
|
|
|
|||
|
|
@ -4418,10 +4418,14 @@ private:
|
|||
// so we can progress up the inheritance hierachy even if there have been
|
||||
// new overloads introduced after the topmost class.
|
||||
Node *base_function = NULL;
|
||||
for (Node *tmp = firstChild(base_class); tmp; tmp = nextSibling(tmp)) {
|
||||
if (Strcmp(Getattr(tmp, "sym:name"), Getattr(n, "sym:name")) == 0) {
|
||||
base_function = tmp;
|
||||
break;
|
||||
String *symname = Getattr(n, "sym:name");
|
||||
if (symname) {
|
||||
for (Node *tmp = firstChild(base_class); tmp; tmp = nextSibling(tmp)) {
|
||||
String *child_symname = Getattr(tmp, "sym:name");
|
||||
if (child_symname && (Strcmp(child_symname, symname) == 0)) {
|
||||
base_function = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1990,7 +1990,7 @@ private:
|
|||
continue;
|
||||
}
|
||||
String *storage = Getattr(ni, "storage");
|
||||
if (Strcmp(storage, "typedef") == 0 || Strcmp(storage, "friend") == 0) {
|
||||
if (storage && (Strcmp(storage, "typedef") == 0 || Strcmp(storage, "friend") == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -4792,7 +4792,7 @@ private:
|
|||
return Copy(ret);
|
||||
}
|
||||
|
||||
if (Strcmp(Getattr(n, "type"), "enum ") == 0) {
|
||||
if (Equal(Getattr(n, "type"), "enum ")) {
|
||||
return NewString("int");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1577,7 +1577,8 @@ public:
|
|||
while (i.item) {
|
||||
Node *j = firstChild(i.item);
|
||||
while (j) {
|
||||
if (Strcmp(Getattr(j, "name"), Getattr(n, "name")) != 0) {
|
||||
String *jname = Getattr(j, "name");
|
||||
if (!jname || Strcmp(jname, Getattr(n, "name")) != 0) {
|
||||
j = nextSibling(j);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2351,7 +2351,7 @@ int R::classDeclaration(Node *n) {
|
|||
elName = Getattr(c, "name");
|
||||
|
||||
String *elKind = Getattr(c, "kind");
|
||||
if (Strcmp(elKind, "variable") != 0) {
|
||||
if (!Equal(elKind, "variable")) {
|
||||
c = nextSibling(c);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2453,7 +2453,7 @@ int R::generateCopyRoutines(Node *n) {
|
|||
continue;
|
||||
}
|
||||
String *elKind = Getattr(c, "kind");
|
||||
if (Strcmp(elKind, "variable") != 0) {
|
||||
if (!Equal(elKind, "variable")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue