CLEANUP: ssl: Remove useless loop in tlskeys_list_get_next()
authorTim Duesterhus <tim@bastelstu.be>
Sun, 3 Jan 2021 00:29:55 +0000 (01:29 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 9 Dec 2021 13:01:21 +0000 (14:01 +0100)
This loop was always exited in the first iteration by `return`.

(cherry picked from commit 2c7bb33144d1cb89962f592062c9450870b662af)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>

src/ssl_sock.c

index 4c91f8f..07b2123 100644 (file)
@@ -6410,17 +6410,14 @@ struct tls_keys_ref *tlskeys_list_get_next(struct tls_keys_ref *getnext, struct
 {
        struct tls_keys_ref *ref = getnext;
 
-       while (1) {
+       /* Get next list entry. */
+       ref = LIST_NEXT(&ref->list, struct tls_keys_ref *, list);
 
-               /* Get next list entry. */
-               ref = LIST_NEXT(&ref->list, struct tls_keys_ref *, list);
-
-               /* If the entry is the last of the list, return NULL. */
-               if (&ref->list == end)
-                       return NULL;
+       /* If the entry is the last of the list, return NULL. */
+       if (&ref->list == end)
+               return NULL;
 
-               return ref;
-       }
+       return ref;
 }
 
 static inline