[PATCH] suricatta/wfx: table.is_empty() boolean expression simplification

7 views
Skip to first unread message

Christian Storm

unread,
Aug 17, 2026, 4:21:44 PM (9 days ago) Aug 17
to swup...@googlegroups.com
Return the booleanized next(tbl) result directly to indicate an empty table.

Signed-off-by: Konrad Schwarz <konrad....@siemens.com>
Signed-off-by: Christian Storm <christi...@siemens.com>
---
suricatta/server_wfx.lua | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/suricatta/server_wfx.lua b/suricatta/server_wfx.lua
index 8cfd980b..3f22097c 100644
--- a/suricatta/server_wfx.lua
+++ b/suricatta/server_wfx.lua
@@ -211,8 +211,7 @@ end
--- @param tbl table Table to test for emptiness
--- @return boolean # `true` if empty, `false` if not
function M.utils.table.is_empty(tbl)
- local index, _ = next(tbl)
- return not index and true or false
+ return not next(tbl)
end

--- Enquote a String array's elements.
--
2.55.0

Stefano Babic

unread,
Aug 18, 2026, 3:54:01 AM (8 days ago) Aug 18
to Christian Storm, swup...@googlegroups.com
Reviewed-by: Stefano Babic <stefan...@swupdate.org>

Best regards,
Stefano
--
_______________________________________________________________________
Nabla Software Engineering GmbH
Hirschstr. 111A | 86156 Augsburg | Tel: +49 821 45592596
Geschäftsführer : Stefano Babic | HRB 40522 Augsburg
E-Mail: sba...@nabladev.com

Reply all
Reply to author
Forward
0 new messages