From 5528aa6578953963f71d5977c77d5bafcbb73e57 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Mon, 30 Dec 2024 13:31:08 +0100 Subject: [PATCH] Code cleanup --- src/pl-termwalk.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/pl-termwalk.c b/src/pl-termwalk.c index 88c7a65df2..8a50f1d9d1 100644 --- a/src/pl-termwalk.c +++ b/src/pl-termwalk.c @@ -80,19 +80,15 @@ static inline Word nextTermAgenda(DECL_LD term_agenda *a) { Word p; - if ( a->work.size > 0 ) - { ok: - a->work.size--; - p = a->work.location++; - deRef(p); - - return p; - } + if ( unlikely(a->work.size == 0) && + !popSegStack(&a->stack, &a->work, aNode) ) + return NULL; - if ( popSegStack(&a->stack, &a->work, aNode) ) - goto ok; + a->work.size--; + p = a->work.location++; + deRef(p); - return NULL; + return p; }