Commit Diff


commit - 52ef585b872cce3318be9ab528931c96b403e47c
commit + 9398fd281946337720a9491c9891ded6a608318e
blob - 49080f733d84a1b09f005594a071db3ef8e84af5
blob + 13c1cb43fb3b509b9e88dad55b3133a1a5b22535
--- listener.c
+++ listener.c
@@ -565,26 +565,24 @@ yield_w(struct client *c, void (*fn)(int, short, void 
 static inline uint32_t
 random_id(void)
 {
-	struct client find, *res;
-
 #if HAVE_ARC4RANDOM
-	for (;;) {
-		find.id = arc4random();
-		res = SPLAY_FIND(clients_tree_id, &clients, &find);
-		if (res == NULL)
-			return find.id;
-	}
+# define RANDID() arc4random()
 #else
 	/* not as pretty as a random id */
 	static uint32_t counter = 0;
+# define RANDID() counter++
+#endif
 
+	struct client find, *res;
+
 	for (;;) {
-		find.id = counter++;
+		find.id = RANDID();
 		res = SPLAY_FIND(clients_tree_id, &clients, &find);
 		if (res == NULL)
 			return find.id;
 	}
-#endif
+
+#undef RANDID
 }
 
 static void