From 4814ef8392dd9197a6bef7d7bc82be4c2b8e7f5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Nguy=E1=BB=85n?= Date: Wed, 2 May 2012 14:24:36 +0200 Subject: [PATCH] Don't flush the XML printing buffer if nothing was printed. --- src/nodeSet.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.17.1