Przeglądaj źródła

H2O: Improve the fortune sorting algorithm

Anton Kirilov 8 lat temu
rodzic
commit
b25a29aca3
1 zmienionych plików z 1 dodań i 6 usunięć
  1. 1 6
      frameworks/C/h2o/src/fortune.c

+ 1 - 6
frameworks/C/h2o/src/fortune.c

@@ -159,12 +159,7 @@ static list_t *get_sorted_sublist(list_t *head)
 	if (head) {
 		head = head->next;
 
-		while (head && compare_fortunes(tail, head) < 0) {
-			tail = head;
-			head = head->next;
-		}
-
-		while (head && !compare_fortunes(tail, head)) {
+		while (head && compare_fortunes(tail, head) <= 0) {
 			tail = head;
 			head = head->next;
 		}