[PATCH 4/4] delayer: Handle drained queue properly

Christoph Biedl isc.cxzo at manchmal.in-ulm.de
Mon Jan 15 17:00:00 UTC 2024


If the queue runs empty, there are several warnings about uninitialized
values. Rewrite the queue handling to avoid duplicate checks.
---
 contrib/delayer.in | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/contrib/delayer.in b/contrib/delayer.in
index 8b66c3b48..d52622420 100644
--- a/contrib/delayer.in
+++ b/contrib/delayer.in
@@ -81,18 +81,16 @@ while (1) {
         push(@queue, "$exp:$line");
     }
 
-    if ($#queue < 0) {
-        undef $timeout;
-        next;
-    }
-
-    my ($first, $line) = split(/:/, $queue[0], 2);
-    while ($#queue >= 0 && $first <= $now) {
+    undef $timeout;
+    while (@queue) {
+        my ($first, $line) = split(/:/, $queue[0], 2);
+        if ($first > $now) {
+            $timeout = $first - $now;
+            last;
+        }
         print OUT $line;
         shift(@queue);
-        ($first, $line) = split(/:/, $queue[0], 2);
     }
-    $timeout = $first - $now;
 }
 
 __END__
-- 
2.39.2



More information about the inn-workers mailing list