Expand "$null" in typemaps in C backend too

This is used in some exception-related typemaps, both in SWIG itself
(although they're not used with C backend currently) and outside of it.
This commit is contained in:
Vadim Zeitlin 2021-10-07 17:29:04 +02:00
commit 45bb179407
2 changed files with 10 additions and 1 deletions

View file

@ -607,6 +607,10 @@ Finally, the return value variable is returned.
return result;
</pre></div>
Note that typemaps may use <tt>$null</tt> special variable which will be
replaced with either <tt>0</tt> or nothing, depending on whether the function
has a non-void return value or not.
<H4>The Proxy</H4>
Compared to the wrapper code generation, the header code is very simple.</br>
Basically it contains just the declarations corresponding to the definitions

View file

@ -1026,8 +1026,13 @@ public:
}
}
if (!is_void_return)
if (is_void_return) {
Replaceall(wrapper->code, "$null", "");
} else {
Replaceall(wrapper->code, "$null", "0");
Append(wrapper->code, "return result;\n");
}
Append(wrapper->code, "}\n");