If $c would be used as a parameter name, rename it to $c_ to avoid issues
if call-time pass-by-reference is enabled and used. Use $c instead of $class to keep down the number of "reserved" parameter names. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11564 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e068305125
commit
e125ce326d
1 changed files with 6 additions and 4 deletions
|
|
@ -1392,9 +1392,11 @@ public:
|
|||
/* We use $r to store the return value, so disallow that as a parameter
|
||||
* name in case the user uses the "call-time pass-by-reference" feature
|
||||
* (it's deprecated and off by default in PHP5, but we want to be
|
||||
* maximally portable).
|
||||
* maximally portable). Similarly we use $c for the classname or new
|
||||
* stdClass object.
|
||||
*/
|
||||
Setattr(seen, "r", seen);
|
||||
Setattr(seen, "c", seen);
|
||||
|
||||
for (int argno = 0; argno < max_num_of_arguments; ++argno) {
|
||||
String *&pname = arg_names[argno];
|
||||
|
|
@ -1653,11 +1655,11 @@ public:
|
|||
Printf(output, "\t\tif (is_resource($r)) {\n");
|
||||
if (Getattr(classLookup(Getattr(n, "type")), "module")) {
|
||||
if (Len(prefix) == 0) {
|
||||
Printf(output, "\t\t\t$class=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n");
|
||||
Printf(output, "\t\t\t$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n");
|
||||
} else {
|
||||
Printf(output, "\t\t\t$class='%s'.substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n", prefix);
|
||||
Printf(output, "\t\t\t$c='%s'.substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));\n", prefix);
|
||||
}
|
||||
Printf(output, "\t\t\treturn new $class($r);\n");
|
||||
Printf(output, "\t\t\treturn new $c($r);\n");
|
||||
} else {
|
||||
Printf(output, "\t\t\t$c = new stdClass();\n");
|
||||
Printf(output, "\t\t\t$c->_cPtr = $r;\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue