add fail: label for the get methods always, just in case someone write a 'varout' typemap that need it

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8682 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-02 22:56:15 +00:00
commit 6c6d16529e
4 changed files with 12 additions and 24 deletions

View file

@ -2164,12 +2164,11 @@ public:
/* Create a function for getting the value of a variable */
Printf(getf->def,"SWIGINTERN PyObject *%s(void) {", getnamef);
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj = 0");
int addfail = 0;
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
Replaceall(tm,"$source",name);
Replaceall(tm,"$target","pyobj");
Replaceall(tm,"$result","pyobj");
addfail = emit_action_code(n, getf, tm);
emit_action_code(n, getf, tm);
Delete(tm);
} else {
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
@ -2177,10 +2176,8 @@ public:
}
Append(getf->code," return pyobj;\n");
if (addfail) {
Append(getf->code,"fail:\n");
Append(getf->code," return NULL;\n");
}
Append(getf->code,"fail:\n");
Append(getf->code," return NULL;\n");
Append(getf->code,"}\n");
Wrapper_print(getf,f_wrappers);