diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-05-21 15:35:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:19 -0500 |
commit | 03f520fd1232ef14eeb75af439685c6978db04e3 (patch) | |
tree | f55fdc860618597465ec893f33c6c0c01cc5fd7c /source4/pidl/lib/Parse/Pidl/Samba4/NDR | |
parent | ad9003b44835ea7702479a9493c63e5c69eee067 (diff) | |
download | samba-03f520fd1232ef14eeb75af439685c6978db04e3.tar.gz samba-03f520fd1232ef14eeb75af439685c6978db04e3.tar.bz2 samba-03f520fd1232ef14eeb75af439685c6978db04e3.zip |
r15780: Fix indentation of deferred code (fixed #3739)
(This used to be commit a7c9ec69b229db1b9c93b97133601231a2995c1b)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4/NDR')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 2797c6c490..77482685b7 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -103,7 +103,7 @@ sub get_value_of($) } my $res; -my $deferred = ""; +my $deferred = []; my $tabs = ""; #################################### @@ -128,14 +128,16 @@ sub pidl_hdr ($) { my $d = shift; $res_hdr .= "$d\n"; } # output buffer at the end of the structure/union/function # This is needed to cope with code that must be pushed back # to the end of a block of elements +my $defer_tabs = ""; +sub defer_indent() { $defer_tabs.="\t"; } +sub defer_deindent() { $defer_tabs=substr($defer_tabs, 0, -1); } + sub defer($) { my $d = shift; if ($d) { - $deferred .= $tabs; - $deferred .= $d; + push(@$deferred, $defer_tabs.$d); } - $deferred .="\n"; } ######################################## @@ -143,8 +145,9 @@ sub defer($) # output sub add_deferred() { - $res .= $deferred; - $deferred = ""; + pidl $_ foreach (@$deferred); + $deferred = []; + $defer_tabs = ""; } sub indent() @@ -370,16 +373,20 @@ sub ParseArrayPullHeader($$$$$) if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) { my $size = ParseExpr($l->{SIZE_IS}, $env); defer "if ($var_name) {"; + defer_indent; check_null_pointer_deferred($size); defer "NDR_CHECK(ndr_check_array_size(ndr, (void*)" . get_pointer_to($var_name) . ", $size));"; + defer_deindent; defer "}"; } if ($l->{IS_VARYING} and not $l->{IS_ZERO_TERMINATED}) { my $length = ParseExpr($l->{LENGTH_IS}, $env); defer "if ($var_name) {"; + defer_indent; check_null_pointer_deferred($length); defer "NDR_CHECK(ndr_check_array_length(ndr, (void*)" . get_pointer_to($var_name) . ", $length));"; + defer_deindent; defer "}" } |