add more missing Deletes, and cosmetics

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7062 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-03-14 23:25:04 +00:00
commit ec3f19d3fd
2 changed files with 26 additions and 12 deletions

View file

@ -959,6 +959,7 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
if (Swig_scopename_check(nname)) { if (Swig_scopename_check(nname)) {
s = symbol_lookup_qualified(nname,global_scope,0,0,0); s = symbol_lookup_qualified(nname,global_scope,0,0,0);
} }
Delete(nname);
} else { } else {
String *prefix = Swig_scopename_prefix(name); String *prefix = Swig_scopename_prefix(name);
if (prefix) { if (prefix) {

View file

@ -71,8 +71,11 @@ static void set_typemap(int tm_scope, SwigType* type, Hash* tm)
/* Printf(stderr,"settm %s %s\n", type, dtype);*/ /* Printf(stderr,"settm %s %s\n", type, dtype);*/
type = dtype; type = dtype;
Delete(ty); Delete(ty);
} else {
dtype = Copy(type);
type = dtype;
} }
Setattr(typemaps[tm_scope],Copy(type),tm); Setattr(typemaps[tm_scope],type,tm);
Delete(dtype); Delete(dtype);
} }
@ -113,6 +116,7 @@ static String *tmop_name(const String_or_char *op) {
if (s) return s; if (s) return s;
s = NewStringf("tmap:%s",op); s = NewStringf("tmap:%s",op);
Setattr(names,op_without_object_identity,s); Setattr(names,op_without_object_identity,s);
Delete(s);
return s; return s;
} }
@ -490,6 +494,8 @@ Swig_typemap_apply(ParmList *src, ParmList *dest) {
} }
ts--; ts--;
} }
Delete(ssig);
Delete(dsig);
return match; return match;
} }
@ -1209,18 +1215,23 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
pname = Getattr(node,"name"); pname = Getattr(node,"name");
#if 0 #if 0
/* removed for now as it breaks old code and introduces inconsistencies and adds about 25% to the execution time of the test-suite - WSF */ /* removed for now as it breaks old code and introduces
This is my plan to fix this longer term: inconsistencies and adds about 25% to the execution time of the
The following debug shows that some typemap lookups use fully qualified names and some do not. test-suite - WSF This is my plan to fix this longer term: The
following debug shows that some typemap lookups use fully qualified
names and some do not.
Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NONAME"); Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NONAME");
So even the current typemap lookups are inconsistent. So even the current typemap lookups are inconsistent. The "name"
The "name" attribute is often changed, particularly in lang.cxx. I hope to either remove this name changing to fix this or introduce attribute is often changed, particularly in lang.cxx. I hope to
a new attribute to use for the name. Possibly introduce a new attribute called fqname - fully qualified name, that holds the name either remove this name changing to fix this or introduce a new
to use for the Swig_typemap_search. If this typemap search fails then use the unqualified name. attribute to use for the name. Possibly introduce a new attribute
Need to check non-simple return types, eg pointers/references. called fqname - fully qualified name, that holds the name to use for
the Swig_typemap_search. If this typemap search fails then use the
unqualified name. Need to check non-simple return types, eg
pointers/references.
*/
st = Getattr(node,"sym:symtab"); st = Getattr(node,"sym:symtab");
qsn = st ? Swig_symbol_qualifiedscopename(st) : 0; qsn = st ? Swig_symbol_qualifiedscopename(st) : 0;
if (qsn && Len(qsn)) { if (qsn && Len(qsn)) {
@ -1693,7 +1704,6 @@ static void replace_embedded_typemap(String *s) {
/* Do the replacement */ /* Do the replacement */
Replace(s,tmp,tm, DOH_REPLACE_ANY); Replace(s,tmp,tm, DOH_REPLACE_ANY);
Delete(tm); Delete(tm);
Delete(vars);
match = 1; match = 1;
} }
} }
@ -1704,6 +1714,9 @@ static void replace_embedded_typemap(String *s) {
} }
} }
Replace(s,tmp,"<embedded typemap>", DOH_REPLACE_ANY); Replace(s,tmp,"<embedded typemap>", DOH_REPLACE_ANY);
Delete(vars);
Delete(tmp);
Delete(l);
} }
} }
} }