From: Kim Nguyễn Date: Wed, 2 May 2012 12:24:36 +0000 (+0200) Subject: Don't flush the XML printing buffer if nothing was printed. X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Fxpathcomp.git;a=commitdiff_plain;h=4814ef8392dd9197a6bef7d7bc82be4c2b8e7f5d Don't flush the XML printing buffer if nothing was printed. --- diff --git a/src/nodeSet.ml b/src/nodeSet.ml index 944f85c..0828029 100644 --- a/src/nodeSet.ml +++ b/src/nodeSet.ml @@ -200,8 +200,10 @@ module Mat : S with type t = Tree.node mat = Unix.close in ignore (Unix.write fd "\n" 0 13); - iter (fun node -> Tree.print_xml v node fd) l; - Tree.flush v fd; + if l.length > 0 then begin + iter (fun node -> Tree.print_xml v node fd) l; + Tree.flush v fd; + end; ignore (Unix.write fd "\n" 0 14); finish fd