From daeffe3f11f4cf2eabb7ab101e0597de005aa165 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 7 Dec 2003 23:47:35 +0000 Subject: don't save the intermediate form to disk unless we need to (This used to be commit 4e1a5a21a4c8da0d2a23d5ba02168eac1987c260) --- source4/build/pidl/pidl.pl | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'source4') diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index 4e79eb92f6..30dcde929a 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -90,6 +90,7 @@ sub process_file($) { my $idl_file = shift; my $output; + my $pidl; my $basename = basename($idl_file, ".idl"); @@ -104,47 +105,41 @@ sub process_file($) print "Compiling $idl_file\n"; if ($opt_parse) { - my($idl) = IdlParse($idl_file); - defined $idl || die "Failed to parse $idl_file"; - util::SaveStructure($pidl_file, $idl) || die "Failed to save $pidl_file"; - - IdlValidator::Validate($idl); + $pidl = IdlParse($idl_file); + defined $pidl || die "Failed to parse $idl_file"; + IdlValidator::Validate($pidl); + if ($opt_keep && !util::SaveStructure($pidl_file, $pidl)) { + die "Failed to save $pidl_file\n"; + } + } else { + $pidl = util::LoadStructure($pidl_file); } if ($opt_dump) { - my($idl) = util::LoadStructure($pidl_file); - print IdlDump::Dump($idl); + print IdlDump::Dump($pidl); } if ($opt_header) { - my($idl) = util::LoadStructure($pidl_file); my($header) = util::ChangeExtension($output, "h"); - util::FileSave($header, IdlHeader::Parse($idl)); + util::FileSave($header, IdlHeader::Parse($pidl)); } if ($opt_parser) { - my($idl) = util::LoadStructure($pidl_file); my($parser) = util::ChangeExtension($output, "c"); - IdlParser::Parse($idl, $parser); + IdlParser::Parse($pidl, $parser); } if ($opt_eparser) { - my($idl) = util::LoadStructure($pidl_file); my($parser) = util::ChangeExtension($output, "c"); - util::FileSave($parser, IdlEParser::Parse($idl)); + util::FileSave($parser, IdlEParser::Parse($pidl)); } if ($opt_diff) { - my($idl) = util::LoadStructure($pidl_file); my($tempfile) = util::ChangeExtension($output, "tmp"); - util::FileSave($tempfile, IdlDump::Dump($idl)); + util::FileSave($tempfile, IdlDump::Dump($pidl)); system("diff -wu $idl_file $tempfile"); unlink($tempfile); } - - if (!$opt_keep) { - system("rm -f $pidl_file"); - } } -- cgit