more memory leaks fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7921 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7703b99b53
commit
34e0da0d4d
11 changed files with 112 additions and 94 deletions
|
|
@ -32,8 +32,7 @@ typedef struct swig_varlinkobject {
|
||||||
} swig_varlinkobject;
|
} swig_varlinkobject;
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
swig_varlink_repr(swig_varlinkobject *v) {
|
swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
|
||||||
v = v;
|
|
||||||
return PyString_FromString("<Swig global variables>");
|
return PyString_FromString("<Swig global variables>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN void
|
SWIGINTERN void
|
||||||
swig_varlink_delete(swig_varlinkobject *v) {
|
swig_varlink_dealloc(swig_varlinkobject *v) {
|
||||||
swig_globalvar *var = v->vars;
|
swig_globalvar *var = v->vars;
|
||||||
while (var) {
|
while (var) {
|
||||||
swig_globalvar *n = var->next;
|
swig_globalvar *n = var->next;
|
||||||
|
|
@ -102,7 +101,7 @@ swig_varlink_type(void) {
|
||||||
(char *)"swigvarlink", /* Type name (tp_name) */
|
(char *)"swigvarlink", /* Type name (tp_name) */
|
||||||
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
|
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
|
||||||
0, /* Itemsize (tp_itemsize) */
|
0, /* Itemsize (tp_itemsize) */
|
||||||
(destructor) swig_varlink_delete, /* Deallocator (tp_dealloc) */
|
(destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
|
||||||
(printfunc) swig_varlink_print, /* Print (tp_print) */
|
(printfunc) swig_varlink_print, /* Print (tp_print) */
|
||||||
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
|
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
|
||||||
(setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
|
(setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
|
||||||
|
|
|
||||||
|
|
@ -786,6 +786,7 @@ static void merge_extensions(Node *cls, Node *am) {
|
||||||
qargs = Swig_symbol_type_qualify(args,0);
|
qargs = Swig_symbol_type_qualify(args,0);
|
||||||
Append(prefix,qargs);
|
Append(prefix,qargs);
|
||||||
Delete(nname);
|
Delete(nname);
|
||||||
|
Delete(args);
|
||||||
Delete(qargs);
|
Delete(qargs);
|
||||||
nname = prefix;
|
nname = prefix;
|
||||||
}
|
}
|
||||||
|
|
@ -960,12 +961,14 @@ static String *resolve_node_scope(String *cname) {
|
||||||
if (nscope_inner) {
|
if (nscope_inner) {
|
||||||
if (Getattr(nscope_inner,"symtab") != Getattr(ns2,"symtab")) {
|
if (Getattr(nscope_inner,"symtab") != Getattr(ns2,"symtab")) {
|
||||||
appendChild(nscope_inner,ns2);
|
appendChild(nscope_inner,ns2);
|
||||||
|
Delete(ns2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nscope_inner = ns2;
|
nscope_inner = ns2;
|
||||||
if (!nscope) nscope = ns2;
|
if (!nscope) nscope = ns2;
|
||||||
}
|
}
|
||||||
cname = base;
|
cname = base;
|
||||||
|
Delete(scopes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
|
|
@ -1039,6 +1042,7 @@ static Node *dump_nested(const char *parent) {
|
||||||
add_symbols(retx);
|
add_symbols(retx);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
set_nextSibling(retx,ret);
|
set_nextSibling(retx,ret);
|
||||||
|
Delete(ret);
|
||||||
}
|
}
|
||||||
ret = retx;
|
ret = retx;
|
||||||
|
|
||||||
|
|
@ -1101,6 +1105,7 @@ static Node *dump_nested(const char *parent) {
|
||||||
Setattr(head,"code", code);
|
Setattr(head,"code", code);
|
||||||
Delete(code);
|
Delete(code);
|
||||||
set_nextSibling(head,ret);
|
set_nextSibling(head,ret);
|
||||||
|
Delete(ret);
|
||||||
ret = head;
|
ret = head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1230,7 +1235,9 @@ static void default_arguments(Node *n) {
|
||||||
SwigType *t = Getattr(p,"type");
|
SwigType *t = Getattr(p,"type");
|
||||||
if (Strcmp(t,"v(...)") == 0) {
|
if (Strcmp(t,"v(...)") == 0) {
|
||||||
if (pp) {
|
if (pp) {
|
||||||
set_nextSibling(pp,Copy(varargs));
|
ParmList *cv = Copy(varargs);
|
||||||
|
set_nextSibling(pp,cv);
|
||||||
|
Delete(cv);
|
||||||
} else {
|
} else {
|
||||||
ParmList *cv = Copy(varargs);
|
ParmList *cv = Copy(varargs);
|
||||||
Setattr(function,"parms", cv);
|
Setattr(function,"parms", cv);
|
||||||
|
|
@ -1333,7 +1340,7 @@ static void default_arguments(Node *n) {
|
||||||
|
|
||||||
/* Point to the new function, extending the linked list */
|
/* Point to the new function, extending the linked list */
|
||||||
set_nextSibling(function, new_function);
|
set_nextSibling(function, new_function);
|
||||||
|
Delete(new_function);
|
||||||
function = new_function;
|
function = new_function;
|
||||||
|
|
||||||
Delete(ntype);
|
Delete(ntype);
|
||||||
|
|
@ -1505,7 +1512,8 @@ program : interface {
|
||||||
top = $1;
|
top = $1;
|
||||||
}
|
}
|
||||||
| PARSETYPE parm SEMI {
|
| PARSETYPE parm SEMI {
|
||||||
top = Getattr($2,"type");
|
top = Copy(Getattr($2,"type"));
|
||||||
|
Delete($2);
|
||||||
}
|
}
|
||||||
| PARSETYPE error {
|
| PARSETYPE error {
|
||||||
top = 0;
|
top = 0;
|
||||||
|
|
@ -1895,6 +1903,7 @@ include_directive: includetype options string LBRACKET {
|
||||||
Node *mnode = new_node("module");
|
Node *mnode = new_node("module");
|
||||||
Setattr(mnode,"name", mname);
|
Setattr(mnode,"name", mname);
|
||||||
appendChild(nint,mnode);
|
appendChild(nint,mnode);
|
||||||
|
Delete(mnode);
|
||||||
appendChild(nint,firstChild($$));
|
appendChild(nint,firstChild($$));
|
||||||
$$ = nint;
|
$$ = nint;
|
||||||
Setattr($$,"module",mname);
|
Setattr($$,"module",mname);
|
||||||
|
|
@ -2325,6 +2334,7 @@ varargs_parms : parms { $$ = $1; }
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = Copy($3);
|
p = Copy($3);
|
||||||
set_nextSibling(p,$$);
|
set_nextSibling(p,$$);
|
||||||
|
Delete($$);
|
||||||
$$ = p;
|
$$ = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2695,6 +2705,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
/* non-global namespace */
|
/* non-global namespace */
|
||||||
if (templnode) {
|
if (templnode) {
|
||||||
appendChild(nscope_inner,templnode);
|
appendChild(nscope_inner,templnode);
|
||||||
|
Delete(templnode);
|
||||||
if (nscope) $$ = nscope;
|
if (nscope) $$ = nscope;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2703,6 +2714,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
$$ = templnode;
|
$$ = templnode;
|
||||||
} else {
|
} else {
|
||||||
set_nextSibling(linklistend,templnode);
|
set_nextSibling(linklistend,templnode);
|
||||||
|
Delete(templnode);
|
||||||
}
|
}
|
||||||
linklistend = templnode;
|
linklistend = templnode;
|
||||||
}
|
}
|
||||||
|
|
@ -2814,7 +2826,9 @@ c_decl : storage_class type declarator initializer c_decl_tail {
|
||||||
if (p) {
|
if (p) {
|
||||||
if ((Namespaceprefix && Strcmp(p,Namespaceprefix) == 0) ||
|
if ((Namespaceprefix && Strcmp(p,Namespaceprefix) == 0) ||
|
||||||
(inclass && Strcmp(p,Classprefix) == 0)) {
|
(inclass && Strcmp(p,Classprefix) == 0)) {
|
||||||
Setattr($$,"name",Swig_scopename_last($3.id));
|
String *lstr = Swig_scopename_last($3.id);
|
||||||
|
Setattr($$,"name",lstr);
|
||||||
|
Delete(lstr);
|
||||||
set_nextSibling($$,$5);
|
set_nextSibling($$,$5);
|
||||||
} else {
|
} else {
|
||||||
Delete($$);
|
Delete($$);
|
||||||
|
|
@ -2993,6 +3007,7 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI {
|
||||||
|
|
||||||
add_symbols($$); /* Add enum to tag space */
|
add_symbols($$); /* Add enum to tag space */
|
||||||
set_nextSibling($$,n);
|
set_nextSibling($$,n);
|
||||||
|
Delete(n);
|
||||||
|
|
||||||
add_symbols($5); /* Add enum values to id space */
|
add_symbols($5); /* Add enum values to id space */
|
||||||
add_symbols(n);
|
add_symbols(n);
|
||||||
|
|
@ -3236,6 +3251,7 @@ cpp_class_decl :
|
||||||
Setattr(pa,"kind","public");
|
Setattr(pa,"kind","public");
|
||||||
cplus_mode = CPLUS_PUBLIC;
|
cplus_mode = CPLUS_PUBLIC;
|
||||||
appendChild($$,pa);
|
appendChild($$,pa);
|
||||||
|
Delete(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
Setattr($$,"symtab",Swig_symbol_popscope());
|
Setattr($$,"symtab",Swig_symbol_popscope());
|
||||||
|
|
@ -3321,6 +3337,7 @@ cpp_class_decl :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_nextSibling($$,n);
|
set_nextSibling($$,n);
|
||||||
|
Delete(n);
|
||||||
{
|
{
|
||||||
/* If a proper typedef name was given, we'll use it to set the scope name */
|
/* If a proper typedef name was given, we'll use it to set the scope name */
|
||||||
String *name = 0;
|
String *name = 0;
|
||||||
|
|
@ -3584,6 +3601,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
||||||
Delete(rtt);
|
Delete(rtt);
|
||||||
Delete(ttr);
|
Delete(ttr);
|
||||||
}
|
}
|
||||||
|
Delete(tparms);
|
||||||
Append(ffname,")>");
|
Append(ffname,")>");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -3591,6 +3609,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
||||||
if (!partials) {
|
if (!partials) {
|
||||||
partials = NewList();
|
partials = NewList();
|
||||||
Setattr(tempn,"partials",partials);
|
Setattr(tempn,"partials",partials);
|
||||||
|
Delete(partials);
|
||||||
}
|
}
|
||||||
/* Printf(stdout,"partial: fname = '%s', '%s'\n", fname, Swig_symbol_typedef_reduce(fname,0)); */
|
/* Printf(stdout,"partial: fname = '%s', '%s'\n", fname, Swig_symbol_typedef_reduce(fname,0)); */
|
||||||
Append(partials,ffname);
|
Append(partials,ffname);
|
||||||
|
|
@ -5388,9 +5407,15 @@ base_list : base_specifier {
|
||||||
Hash *list = NewHash();
|
Hash *list = NewHash();
|
||||||
Node *base = $1;
|
Node *base = $1;
|
||||||
Node *name = Getattr(base,"name");
|
Node *name = Getattr(base,"name");
|
||||||
Setattr(list,"public",NewList());
|
List *lpublic = NewList();
|
||||||
Setattr(list,"protected",NewList());
|
List *lprotected = NewList();
|
||||||
Setattr(list,"private",NewList());
|
List *lprivate = NewList();
|
||||||
|
Setattr(list,"public",lpublic);
|
||||||
|
Setattr(list,"protected",lprotected);
|
||||||
|
Setattr(list,"private",lprivate);
|
||||||
|
Delete(lpublic);
|
||||||
|
Delete(lprotected);
|
||||||
|
Delete(lprivate);
|
||||||
Append(Getattr(list,Getattr(base,"access")),name);
|
Append(Getattr(list,Getattr(base,"access")),name);
|
||||||
$$ = list;
|
$$ = list;
|
||||||
}
|
}
|
||||||
|
|
@ -5742,6 +5767,7 @@ Parm *Swig_cparse_parm(String *s) {
|
||||||
scanner_next_token(PARSEPARM);
|
scanner_next_token(PARSEPARM);
|
||||||
yyparse();
|
yyparse();
|
||||||
/* Printf(stdout,"typeparse: '%s' ---> '%s'\n", s, top); */
|
/* Printf(stdout,"typeparse: '%s' ---> '%s'\n", s, top); */
|
||||||
|
Delete(ns);
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ void Swig_cparse_replace_descriptor(String *s) {
|
||||||
Replace(s,tmp,descriptor,DOH_REPLACE_ANY);
|
Replace(s,tmp,descriptor,DOH_REPLACE_ANY);
|
||||||
Delete(mangle);
|
Delete(mangle);
|
||||||
Delete(descriptor);
|
Delete(descriptor);
|
||||||
|
Delete(t);
|
||||||
} else {
|
} else {
|
||||||
Swig_error(Getfile(s),Getline(s),"Bad $descriptor() macro.\n");
|
Swig_error(Getfile(s),Getline(s),"Bad $descriptor() macro.\n");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -115,11 +115,10 @@ DohObjMalloc(DohObjInfo *type, void *data) {
|
||||||
FreeList = (DohBase *) obj->data;
|
FreeList = (DohBase *) obj->data;
|
||||||
} else {
|
} else {
|
||||||
while (Pools->current == Pools->len) {
|
while (Pools->current == Pools->len) {
|
||||||
PoolSize *= 2;
|
|
||||||
CreatePool();
|
CreatePool();
|
||||||
}
|
}
|
||||||
obj = Pools->ptr + Pools->current;
|
obj = Pools->ptr + Pools->current;
|
||||||
Pools->current++;
|
++Pools->current;
|
||||||
}
|
}
|
||||||
obj->type = type;
|
obj->type = type;
|
||||||
obj->data = data;
|
obj->data = data;
|
||||||
|
|
|
||||||
|
|
@ -295,9 +295,10 @@ String_insert(DOH *so, int pos, DOH *str)
|
||||||
|
|
||||||
/* See if there is room to insert the new data */
|
/* See if there is room to insert the new data */
|
||||||
while (s->maxsize <= s->len+len) {
|
while (s->maxsize <= s->len+len) {
|
||||||
s->str = (char *) DohRealloc(s->str,2*s->maxsize);
|
int newsize = 2*s->maxsize;
|
||||||
|
s->str = (char *) DohRealloc(s->str,newsize);
|
||||||
assert(s->str);
|
assert(s->str);
|
||||||
s->maxsize *= 2;
|
s->maxsize = newsize;
|
||||||
}
|
}
|
||||||
memmove(s->str+pos+len, s->str+pos, (s->len - pos));
|
memmove(s->str+pos+len, s->str+pos, (s->len - pos));
|
||||||
memcpy(s->str+pos,data,len);
|
memcpy(s->str+pos,data,len);
|
||||||
|
|
@ -502,31 +503,27 @@ String_tell(DOH *so)
|
||||||
int
|
int
|
||||||
DohString_putc(DOH *so, int ch)
|
DohString_putc(DOH *so, int ch)
|
||||||
{
|
{
|
||||||
register int len, maxsize, sp;
|
|
||||||
String *s = (String *) ObjData(so);
|
String *s = (String *) ObjData(so);
|
||||||
|
register int len = s->len;
|
||||||
|
register int sp = s->sp;
|
||||||
s->hashkey = -1;
|
s->hashkey = -1;
|
||||||
len = s->len;
|
|
||||||
sp = s->sp;
|
|
||||||
if (sp >= len) {
|
if (sp >= len) {
|
||||||
register char *tc;
|
register size_t maxsize = s->maxsize;
|
||||||
maxsize = s->maxsize;
|
register char *tc = s->str;
|
||||||
if (len > (maxsize-2)) {
|
if (len > (maxsize-2)) {
|
||||||
s->str = (char *) DohRealloc(s->str,2*maxsize);
|
maxsize *= 2;
|
||||||
assert(s->str);
|
tc = (char *) DohRealloc(tc, maxsize);
|
||||||
s->maxsize = 2*maxsize;
|
assert(tc);
|
||||||
|
s->maxsize = (int)maxsize;
|
||||||
|
s->str = tc;
|
||||||
}
|
}
|
||||||
tc = s->str + len;
|
tc += sp;
|
||||||
*(tc++) = ch;
|
*tc = (char) ch; *(++tc) = 0;
|
||||||
if (sp >= len) {
|
s->len = s->sp = sp + 1;
|
||||||
s->sp = len+1;
|
|
||||||
*tc = 0;
|
|
||||||
if (ch == '\n') s->line++;
|
|
||||||
}
|
|
||||||
s->len = len+1;
|
|
||||||
} else {
|
} else {
|
||||||
s->str[s->sp++] = (char) ch;
|
s->str[s->sp++] = (char) ch;
|
||||||
if (ch == '\n') s->line++;
|
|
||||||
}
|
}
|
||||||
|
if (ch == '\n') s->line++;
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,7 +540,7 @@ DohString_getc(DOH *so)
|
||||||
c = EOF;
|
c = EOF;
|
||||||
else
|
else
|
||||||
c = (int) s->str[s->sp++];
|
c = (int) s->str[s->sp++];
|
||||||
if (c == '\n') s->line++;
|
if (c == '\n') s->line--;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -558,7 +555,7 @@ DohString_ungetc(DOH *so, int ch)
|
||||||
if (ch == EOF) return ch;
|
if (ch == EOF) return ch;
|
||||||
if (s->sp <= 0) return EOF;
|
if (s->sp <= 0) return EOF;
|
||||||
s->sp--;
|
s->sp--;
|
||||||
if (ch == '\n') s->line--;
|
if (ch == '\n') s->line++;
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1220,29 +1220,15 @@ public:
|
||||||
|
|
||||||
if (!allow_kwargs || Getattr(n,"sym:overloaded")) {
|
if (!allow_kwargs || Getattr(n,"sym:overloaded")) {
|
||||||
if (!varargs) {
|
if (!varargs) {
|
||||||
if (CPlusPlus) {
|
Printv(f->def,
|
||||||
Printv(f->def,
|
"SWIGINTERN PyObject *", wname,
|
||||||
"SWIGINTERN PyObject *", wname,
|
"(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {",
|
||||||
"(PyObject *, PyObject *args) {",
|
NIL);
|
||||||
NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f->def,
|
|
||||||
"SWIGINTERN PyObject *", wname,
|
|
||||||
"(PyObject *self, PyObject *args) {",
|
|
||||||
NIL);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (CPlusPlus) {
|
Printv(f->def,
|
||||||
Printv(f->def,
|
"SWIGINTERN PyObject *", wname, "__varargs__",
|
||||||
"SWIGINTERN PyObject *", wname, "__varargs__",
|
"(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *varargs) {",
|
||||||
"(PyObject *, PyObject *args, PyObject *varargs) {",
|
NIL);
|
||||||
NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f->def,
|
|
||||||
"SWIGINTERN PyObject *", wname, "__varargs__",
|
|
||||||
"(PyObject *self, PyObject *args, PyObject *varargs) {",
|
|
||||||
NIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (allow_kwargs) {
|
if (allow_kwargs) {
|
||||||
Swig_warning(WARN_LANG_OVERLOAD_KEYWORD, input_file, line_number,
|
Swig_warning(WARN_LANG_OVERLOAD_KEYWORD, input_file, line_number,
|
||||||
|
|
@ -1255,17 +1241,10 @@ public:
|
||||||
"Can't wrap varargs with keyword arguments enabled\n");
|
"Can't wrap varargs with keyword arguments enabled\n");
|
||||||
varargs = 0;
|
varargs = 0;
|
||||||
}
|
}
|
||||||
if (CPlusPlus) {
|
Printv(f->def,
|
||||||
Printv(f->def,
|
"SWIGINTERN PyObject *", wname,
|
||||||
"SWIGINTERN PyObject *", wname,
|
"(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {",
|
||||||
"(PyObject *, PyObject *args, PyObject *kwargs) {",
|
NIL);
|
||||||
NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f->def,
|
|
||||||
"SWIGINTERN PyObject *", wname,
|
|
||||||
"(PyObject *self, PyObject *args, PyObject *kwargs) {",
|
|
||||||
NIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!allow_kwargs) {
|
if (!allow_kwargs) {
|
||||||
Printf(parse_args," if(!PyArg_ParseTuple(args,(char *)\"");
|
Printf(parse_args," if(!PyArg_ParseTuple(args,(char *)\"");
|
||||||
|
|
@ -1549,6 +1528,7 @@ public:
|
||||||
if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
|
if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
|
||||||
Replaceall(tm,"$source","result");
|
Replaceall(tm,"$source","result");
|
||||||
Printf(f->code,"%s\n",tm);
|
Printf(f->code,"%s\n",tm);
|
||||||
|
Delete(tm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1556,6 +1536,7 @@ public:
|
||||||
if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) {
|
if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) {
|
||||||
Replaceall(tm,"$source","result");
|
Replaceall(tm,"$source","result");
|
||||||
Printf(f->code,"%s\n",tm);
|
Printf(f->code,"%s\n",tm);
|
||||||
|
Delete(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (director_method) {
|
if (director_method) {
|
||||||
|
|
@ -2158,13 +2139,8 @@ public:
|
||||||
{
|
{
|
||||||
SwigType *ct = NewStringf("p.%s", real_classname);
|
SwigType *ct = NewStringf("p.%s", real_classname);
|
||||||
SwigType_remember(ct);
|
SwigType_remember(ct);
|
||||||
if (CPlusPlus) {
|
Printv(f_wrappers,
|
||||||
Printv(f_wrappers,
|
"SWIGINTERN PyObject * ", class_name, "_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
|
||||||
"SWIGINTERN PyObject * ", class_name, "_swigregister(PyObject *, PyObject *args) {\n", NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f_wrappers,
|
|
||||||
"SWIGINTERN PyObject * ", class_name, "_swigregister(PyObject *self SWIGUNUSED, PyObject *args) {\n", NIL);
|
|
||||||
}
|
|
||||||
Printv(f_wrappers,
|
Printv(f_wrappers,
|
||||||
tab4, "PyObject *obj;\n",
|
tab4, "PyObject *obj;\n",
|
||||||
tab4, "if (!PyArg_UnpackTuple(args,(char*)\"swigregister\", 1, 1,&obj)) return NULL;\n",
|
tab4, "if (!PyArg_UnpackTuple(args,(char*)\"swigregister\", 1, 1,&obj)) return NULL;\n",
|
||||||
|
|
@ -2297,6 +2273,7 @@ public:
|
||||||
Replaceall(pycode,"$action", pyaction);
|
Replaceall(pycode,"$action", pyaction);
|
||||||
Delete(pyaction);
|
Delete(pyaction);
|
||||||
Printv(f_shadow,pycode,"\n",NIL);
|
Printv(f_shadow,pycode,"\n",NIL);
|
||||||
|
Delete(pycode);
|
||||||
} else {
|
} else {
|
||||||
if (!have_addtofunc(n)) {
|
if (!have_addtofunc(n)) {
|
||||||
if (!allow_kwargs) {
|
if (!allow_kwargs) {
|
||||||
|
|
@ -2428,6 +2405,7 @@ public:
|
||||||
Replaceall(pycode,"$action", pyaction);
|
Replaceall(pycode,"$action", pyaction);
|
||||||
Delete(pyaction);
|
Delete(pyaction);
|
||||||
Printv(f_shadow,pycode,"\n",NIL);
|
Printv(f_shadow,pycode,"\n",NIL);
|
||||||
|
Delete(pycode);
|
||||||
} else {
|
} else {
|
||||||
String *pass_self = NewString("");
|
String *pass_self = NewString("");
|
||||||
Node *parent = Swig_methodclass(n);
|
Node *parent = Swig_methodclass(n);
|
||||||
|
|
@ -2482,6 +2460,7 @@ public:
|
||||||
Replaceall(pycode,"$action", pyaction);
|
Replaceall(pycode,"$action", pyaction);
|
||||||
Delete(pyaction);
|
Delete(pyaction);
|
||||||
Printv(f_shadow_stubs,pycode,"\n",NIL);
|
Printv(f_shadow_stubs,pycode,"\n",NIL);
|
||||||
|
Delete(pycode);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Printv(f_shadow_stubs, "\ndef ", symname, "(*args",
|
Printv(f_shadow_stubs, "\ndef ", symname, "(*args",
|
||||||
|
|
@ -2524,6 +2503,7 @@ public:
|
||||||
Replaceall(pycode, "$action", pyaction);
|
Replaceall(pycode, "$action", pyaction);
|
||||||
Delete(pyaction);
|
Delete(pyaction);
|
||||||
Printv(f_shadow,pycode,"\n", NIL);
|
Printv(f_shadow,pycode,"\n", NIL);
|
||||||
|
Delete(pycode);
|
||||||
} else {
|
} else {
|
||||||
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(symname), "\n", NIL);
|
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(symname), "\n", NIL);
|
||||||
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
|
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
|
||||||
|
|
|
||||||
|
|
@ -1317,6 +1317,7 @@ public:
|
||||||
#else
|
#else
|
||||||
Printf(f->code,"%s\n", tm);
|
Printf(f->code,"%s\n", tm);
|
||||||
#endif
|
#endif
|
||||||
|
Delete(tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
|
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
|
||||||
"Unable to use return type %s.\n", SwigType_str(t,0));
|
"Unable to use return type %s.\n", SwigType_str(t,0));
|
||||||
|
|
@ -1352,6 +1353,7 @@ public:
|
||||||
if (tm) {
|
if (tm) {
|
||||||
Replaceall(tm,"$source","result");
|
Replaceall(tm,"$source","result");
|
||||||
Printv(f->code,tm, "\n",NIL);
|
Printv(f->code,tm, "\n",NIL);
|
||||||
|
Delete(tm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1360,6 +1362,7 @@ public:
|
||||||
if (tm) {
|
if (tm) {
|
||||||
Replaceall(tm,"$source","result");
|
Replaceall(tm,"$source","result");
|
||||||
Printv(f->code,tm, NIL);
|
Printv(f->code,tm, NIL);
|
||||||
|
Delete(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (director_method) {
|
if (director_method) {
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,6 @@ SwigType *SwigType_default(SwigType *t) {
|
||||||
|
|
||||||
r = Getattr(default_cache,t);
|
r = Getattr(default_cache,t);
|
||||||
if (r) {
|
if (r) {
|
||||||
if (Strcmp(r,t) == 0) return 0;
|
|
||||||
return Copy(r);
|
return Copy(r);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -467,17 +466,20 @@ SwigType *SwigType_default(SwigType *t) {
|
||||||
def = NewString("SWIGTYPE");
|
def = NewString("SWIGTYPE");
|
||||||
}
|
}
|
||||||
if (r != t) Delete(r);
|
if (r != t) Delete(r);
|
||||||
#ifdef SWIG_DEFAULT_CACHE
|
|
||||||
/* The cache produces strange results, see enum_template.i case */
|
|
||||||
cdef = Copy(def);
|
|
||||||
Setattr(default_cache,t, cdef);
|
|
||||||
Delete(cdef);
|
|
||||||
#endif
|
|
||||||
if (StringEqual(def,t)) {
|
if (StringEqual(def,t)) {
|
||||||
Delete(def);
|
Delete(def);
|
||||||
def = 0;
|
def = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SWIG_DEFAULT_CACHE
|
||||||
|
/* The cache produces strange results, see enum_template.i case */
|
||||||
|
if (def) {
|
||||||
|
cdef = Copy(def);
|
||||||
|
Setattr(default_cache,t, cdef);
|
||||||
|
Delete(cdef);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Printf(stderr,"type : def %s : %s\n", t, def); */
|
/* Printf(stderr,"type : def %s : %s\n", t, def); */
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
|
||||||
|
|
@ -1111,10 +1111,12 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
||||||
if ((argnum >= 0) && (!isglobal)) {
|
if ((argnum >= 0) && (!isglobal)) {
|
||||||
Printf(str,"%s%d",pn,argnum);
|
Printf(str,"%s%d",pn,argnum);
|
||||||
} else {
|
} else {
|
||||||
Printf(str,"%s",pn);
|
StringAppend(str,pn);
|
||||||
}
|
}
|
||||||
if (isglobal && Wrapper_check_local(f,str)) {
|
if (isglobal && Wrapper_check_local(f,str)) {
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
|
Delete(str);
|
||||||
|
if (at) Delete(at);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -1134,7 +1136,7 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
Delete(at);
|
if (at) Delete(at);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1156,7 +1158,11 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_
|
||||||
if (!tm) return 0;
|
if (!tm) return 0;
|
||||||
|
|
||||||
s = Getattr(tm,k_code);
|
s = Getattr(tm,k_code);
|
||||||
if (!s) return 0;
|
if (!s) {
|
||||||
|
if (mtype) Delete(mtype);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Blocked */
|
/* Blocked */
|
||||||
if (Cmp(s,"pass") == 0) {
|
if (Cmp(s,"pass") == 0) {
|
||||||
|
|
@ -1342,7 +1348,7 @@ Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NO
|
||||||
if (type) {
|
if (type) {
|
||||||
SwigType *rtype = SwigType_typedef_resolve_all(type);
|
SwigType *rtype = SwigType_typedef_resolve_all(type);
|
||||||
String *mangle = Swig_string_mangle(rtype);
|
String *mangle = Swig_string_mangle(rtype);
|
||||||
Printf(value,"%s",mangle);
|
StringAppend(value,mangle);
|
||||||
Delete(mangle);
|
Delete(mangle);
|
||||||
Delete(rtype);
|
Delete(rtype);
|
||||||
}
|
}
|
||||||
|
|
@ -1678,6 +1684,8 @@ static void replace_embedded_typemap(String *s) {
|
||||||
Insert(n,0,"$");
|
Insert(n,0,"$");
|
||||||
Setattr(vars,n,v);
|
Setattr(vars,n,v);
|
||||||
}
|
}
|
||||||
|
Delete(n);
|
||||||
|
Delete(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
method = Getitem(l,0);
|
method = Getitem(l,0);
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,7 @@ SwigType_inherit_scope(Typetab *scope) {
|
||||||
if (!inherits) {
|
if (!inherits) {
|
||||||
inherits = NewList();
|
inherits = NewList();
|
||||||
Setattr(current_scope,k_inherit, inherits);
|
Setattr(current_scope,k_inherit, inherits);
|
||||||
|
Delete(inherits);
|
||||||
}
|
}
|
||||||
assert(scope != current_scope);
|
assert(scope != current_scope);
|
||||||
|
|
||||||
|
|
@ -338,6 +339,7 @@ SwigType_using_scope(Typetab *scope) {
|
||||||
if (!ulist) {
|
if (!ulist) {
|
||||||
ulist = NewList();
|
ulist = NewList();
|
||||||
Setattr(current_scope,k_using, ulist);
|
Setattr(current_scope,k_using, ulist);
|
||||||
|
Delete(ulist);
|
||||||
}
|
}
|
||||||
assert(scope != current_scope);
|
assert(scope != current_scope);
|
||||||
len = Len(ulist);
|
len = Len(ulist);
|
||||||
|
|
@ -1645,6 +1647,7 @@ SwigType_inherit(String *derived, String *base, String *cast) {
|
||||||
if (!h) {
|
if (!h) {
|
||||||
h = NewHash();
|
h = NewHash();
|
||||||
Setattr(subclass,base,h);
|
Setattr(subclass,base,h);
|
||||||
|
Delete(h);
|
||||||
}
|
}
|
||||||
if (!Getattr(h,derived)) {
|
if (!Getattr(h,derived)) {
|
||||||
Setattr(h,derived, cast ? cast : (void *) "");
|
Setattr(h,derived, cast ? cast : (void *) "");
|
||||||
|
|
@ -1789,6 +1792,7 @@ void SwigType_inherit_equiv(File *out) {
|
||||||
bk = Next(bk);
|
bk = Next(bk);
|
||||||
}
|
}
|
||||||
rk = Next(rk);
|
rk = Next(rk);
|
||||||
|
Delete(rlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ Wrapper_pretty_print(String *str, File *f) {
|
||||||
|
|
||||||
ts = NewStringEmpty();
|
ts = NewStringEmpty();
|
||||||
Seek(str,0, SEEK_SET);
|
Seek(str,0, SEEK_SET);
|
||||||
Clear(ts);
|
|
||||||
while ((c = Getc(str)) != EOF) {
|
while ((c = Getc(str)) != EOF) {
|
||||||
if (c == '\"') {
|
if (c == '\"') {
|
||||||
Putc(c,ts);
|
Putc(c,ts);
|
||||||
|
|
@ -222,8 +221,6 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
ts = NewStringEmpty();
|
ts = NewStringEmpty();
|
||||||
tf = NewStringEmpty();
|
tf = NewStringEmpty();
|
||||||
Seek(str,0, SEEK_SET);
|
Seek(str,0, SEEK_SET);
|
||||||
Clear(ts);
|
|
||||||
Clear(tf);
|
|
||||||
|
|
||||||
while ((c = Getc(str)) != EOF) {
|
while ((c = Getc(str)) != EOF) {
|
||||||
if (c == '\"') { /* string 1 */
|
if (c == '\"') { /* string 1 */
|
||||||
|
|
@ -263,7 +260,7 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
for (i = 0; i < level; i++)
|
for (i = 0; i < level; i++)
|
||||||
Putc(' ',tf);
|
Putc(' ',tf);
|
||||||
}
|
}
|
||||||
Printf(tf,"%s",ts);
|
Append(tf,ts);
|
||||||
Clear(ts);
|
Clear(ts);
|
||||||
level+=indent;
|
level+=indent;
|
||||||
while ((c = Getc(str)) != EOF) {
|
while ((c = Getc(str)) != EOF) {
|
||||||
|
|
@ -286,7 +283,7 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
for (i = 0; i < level; i++)
|
for (i = 0; i < level; i++)
|
||||||
Putc(' ',tf);
|
Putc(' ',tf);
|
||||||
}
|
}
|
||||||
Printf(tf, "%s", ts);
|
Append(tf, ts);
|
||||||
Putc(c, tf);
|
Putc(c, tf);
|
||||||
Clear(ts);
|
Clear(ts);
|
||||||
level-=indent;
|
level-=indent;
|
||||||
|
|
@ -312,7 +309,7 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
for (i = 0; i < level; i++)
|
for (i = 0; i < level; i++)
|
||||||
Putc(' ',tf);
|
Putc(' ',tf);
|
||||||
}
|
}
|
||||||
Printf(tf,"%s",ts);
|
Append(tf,ts);
|
||||||
Clear(ts);
|
Clear(ts);
|
||||||
}
|
}
|
||||||
Ungetc(c,str);
|
Ungetc(c,str);
|
||||||
|
|
@ -356,9 +353,9 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
Printf(tf,"\n");
|
Append(tf,"\n");
|
||||||
}
|
}
|
||||||
Printf(tf,"%s",ts);
|
Append(tf,ts);
|
||||||
Printf(f, "%s", tf);
|
Printf(f, "%s", tf);
|
||||||
Clear(tf);
|
Clear(tf);
|
||||||
Clear(ts);
|
Clear(ts);
|
||||||
|
|
@ -373,7 +370,7 @@ Wrapper_compact_print(String *str, File *f) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
Printf(tf,"%s",ts);
|
Append(tf,ts);
|
||||||
}
|
}
|
||||||
if (Len(tf) != 0)
|
if (Len(tf) != 0)
|
||||||
Printf(f,"%s",tf);
|
Printf(f,"%s",tf);
|
||||||
|
|
@ -400,6 +397,8 @@ Wrapper_print(Wrapper *w, File *f) {
|
||||||
Wrapper_compact_print(str,f);
|
Wrapper_compact_print(str,f);
|
||||||
else
|
else
|
||||||
Wrapper_pretty_print(str,f);
|
Wrapper_pretty_print(str,f);
|
||||||
|
|
||||||
|
Delete(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue