Pass NULL instead of "" for name to SwigType_str()

Both have the same effect but "" takes a much more complicated code
path to achieve it.
This commit is contained in:
Olly Betts 2024-01-31 10:28:34 +13:00
parent 1cf7ef4c5d
commit 02b716ee29
3 changed files with 3 additions and 3 deletions

View File

@ -555,7 +555,7 @@ manipulate datatypes.
<li><tt>SwigType_str(SwigType *t, char *name)</tt>.<br>
This function produces the exact string
representation of the datatype <tt>t</tt>. <tt>name</tt> is an optional parameter that
specifies a declaration name. This is used when dealing with more complicated datatypes
specifies a declaration name and can be <tt>NULL</tt>. This is used when dealing with more complicated datatypes
such as arrays and pointers to functions where the output might look something like
"<tt>int (*name)(int, double)</tt>".

View File

@ -400,7 +400,7 @@ static std::string getPyDocType(Node *n, const_String_or_char_ptr lname = "") {
String *s = Swig_typemap_lookup("doctype", n, lname, 0);
if (!s) {
if (String *t = Getattr(n, "type"))
s = SwigType_str(t, "");
s = SwigType_str(t, NULL);
}
if (!s)

View File

@ -875,7 +875,7 @@ void Swig_replace_special_variables(Node *n, Node *parentnode, String *code) {
String *parentclassname = 0;
if (parentclass)
parentclassname = Getattr(parentclass, "name");
Replaceall(code, "$parentclassname", parentclassname ? SwigType_str(parentclassname, "") : "");
Replaceall(code, "$parentclassname", parentclassname ? SwigType_str(parentclassname, NULL) : "");
}
}