瀏覽代碼

H2O: Improve the fortune sorting algorithm

Anton Kirilov 8 年之前
父節點
當前提交
b25a29aca3
共有 1 個文件被更改,包括 1 次插入6 次删除
  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;
 		}