changeset 267:b9aa65a30b4c

treesum: optimize the use of flush() somewhat
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 18 Feb 2025 12:43:31 +0100
parents 0add8276e6b8
children 8aadffaaad5f
files cutils/treesum.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cutils/treesum.py	Tue Feb 18 12:39:04 2025 +0100
+++ b/cutils/treesum.py	Tue Feb 18 12:43:31 2025 +0100
@@ -690,7 +690,6 @@
                             util.interpolate_bytes(b"%s/./@/", opath),
                             linkdgst.digest(),
                             self._use_base64)
-                    self._writer.flush()
                 else:
                     #
                     # Follow the symlink to dir or handle a "real" directory
@@ -811,7 +810,6 @@
                             util.interpolate_bytes(b"%s/./@", opath),
                             linkdgst.digest(),
                             self._use_base64)
-                    self._writer.flush()
                 else:
                     #
                     # Follow the symlink to file or handle a "real" file
@@ -902,7 +900,7 @@
                                 self._algorithm[1], opath, dgst,
                                 use_base64=self._use_base64,
                                 size=sz)
-                self._writer.flush()
+            self._writer.flush()
         opath = join_output_path(top, None)
         if opath:
             if self._utf8_mode:
@@ -1119,6 +1117,7 @@
         crc = self._crc.hexdigest()
         self.write(b"CRC32 = ")
         self.writeln(util.b(crc))
+        self.flush()
 
     def writeln(self, line):
         """Write the bytes `line` into the output file and update the CRC