summaryrefslogtreecommitdiff
path: root/tools/pm/Output.pm
diff options
context:
space:
mode:
authorJosé Alburquerque <jaalburqu@svn.gnome.org>2012-09-26 00:26:02 -0400
committerJosé Alburquerque <jaalburqu@svn.gnome.org>2012-09-26 00:26:02 -0400
commite06484cfd320798bad86ae4363242dab4d7d644a (patch)
tree8d051c2f0141dc2a117b406fc41c486e6ccc13e7 /tools/pm/Output.pm
parent05f32bc5a51fe93bfc4ddb9e6ffbc7bb6af53dcb (diff)
downloadglibmm-e06484cfd320798bad86ae4363242dab4d7d644a.tar.gz
gmmproc: Make the output param feature work for single indirection.
* tools/pm/Output.pm (convert_args_cpp_to_c): When inserting C object initializations for C objects that will be used to set output parameters, initialize the C object to a "default constructed" object of the same type if there is single indirection and not zero to ensure successful compilation in that case. * tools/m4/method.m4: Whitespace correction of the body of generated non-static methods. This ensures each statement is on its own line and that there are no blank lines to make methods as compact as possible. Bug #662371.
Diffstat (limited to 'tools/pm/Output.pm')
-rw-r--r--tools/pm/Output.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 916b18cb..bd8fb80e 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -974,8 +974,20 @@ sub convert_args_cpp_to_c($$$$$)
# Remove a possible final '*' from the output parameter type because it
# will be passed by C reference (&name).
$cOutputParamType =~ s/\*$//;
+
+ # Only initialize pointers to zero. Otherwise, use the default
+ # constructor of the type.
+ my $initialization = "";
+ if($cOutputParamType =~ /\*$/)
+ {
+ $initialization = " = 0";
+ }
+ else
+ {
+ $initialization = " = $cOutputParamType()";
+ }
- push(@declarations, " $cOutputParamType $cOutputParamName = 0;");
+ push(@declarations, " $cOutputParamType $cOutputParamName$initialization;");
push(@conversions, "&" . $cOutputParamName);