diff --git a/build_tools/code-generators/c_structdef_cg.pm b/build_tools/code-generators/c_structdef_cg.pm index 83163cf71..d1a283b72 100644 --- a/build_tools/code-generators/c_structdef_cg.pm +++ b/build_tools/code-generators/c_structdef_cg.pm @@ -161,11 +161,8 @@ sub printStructs() { my ($structList, $structMap, $enumMap) = @_; - my @structs = @{$structList}; - - while (@structs) + foreach my $struct (@{$structList}) { - my $struct = shift(@structs); my $name; my $prefix = ""; @@ -178,8 +175,7 @@ sub printStructs() $name = $prefix . $name; - print "} ${name};\n"; - print "\n" if @structs; + print "} ${name};\n\n"; } } @@ -212,7 +208,7 @@ sub endFile() { my ($name) = @_; - print "\n#endif // "; + print "#endif // "; printHdrGuard($name); print "\n"; } diff --git a/build_tools/code-generators/sql_selectdef_cg.pm b/build_tools/code-generators/sql_selectdef_cg.pm index fe7427ad3..204823374 100644 --- a/build_tools/code-generators/sql_selectdef_cg.pm +++ b/build_tools/code-generators/sql_selectdef_cg.pm @@ -124,12 +124,9 @@ sub printEnums() sub printStructs() { my ($structList, $structMap, $enumMap) = @_; - my @structs = @{$structList}; - while (@structs) + foreach my $struct (@{$structList}) { - my $struct = shift(@structs); - printComments(${$struct}{"comment"}, 0); # Start printing the select statement @@ -141,8 +138,7 @@ sub printStructs() printBaseStruct($struct, $structMap); printStructJoins($struct, $structMap); - print ";\n"; - print "\n" if @structs; + print ";\n\n"; } } diff --git a/build_tools/code-generators/sql_tabledef_cg.pm b/build_tools/code-generators/sql_tabledef_cg.pm index a081c6987..bc5f6e182 100644 --- a/build_tools/code-generators/sql_tabledef_cg.pm +++ b/build_tools/code-generators/sql_tabledef_cg.pm @@ -127,11 +127,8 @@ sub printStructs() { my ($structList, $structMap, $enumMap) = @_; - my @structs = @{$structList}; - - while (@structs) + foreach my $struct (@{$structList}) { - my $struct = shift(@structs); my $name = ${$struct}{"name"}; printComments(${$struct}{"comment"}, 0); @@ -141,8 +138,7 @@ sub printStructs() printStruct($struct, \$name, $structMap, $enumMap, 1); - print ");\n"; - print "\n" if @structs; + print ");\n\n"; } }