fix seg fault with simple typedef struct

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7651 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-14 13:36:12 +00:00
commit eb4f07711e
3 changed files with 13 additions and 1 deletions

View file

@ -290,6 +290,7 @@ CPP_TEST_CASES += \
typedef_mptr \
typedef_reference \
typedef_scope \
typedef_struct \
typemap_namespace \
typemap_ns_using \
typemap_numinputs \

View file

@ -0,0 +1,9 @@
%module typedef_struct
%inline {
typedef struct {
int numpoints;
} lineObj;
typedef lineObj multipointObj;
}

View file

@ -586,7 +586,9 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
*/
if (td1 && checkAttribute(td1,k_storage,k_typedef)) {
if (Strcmp(Getattr(td1,k_type), Getattr(td,k_name)) == 0) {
String *st = Getattr(td1,k_type);
String *sn = Getattr(td,k_name);
if (st && sn && (Strcmp(st, sn) == 0)) {
Symtab *sc = parentNode(current_symtab);
if (sc) td1 = Swig_symbol_clookup(type,sc);
}