pidl:Samba3/ServerNDR: add pidl_reset() and pidl_return() helper functions
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Mar 2014 09:41:52 +0000 (10:41 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 7 Jul 2015 12:05:28 +0000 (14:05 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm

index 1bb0e3382bb0f1dc276aec7cc1e04a193a22e8f3..bae84af06714ca0ab2915a4087d6c7e1c8de6058 100644 (file)
@@ -24,6 +24,8 @@ $VERSION = '0.01';
 my $res;
 my $res_hdr;
 my $tabs = "";
+sub pidl_reset() { $res=""; $res_hdr="", $tabs=""; }
+sub pidl_return() { my $s = $res; my $h = $res_hdr; pidl_reset(); return ($s, $h) }
 sub indent() { $tabs.="\t"; }
 sub deindent() { $tabs = substr($tabs, 1); }
 sub pidl($) { my ($txt) = @_; $res .= $txt?$tabs.(shift)."\n":"\n"; }
@@ -297,8 +299,7 @@ sub Parse($$$)
 {
        my($ndr,$header,$ndr_header) = @_;
 
-       $res = "";
-       $res_hdr = "";
+       pidl_reset();
 
        pidl "/*";
        pidl " * Unix SMB/CIFS implementation.";
@@ -315,7 +316,7 @@ sub Parse($$$)
                ParseInterface($_) if ($_->{TYPE} eq "INTERFACE");
        }
 
-       return ($res, $res_hdr);
+       return pidl_return();
 }
 
 1;