From 4e0902a4b8a7a492811fed4776e15777d1780f5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Fri, 5 Nov 2010 16:27:37 +0100
Subject: Simplify handlers (list never empty)

---
 luatexbase-mcb.dtx | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

(limited to 'luatexbase-mcb.dtx')

diff --git a/luatexbase-mcb.dtx b/luatexbase-mcb.dtx
index 64e5b6c..9846011 100644
--- a/luatexbase-mcb.dtx
+++ b/luatexbase-mcb.dtx
@@ -527,29 +527,21 @@ end
 %    \begin{macrocode}
 local function datahandler (name)
     return function(data, ...)
-        local l = callbacklist[name]
-        if l then
-            for _, f in ipairs(l) do
-                data = f.func(data, ...)
-            end
+        for _, f in ipairs(callbacklist[name]) do
+            data = f.func(data, ...)
         end
-        return data
     end
 end
 %    \end{macrocode}
 %
-%    Handler for |first| callbacks.
+%    Handler for |first| callbacks. We can assume |callbacklist[name]| is not
+%    empty: otherwise, the function wouldn't be registered in the callback any
+%    more.
 %
 %    \begin{macrocode}
 local function firsthandler (name)
     return function(...)
-        local l = callbacklist[name]
-        if l then
-            local f = l[1].func
-            return f(...)
-        else
-            return nil, false
-        end
+        return callbacklist[name][1].func(...)
     end
 end
 %    \end{macrocode}
@@ -559,11 +551,8 @@ end
 %    \begin{macrocode}
 local function simplehandler (name)
     return function(...)
-        local l = callbacklist[name]
-        if l then
-            for _, f in ipairs(l) do
-                f.func(...)
-            end
+        for _, f in ipairs(callbacklist[name]) do
+            f.func(...)
         end
     end
 end
-- 
cgit v1.2.3

