]> git.e2factory.org Git - e2factory.git/commitdiff
Disable tracing in parts of hash and eio module
authorTobias Ulmer <tu@emlix.com>
Thu, 24 Oct 2013 10:33:00 +0000 (12:33 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:01:23 +0000 (15:01 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/eio.lua
generic/hash.lua

index 88f4336e485145961ee65eb9ec24db2cd543d523..aba9017acfc6adc6c019a13a0c07755465eeec12 100644 (file)
@@ -33,6 +33,7 @@ local e2lib = require("e2lib")
 local err = require("err")
 local leio = require("leio")
 local strict = require("strict")
+local trace = require("trace")
 
 --- Numeric constant for stdin.
 eio.STDIN = 0;
@@ -205,23 +206,23 @@ end
 function eio.readline(file)
     local rc, re, line, char
 
-    --rc, re = is_eio_object(file)
-    --if not rc then
-    --    return false, rc
-    --end
+    trace.disable() -- don't spam the logs with fgetc calls.
 
     line = ""
     while true do
         char, re = eio.fgetc(file)
         if not char then
+            trace.enable()
             return false, re
         elseif char == "\0" then
             -- fgets cannot handle embedded zeros, causing mayhem in C.
             -- We could do this in Lua, but lets signal an error till
             -- we have a use case.
+            trace.enable()
             return false, err.new("got NUL character while reading line")
         elseif char == "\n" or char == "" then
             line = line..char -- retain newline just like fgets does.
+            trace.enable()
             return line
         end
 
index 530b2fb91be033ea8863ceb51565c59d05766307..c38457211ece10b07f95b4bea0da9089c9fec77e 100644 (file)
@@ -32,6 +32,7 @@
 local hash = {}
 local err = require("err")
 local strict = require("strict")
+local trace = require("trace")
 require("sha1")
 
 --- create a hash context
@@ -90,6 +91,8 @@ function hash.hash_file(hc, path)
         return nil, err.new("could not open file '%s'", path)
     end
 
+    trace.disable()
+
     local buf = ""
     while true do
         buf = fd:read(64*1024)
@@ -100,6 +103,8 @@ function hash.hash_file(hc, path)
         hash.hash_append(hc, buf)
     end
 
+    trace.enable()
+
     fd:close()
 
     return true