Commit dbdddfee1482b50ca8c4a0be06e4fec6a59fb9f4

Christian Weisgerber 2021-06-23T20:48:35

switch from SIMPLEQ to equivalent STAILQ macros The singly-linked tail queue macros were added to OpenBSD 6.9 and are more widely available on other systems. ok stsp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
diff --git a/got/got.c b/got/got.c
index 3af8d5f..dfb71f8 100644
--- a/got/got.c
+++ b/got/got.c
@@ -3350,7 +3350,7 @@ get_changed_paths(struct got_pathlist_head *paths,
 	struct got_tree_object *tree1 = NULL, *tree2 = NULL;
 	struct got_object_qid *qid;
 
-	qid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	qid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	if (qid != NULL) {
 		struct got_commit_object *pcommit;
 		err = got_object_open_as_commit(&pcommit, repo,
@@ -3394,7 +3394,7 @@ print_patch(struct got_commit_object *commit, struct got_object_id *id,
 	struct got_object_id *obj_id1 = NULL, *obj_id2 = NULL;
 	struct got_object_qid *qid;
 
-	qid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	qid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	if (qid != NULL) {
 		err = got_object_open_as_commit(&pcommit, repo,
 		    qid->id);
@@ -3655,7 +3655,7 @@ print_commit(struct got_commit_object *commit, struct got_object_id *id,
 		struct got_object_qid *qid;
 		int n = 1;
 		parent_ids = got_object_commit_get_parent_ids(commit);
-		SIMPLEQ_FOREACH(qid, parent_ids, entry) {
+		STAILQ_FOREACH(qid, parent_ids, entry) {
 			err = got_object_id_str(&id_str, qid->id);
 			if (err)
 				goto done;
@@ -3716,7 +3716,7 @@ print_commits(struct got_object_id *root_id, struct got_object_id *end_id,
 	struct got_pathlist_head changed_paths;
 	struct got_pathlist_entry *pe;
 
-	SIMPLEQ_INIT(&reversed_commits);
+	STAILQ_INIT(&reversed_commits);
 	TAILQ_INIT(&changed_paths);
 
 	if (search_pattern && regcomp(&regex, search_pattern,
@@ -3780,7 +3780,7 @@ print_commits(struct got_object_id *root_id, struct got_object_id *end_id,
 			err = got_object_qid_alloc(&qid, id);
 			if (err)
 				break;
-			SIMPLEQ_INSERT_HEAD(&reversed_commits, qid, entry);
+			STAILQ_INSERT_HEAD(&reversed_commits, qid, entry);
 			got_object_commit_close(commit);
 		} else {
 			err = print_commit(commit, id, repo, path,
@@ -3801,7 +3801,7 @@ print_commits(struct got_object_id *root_id, struct got_object_id *end_id,
 		got_pathlist_free(&changed_paths);
 	}
 	if (reverse_display_order) {
-		SIMPLEQ_FOREACH(qid, &reversed_commits, entry) {
+		STAILQ_FOREACH(qid, &reversed_commits, entry) {
 			err = got_object_open_as_commit(&commit, repo, qid->id);
 			if (err)
 				break;
@@ -3825,9 +3825,9 @@ print_commits(struct got_object_id *root_id, struct got_object_id *end_id,
 		}
 	}
 done:
-	while (!SIMPLEQ_EMPTY(&reversed_commits)) {
-		qid = SIMPLEQ_FIRST(&reversed_commits);
-		SIMPLEQ_REMOVE_HEAD(&reversed_commits, entry);
+	while (!STAILQ_EMPTY(&reversed_commits)) {
+		qid = STAILQ_FIRST(&reversed_commits);
+		STAILQ_REMOVE_HEAD(&reversed_commits, entry);
 		got_object_qid_free(qid);
 	}
 	TAILQ_FOREACH(pe, &changed_paths, entry) {
@@ -5922,13 +5922,13 @@ sort_tags(struct got_reflist_head *sorted, struct got_reflist_head *tags)
 	struct got_tag_object *re_tag, *se_tag;
 	time_t re_time, se_time;
 
-	SIMPLEQ_FOREACH(re, tags, entry) {
-		se = SIMPLEQ_FIRST(sorted);
+	STAILQ_FOREACH(re, tags, entry) {
+		se = STAILQ_FIRST(sorted);
 		if (se == NULL) {
 			err = got_reflist_entry_dup(&new, re);
 			if (err)
 				return err;
-			SIMPLEQ_INSERT_HEAD(sorted, new, entry);
+			STAILQ_INSERT_HEAD(sorted, new, entry);
 			continue;
 		} else {
 			err = got_ref_resolve(&re_id, repo, re->ref);
@@ -5957,10 +5957,10 @@ sort_tags(struct got_reflist_head *sorted, struct got_reflist_head *tags)
 				err = got_reflist_entry_dup(&new, re);
 				if (err)
 					return err;
-				SIMPLEQ_INSERT_AFTER(sorted, se, new, entry);
+				STAILQ_INSERT_AFTER(sorted, se, new, entry);
 				break;
 			}
-			se = SIMPLEQ_NEXT(se, entry);
+			se = STAILQ_NEXT(se, entry);
 			continue;
 		}
 	}
@@ -7372,7 +7372,7 @@ cmd_cherrypick(int argc, char *argv[])
 	error = got_object_open_as_commit(&commit, repo, commit_id);
 	if (error)
 		goto done;
-	pid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	pid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	memset(&upa, 0, sizeof(upa));
 	error = got_worktree_merge_files(worktree, pid ? pid->id : NULL,
 	    commit_id, repo, update_progress, &upa, check_cancelled,
@@ -7491,7 +7491,7 @@ cmd_backout(int argc, char *argv[])
 	error = got_object_open_as_commit(&commit, repo, commit_id);
 	if (error)
 		goto done;
-	pid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	pid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	if (pid == NULL) {
 		error = got_error(GOT_ERR_ROOT_COMMIT);
 		goto done;
@@ -7787,7 +7787,7 @@ collect_commits(struct got_object_id_queue *commits,
 			err = got_object_qid_alloc(&qid, commit_id);
 			if (err)
 				goto done;
-			SIMPLEQ_INSERT_HEAD(commits, qid, entry);
+			STAILQ_INSERT_HEAD(commits, qid, entry);
 			commit_id = parent_id;
 		}
 	}
@@ -8056,7 +8056,7 @@ cmd_rebase(int argc, char *argv[])
 	const struct got_object_id_queue *parent_ids;
 	struct got_object_qid *qid, *pid;
 
-	SIMPLEQ_INIT(&commits);
+	STAILQ_INIT(&commits);
 	TAILQ_INIT(&merged_paths);
 
 	while ((ch = getopt(argc, argv, "acl")) != -1) {
@@ -8244,7 +8244,7 @@ cmd_rebase(int argc, char *argv[])
 		goto done;
 
 	parent_ids = got_object_commit_get_parent_ids(commit);
-	pid = SIMPLEQ_FIRST(parent_ids);
+	pid = STAILQ_FIRST(parent_ids);
 	if (pid == NULL) {
 		if (!continue_rebase) {
 			struct got_update_progress_arg upa;
@@ -8269,7 +8269,7 @@ cmd_rebase(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	if (SIMPLEQ_EMPTY(&commits)) {
+	if (STAILQ_EMPTY(&commits)) {
 		if (continue_rebase) {
 			error = rebase_complete(worktree, fileindex,
 			    branch, new_base_branch, tmp_branch, repo,
@@ -8297,7 +8297,7 @@ cmd_rebase(int argc, char *argv[])
 	}
 
 	pid = NULL;
-	SIMPLEQ_FOREACH(qid, &commits, entry) {
+	STAILQ_FOREACH(qid, &commits, entry) {
 		struct got_update_progress_arg upa;
 
 		commit_id = qid->id;
@@ -8438,12 +8438,12 @@ histedit_write_commit_list(struct got_object_id_queue *commits,
 	struct got_object_qid *qid;
 	const char *histedit_cmd = NULL;
 
-	if (SIMPLEQ_EMPTY(commits))
+	if (STAILQ_EMPTY(commits))
 		return got_error(GOT_ERR_EMPTY_HISTEDIT);
 
-	SIMPLEQ_FOREACH(qid, commits, entry) {
+	STAILQ_FOREACH(qid, commits, entry) {
 		histedit_cmd = got_histedit_cmds[0].name;
-		if (fold_only && SIMPLEQ_NEXT(qid, entry) != NULL)
+		if (fold_only && STAILQ_NEXT(qid, entry) != NULL)
 			histedit_cmd = "fold";
 		err = histedit_write_commit(qid->id, histedit_cmd, f, repo);
 		if (err)
@@ -8470,7 +8470,7 @@ write_cmd_list(FILE *f, const char *branch_name,
 	char *id_str;
 	struct got_object_qid *qid;
 
-	qid = SIMPLEQ_FIRST(commits);
+	qid = STAILQ_FIRST(commits);
 	err = got_object_id_str(&id_str, qid->id);
 	if (err)
 		return err;
@@ -8769,7 +8769,7 @@ histedit_check_script(struct got_histedit_list *histedit_cmds,
 	if (TAILQ_EMPTY(histedit_cmds))
 		return got_error_msg(GOT_ERR_EMPTY_HISTEDIT,
 		    "histedit script contains no commands");
-	if (SIMPLEQ_EMPTY(commits))
+	if (STAILQ_EMPTY(commits))
 		return got_error(GOT_ERR_EMPTY_HISTEDIT);
 
 	TAILQ_FOREACH(hle, histedit_cmds, entry) {
@@ -8790,7 +8790,7 @@ histedit_check_script(struct got_histedit_list *histedit_cmds,
 		}
 	}
 
-	SIMPLEQ_FOREACH(qid, commits, entry) {
+	STAILQ_FOREACH(qid, commits, entry) {
 		TAILQ_FOREACH(hle, histedit_cmds, entry) {
 			if (got_object_id_cmp(qid->id, hle->commit_id) == 0)
 				break;
@@ -9210,7 +9210,7 @@ cmd_histedit(int argc, char *argv[])
 	struct got_histedit_list histedit_cmds;
 	struct got_histedit_list_entry *hle;
 
-	SIMPLEQ_INIT(&commits);
+	STAILQ_INIT(&commits);
 	TAILQ_INIT(&histedit_cmds);
 	TAILQ_INIT(&merged_paths);
 	memset(&upa, 0, sizeof(upa));
@@ -9409,7 +9409,7 @@ cmd_histedit(int argc, char *argv[])
 		if (error)
 			goto done;
 		parent_ids = got_object_commit_get_parent_ids(commit);
-		pid = SIMPLEQ_FIRST(parent_ids);
+		pid = STAILQ_FIRST(parent_ids);
 		if (pid == NULL) {
 			error = got_error(GOT_ERR_EMPTY_HISTEDIT);
 			goto done;
@@ -9450,7 +9450,7 @@ cmd_histedit(int argc, char *argv[])
 		if (error)
 			goto done;
 		parent_ids = got_object_commit_get_parent_ids(commit);
-		pid = SIMPLEQ_FIRST(parent_ids);
+		pid = STAILQ_FIRST(parent_ids);
 		if (pid == NULL) {
 			error = got_error(GOT_ERR_EMPTY_HISTEDIT);
 			goto done;
@@ -9464,7 +9464,7 @@ cmd_histedit(int argc, char *argv[])
 		if (error)
 			goto done;
 
-		if (SIMPLEQ_EMPTY(&commits)) {
+		if (STAILQ_EMPTY(&commits)) {
 			error = got_error(GOT_ERR_EMPTY_HISTEDIT);
 			goto done;
 		}
@@ -9581,7 +9581,7 @@ cmd_histedit(int argc, char *argv[])
 		if (error)
 			goto done;
 		parent_ids = got_object_commit_get_parent_ids(commit);
-		pid = SIMPLEQ_FIRST(parent_ids);
+		pid = STAILQ_FIRST(parent_ids);
 
 		error = got_worktree_histedit_merge_files(&merged_paths,
 		    worktree, fileindex, pid->id, hle->commit_id, repo,
@@ -10144,7 +10144,7 @@ cat_commit(struct got_object_id *id, struct got_repository *repo, FILE *outfile)
 	parent_ids = got_object_commit_get_parent_ids(commit);
 	fprintf(outfile, "numparents %d\n",
 	    got_object_commit_get_nparents(commit));
-	SIMPLEQ_FOREACH(pid, parent_ids, entry) {
+	STAILQ_FOREACH(pid, parent_ids, entry) {
 		char *pid_str;
 		err = got_object_id_str(&pid_str, pid->id);
 		if (err)
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 2244e28..b353c9a 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -3635,7 +3635,7 @@ gw_get_commit(struct gw_trans *gw_trans, struct gw_header *header,
 		return error;
 
 	if (gw_trans->action == GW_DIFF) {
-		parent_id = SIMPLEQ_FIRST(
+		parent_id = STAILQ_FIRST(
 		    got_object_commit_get_parent_ids(commit));
 		if (parent_id != NULL) {
 			id2 = got_object_id_dup(parent_id->id);
diff --git a/include/got_object.h b/include/got_object.h
index 33d4fab..f0f7391 100644
--- a/include/got_object.h
+++ b/include/got_object.h
@@ -23,12 +23,12 @@ struct got_tag_object;
 struct got_commit_object;
 
 struct got_object_qid {
-	SIMPLEQ_ENTRY(got_object_qid) entry;
+	STAILQ_ENTRY(got_object_qid) entry;
 	struct got_object_id *id;
 	void *data; /* managed by API user */
 };
 
-SIMPLEQ_HEAD(got_object_id_queue, got_object_qid);
+STAILQ_HEAD(got_object_id_queue, got_object_qid);
 
 const struct got_error *got_object_qid_alloc(struct got_object_qid **,
     struct got_object_id *);
diff --git a/lib/blame.c b/lib/blame.c
index 8c1e08c..783c434 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -213,7 +213,7 @@ blame_commit(struct got_blame *blame, struct got_object_id *id,
 	if (err)
 		return err;
 
-	pid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	pid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	if (pid == NULL) {
 		got_object_commit_close(commit);
 		return NULL;
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index 29a4d2f..02b48fa 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -109,7 +109,7 @@ detect_changed_path(int *changed, struct got_commit_object *commit,
 
 	*changed = 0;
 
-	pid = SIMPLEQ_FIRST(&commit->parent_ids);
+	pid = STAILQ_FIRST(&commit->parent_ids);
 	if (pid == NULL) {
 		struct got_object_id *obj_id;
 		err = got_object_id_by_path(&obj_id, repo, commit_id, path);
@@ -203,7 +203,7 @@ packed_first_parent_traversal(int *ncommits_traversed,
 	struct got_object_id_queue traversed_commits;
 	struct got_object_qid *qid;
 
-	SIMPLEQ_INIT(&traversed_commits);
+	STAILQ_INIT(&traversed_commits);
 	*ncommits_traversed = 0;
 
 	err = got_traverse_packed_commits(&traversed_commits,
@@ -212,7 +212,7 @@ packed_first_parent_traversal(int *ncommits_traversed,
 		return err;
 
 	/* Add all traversed commits to the graph... */
-	SIMPLEQ_FOREACH(qid, &traversed_commits, entry) {
+	STAILQ_FOREACH(qid, &traversed_commits, entry) {
 		struct got_commit_graph_node *node;
 
 		if (got_object_idset_contains(graph->open_branches, qid->id))
@@ -223,7 +223,7 @@ packed_first_parent_traversal(int *ncommits_traversed,
 		(*ncommits_traversed)++;
 
 		/* ... except the last commit is the new branch tip. */
-		if (SIMPLEQ_NEXT(qid, entry) == NULL) {
+		if (STAILQ_NEXT(qid, entry) == NULL) {
 			err = got_object_idset_add(graph->open_branches,
 			    qid->id, NULL);
 			break;
@@ -261,7 +261,7 @@ advance_branch(struct got_commit_graph *graph, struct got_object_id *commit_id,
 		return err;
 
 	if (graph->flags & GOT_COMMIT_GRAPH_FIRST_PARENT_TRAVERSAL) {
-		qid = SIMPLEQ_FIRST(&commit->parent_ids);
+		qid = STAILQ_FIRST(&commit->parent_ids);
 		if (qid == NULL ||
 		    got_object_idset_contains(graph->open_branches, qid->id))
 			return NULL;
@@ -298,7 +298,7 @@ advance_branch(struct got_commit_graph *graph, struct got_object_id *commit_id,
 		if (err)
 			return err;
 
-		SIMPLEQ_FOREACH(qid, &commit->parent_ids, entry) {
+		STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
 			struct got_object_id *id;
 
 			if (got_object_idset_contains(graph->open_branches,
@@ -348,7 +348,7 @@ advance_branch(struct got_commit_graph *graph, struct got_object_id *commit_id,
 		 * follow the first parent only.
 		 */
 		if (!branches_differ) {
-			qid = SIMPLEQ_FIRST(&commit->parent_ids);
+			qid = STAILQ_FIRST(&commit->parent_ids);
 			if (qid == NULL)
 				return NULL;
 			if (got_object_idset_contains(graph->open_branches,
@@ -362,7 +362,7 @@ advance_branch(struct got_commit_graph *graph, struct got_object_id *commit_id,
 		}
 	}
 
-	SIMPLEQ_FOREACH(qid, &commit->parent_ids, entry) {
+	STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
 		if (got_object_idset_contains(graph->open_branches, qid->id))
 			continue;
 		if (got_object_idset_contains(graph->node_ids, qid->id))
diff --git a/lib/delta.c b/lib/delta.c
index e3ee8c6..1305897 100644
--- a/lib/delta.c
+++ b/lib/delta.c
@@ -63,7 +63,7 @@ got_delta_chain_get_base_type(int *type, struct got_delta_chain *deltas)
 	struct got_delta *delta;
 
 	/* The first delta in the chain should represent the base object. */
-	delta = SIMPLEQ_FIRST(&deltas->entries);
+	delta = STAILQ_FIRST(&deltas->entries);
 	if (delta->type == GOT_OBJ_TYPE_COMMIT ||
 	    delta->type == GOT_OBJ_TYPE_TREE ||
 	    delta->type == GOT_OBJ_TYPE_BLOB ||
diff --git a/lib/got_lib_delta.h b/lib/got_lib_delta.h
index 4a95b0e..b78f710 100644
--- a/lib/got_lib_delta.h
+++ b/lib/got_lib_delta.h
@@ -15,7 +15,7 @@
  */
 
 struct got_delta {
-	SIMPLEQ_ENTRY(got_delta) entry;
+	STAILQ_ENTRY(got_delta) entry;
 	off_t offset;
 	size_t tslen;
 	int type;
@@ -25,7 +25,7 @@ struct got_delta {
 
 struct got_delta_chain {
 	int nentries;
-	SIMPLEQ_HEAD(, got_delta) entries;
+	STAILQ_HEAD(, got_delta) entries;
 };
 
 #define GOT_DELTA_CHAIN_RECURSION_MAX	500
diff --git a/lib/object.c b/lib/object.c
index 7ebffb4..4dff06d 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -906,7 +906,7 @@ got_object_id_queue_copy(const struct got_object_id_queue *src,
 	const struct got_error *err;
 	struct got_object_qid *qid;
 
-	SIMPLEQ_FOREACH(qid, src, entry) {
+	STAILQ_FOREACH(qid, src, entry) {
 		struct got_object_qid *new;
 		/*
 		 * Deep-copy the object ID only. Let the caller deal
@@ -917,7 +917,7 @@ got_object_id_queue_copy(const struct got_object_id_queue *src,
 			got_object_id_queue_free(dest);
 			return err;
 		}
-		SIMPLEQ_INSERT_TAIL(dest, new, entry);
+		STAILQ_INSERT_TAIL(dest, new, entry);
 	}
 
 	return NULL;
diff --git a/lib/object_cache.c b/lib/object_cache.c
index adc0e66..4ef1c3c 100644
--- a/lib/object_cache.c
+++ b/lib/object_cache.c
@@ -81,7 +81,7 @@ get_size_obj(struct got_object *obj)
 	if ((obj->flags & GOT_OBJ_FLAG_DELTIFIED) == 0)
 		return size;
 
-	SIMPLEQ_FOREACH(delta, &obj->deltas.entries, entry) {
+	STAILQ_FOREACH(delta, &obj->deltas.entries, entry) {
 		if (SIZE_MAX - sizeof(*delta) < size)
 			return SIZE_MAX;
 		size += sizeof(*delta);
@@ -110,7 +110,7 @@ get_size_commit(struct got_commit_object *commit)
 	size += strlen(commit->committer);
 	size += strlen(commit->logmsg);
 
-	SIMPLEQ_FOREACH(qid, &commit->parent_ids, entry)
+	STAILQ_FOREACH(qid, &commit->parent_ids, entry)
 		size += sizeof(*qid) + sizeof(*qid->id);
 
 	return size;
diff --git a/lib/object_create.c b/lib/object_create.c
index 1598218..38484be 100644
--- a/lib/object_create.c
+++ b/lib/object_create.c
@@ -490,7 +490,7 @@ got_object_commit_create(struct got_object_id **id,
 	}
 
 	if (parent_ids) {
-		SIMPLEQ_FOREACH(qid, parent_ids, entry) {
+		STAILQ_FOREACH(qid, parent_ids, entry) {
 			char *parent_str = NULL;
 
 			free(id_str);
diff --git a/lib/object_parse.c b/lib/object_parse.c
index 0b0c5c0..011bee1 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -123,9 +123,9 @@ got_object_close(struct got_object *obj)
 
 	if (obj->flags & GOT_OBJ_FLAG_DELTIFIED) {
 		struct got_delta *delta;
-		while (!SIMPLEQ_EMPTY(&obj->deltas.entries)) {
-			delta = SIMPLEQ_FIRST(&obj->deltas.entries);
-			SIMPLEQ_REMOVE_HEAD(&obj->deltas.entries, entry);
+		while (!STAILQ_EMPTY(&obj->deltas.entries)) {
+			delta = STAILQ_FIRST(&obj->deltas.entries);
+			STAILQ_REMOVE_HEAD(&obj->deltas.entries, entry);
 			free(delta);
 		}
 	}
@@ -144,9 +144,9 @@ got_object_id_queue_free(struct got_object_id_queue *ids)
 {
 	struct got_object_qid *qid;
 
-	while (!SIMPLEQ_EMPTY(ids)) {
-		qid = SIMPLEQ_FIRST(ids);
-		SIMPLEQ_REMOVE_HEAD(ids, entry);
+	while (!STAILQ_EMPTY(ids)) {
+		qid = STAILQ_FIRST(ids);
+		STAILQ_REMOVE_HEAD(ids, entry);
 		got_object_qid_free(qid);
 	}
 }
@@ -268,7 +268,7 @@ got_object_commit_alloc_partial(void)
 		return NULL;
 	}
 
-	SIMPLEQ_INIT(&commit->parent_ids);
+	STAILQ_INIT(&commit->parent_ids);
 
 	return commit;
 }
@@ -290,7 +290,7 @@ got_object_commit_add_parent(struct got_commit_object *commit,
 		return err;
 	}
 
-	SIMPLEQ_INSERT_TAIL(&commit->parent_ids, qid, entry);
+	STAILQ_INSERT_TAIL(&commit->parent_ids, qid, entry);
 	commit->nparents++;
 
 	return NULL;
diff --git a/lib/pack.c b/lib/pack.c
index 1b91703..5f8dfb8 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -496,7 +496,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_queue *matched_ids,
 	struct got_packidx_object_id *oid;
 	uint32_t i;
 
-	SIMPLEQ_INIT(matched_ids);
+	STAILQ_INIT(matched_ids);
 
 	if (prefix_len < 2)
 		return got_error_path(id_str_prefix, GOT_ERR_BAD_OBJ_ID_STR);
@@ -528,7 +528,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_queue *matched_ids,
 		if (err)
 			break;
 		memcpy(qid->id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
-		SIMPLEQ_INSERT_TAIL(matched_ids, qid, entry);
+		STAILQ_INSERT_TAIL(matched_ids, qid, entry);
 
 		oid = &packidx->hdr.sorted_ids[++i];
 	}
@@ -758,7 +758,7 @@ add_delta(struct got_delta_chain *deltas, off_t delta_offset, size_t tslen,
 		return got_error_from_errno("got_delta_open");
 	/* delta is freed in got_object_close() */
 	deltas->nentries++;
-	SIMPLEQ_INSERT_HEAD(&deltas->entries, delta, entry);
+	STAILQ_INSERT_HEAD(&deltas->entries, delta, entry);
 	return NULL;
 }
 
@@ -934,7 +934,7 @@ open_delta_object(struct got_object **obj, struct got_packidx *packidx,
 	memcpy(&(*obj)->id, id, sizeof((*obj)->id));
 	(*obj)->pack_offset = offset + tslen;
 
-	SIMPLEQ_INIT(&(*obj)->deltas.entries);
+	STAILQ_INIT(&(*obj)->deltas.entries);
 	(*obj)->flags |= GOT_OBJ_FLAG_DELTIFIED;
 	(*obj)->flags |= GOT_OBJ_FLAG_PACKED;
 	(*obj)->pack_idx = idx;
@@ -1007,7 +1007,7 @@ got_pack_get_delta_chain_max_size(uint64_t *max_size, struct got_delta_chain *de
 	uint64_t base_size = 0, result_size = 0;
 
 	*max_size = 0;
-	SIMPLEQ_FOREACH(delta, &deltas->entries, entry) {
+	STAILQ_FOREACH(delta, &deltas->entries, entry) {
 		/* Plain object types are the delta base. */
 		if (delta->type != GOT_OBJ_TYPE_COMMIT &&
 		    delta->type != GOT_OBJ_TYPE_TREE &&
@@ -1076,7 +1076,7 @@ got_pack_dump_delta_chain_to_file(size_t *result_size,
 
 	*result_size = 0;
 
-	if (SIMPLEQ_EMPTY(&deltas->entries))
+	if (STAILQ_EMPTY(&deltas->entries))
 		return got_error(GOT_ERR_BAD_DELTA_CHAIN);
 
 	/* We process small enough files entirely in memory for speed. */
@@ -1092,7 +1092,7 @@ got_pack_dump_delta_chain_to_file(size_t *result_size,
 	}
 
 	/* Deltas are ordered in ascending order. */
-	SIMPLEQ_FOREACH(delta, &deltas->entries, entry) {
+	STAILQ_FOREACH(delta, &deltas->entries, entry) {
 		int cached = 1;
 		if (n == 0) {
 			size_t mapoff;
@@ -1245,7 +1245,7 @@ got_pack_dump_delta_chain_to_mem(uint8_t **outbuf, size_t *outlen,
 	*outbuf = NULL;
 	*outlen = 0;
 
-	if (SIMPLEQ_EMPTY(&deltas->entries))
+	if (STAILQ_EMPTY(&deltas->entries))
 		return got_error(GOT_ERR_BAD_DELTA_CHAIN);
 
 	err = got_pack_get_delta_chain_max_size(&max_size, deltas, pack);
@@ -1256,7 +1256,7 @@ got_pack_dump_delta_chain_to_mem(uint8_t **outbuf, size_t *outlen,
 		return got_error_from_errno("malloc");
 
 	/* Deltas are ordered in ascending order. */
-	SIMPLEQ_FOREACH(delta, &deltas->entries, entry) {
+	STAILQ_FOREACH(delta, &deltas->entries, entry) {
 		int cached = 1;
 		if (n == 0) {
 			size_t delta_data_offset;
diff --git a/lib/pack_create.c b/lib/pack_create.c
index f8ee356..b850ce5 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -378,7 +378,7 @@ load_tree_entries(struct got_object_id_queue *ids, struct got_pack_metavec *v,
 			err = got_object_qid_alloc(&qid, id);
 			if (err)
 				break;
-			SIMPLEQ_INSERT_TAIL(ids, qid, entry);
+			STAILQ_INSERT_TAIL(ids, qid, entry);
 		} else if (S_ISREG(mode)) {
 			err = add_meta(v, idset, id, p, GOT_OBJ_TYPE_BLOB,
 			    mtime, loose_obj_only, repo);
@@ -411,18 +411,18 @@ load_tree(struct got_pack_metavec *v, struct got_object_idset *idset,
 	if (err)
 		return err;
 
-	SIMPLEQ_INIT(&tree_ids);
-	SIMPLEQ_INSERT_TAIL(&tree_ids, qid, entry);
+	STAILQ_INIT(&tree_ids);
+	STAILQ_INSERT_TAIL(&tree_ids, qid, entry);
 
-	while (!SIMPLEQ_EMPTY(&tree_ids)) {
+	while (!STAILQ_EMPTY(&tree_ids)) {
 		if (cancel_cb) {
 			err = (*cancel_cb)(cancel_arg);
 			if (err)
 				break;
 		}
 
-		qid = SIMPLEQ_FIRST(&tree_ids);
-		SIMPLEQ_REMOVE_HEAD(&tree_ids, entry);
+		qid = STAILQ_FIRST(&tree_ids);
+		STAILQ_REMOVE_HEAD(&tree_ids, entry);
 
 		if (got_object_idset_contains(idset, qid->id)) {
 			got_object_qid_free(qid);
@@ -557,7 +557,7 @@ queue_commit_id(struct got_object_id_queue *ids, struct got_object_id *id,
 	if (err)
 		return err;
 
-	SIMPLEQ_INSERT_TAIL(ids, qid, entry);
+	STAILQ_INSERT_TAIL(ids, qid, entry);
 	qid->data = (void *)&findtwixt_colors[color];
 	return NULL;
 }
@@ -573,22 +573,22 @@ drop_commit(struct got_object_idset *keep, struct got_object_idset *drop,
 	struct got_object_id_queue ids;
 	struct got_object_qid *qid;
 
-	SIMPLEQ_INIT(&ids);
+	STAILQ_INIT(&ids);
 
 	err = got_object_qid_alloc(&qid, id);
 	if (err)
 		return err;
-	SIMPLEQ_INSERT_HEAD(&ids, qid, entry);
+	STAILQ_INSERT_HEAD(&ids, qid, entry);
 
-	while (!SIMPLEQ_EMPTY(&ids)) {
+	while (!STAILQ_EMPTY(&ids)) {
 		if (cancel_cb) {
 			err = (*cancel_cb)(cancel_arg);
 			if (err)
 				break;
 		}
 
-		qid = SIMPLEQ_FIRST(&ids);
-		SIMPLEQ_REMOVE_HEAD(&ids, entry);
+		qid = STAILQ_FIRST(&ids);
+		STAILQ_REMOVE_HEAD(&ids, entry);
 
 		if (got_object_idset_contains(drop, qid->id)) {
 			got_object_qid_free(qid);
@@ -657,7 +657,7 @@ findtwixt(struct got_object_id ***res, int *nres,
 	struct got_object_qid *qid;
 	int i, ncolor, nkeep, obj_type;
 
-	SIMPLEQ_INIT(&ids);
+	STAILQ_INIT(&ids);
 	*res = NULL;
 	*nres = 0;
 
@@ -698,9 +698,9 @@ findtwixt(struct got_object_id ***res, int *nres,
 			goto done;
 	}
 
-	while (!SIMPLEQ_EMPTY(&ids)) {
+	while (!STAILQ_EMPTY(&ids)) {
 		int qcolor;
-		qid = SIMPLEQ_FIRST(&ids);
+		qid = STAILQ_FIRST(&ids);
 		qcolor = *((int *)qid->data);
 
 		if (got_object_idset_contains(drop, qid->id))
@@ -712,7 +712,7 @@ findtwixt(struct got_object_id ***res, int *nres,
 
 		if (ncolor == COLOR_DROP || (ncolor == COLOR_KEEP &&
 		    qcolor == COLOR_KEEP)) {
-			SIMPLEQ_REMOVE_HEAD(&ids, entry);
+			STAILQ_REMOVE_HEAD(&ids, entry);
 			got_object_qid_free(qid);
 			continue;
 		}
@@ -749,7 +749,7 @@ findtwixt(struct got_object_id ***res, int *nres,
 			}
 			parents = got_object_commit_get_parent_ids(commit);
 			if (parents) {
-				SIMPLEQ_FOREACH(pid, parents, entry) {
+				STAILQ_FOREACH(pid, parents, entry) {
 					err = queue_commit_id(&ids, pid->id,
 					    qcolor, repo);
 					if (err) {
@@ -767,7 +767,7 @@ findtwixt(struct got_object_id ***res, int *nres,
 			goto done;
 		}
 
-		SIMPLEQ_REMOVE_HEAD(&ids, entry);
+		STAILQ_REMOVE_HEAD(&ids, entry);
 		got_object_qid_free(qid);
 	}
 
diff --git a/lib/privsep.c b/lib/privsep.c
index ebbe86b..acb20d2 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -1053,7 +1053,7 @@ got_privsep_send_commit(struct imsgbuf *ibuf, struct got_commit_object *commit)
 	len += author_len;
 	memcpy(buf + len, commit->committer, committer_len);
 	len += committer_len;
-	SIMPLEQ_FOREACH(qid, &commit->parent_ids, entry) {
+	STAILQ_FOREACH(qid, &commit->parent_ids, entry) {
 		memcpy(buf + len, qid->id, SHA1_DIGEST_LENGTH);
 		len += SHA1_DIGEST_LENGTH;
 	}
@@ -1192,7 +1192,7 @@ get_commit_from_imsg(struct got_commit_object **commit,
 			break;
 		memcpy(qid->id, imsg->data + len +
 		    i * SHA1_DIGEST_LENGTH, sizeof(*qid->id));
-		SIMPLEQ_INSERT_TAIL(&(*commit)->parent_ids, qid, entry);
+		STAILQ_INSERT_TAIL(&(*commit)->parent_ids, qid, entry);
 		(*commit)->nparents++;
 	}
 done:
@@ -2386,7 +2386,7 @@ got_privsep_recv_traversed_commits(struct got_commit_object **changed_commit,
 				if (err)
 					break;
 				memcpy(qid->id->sha1, sha1, SHA1_DIGEST_LENGTH);
-				SIMPLEQ_INSERT_TAIL(commit_ids, qid, entry);
+				STAILQ_INSERT_TAIL(commit_ids, qid, entry);
 
 				/* The last commit may contain a change. */
 				if (i == icommits->ncommits - 1) {
diff --git a/lib/repository.c b/lib/repository.c
index 2f1abf5..a8727af 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1248,7 +1248,7 @@ match_packed_object(struct got_object_id **unique_id,
 	struct got_object_id_queue matched_ids;
 	int packdir_fd;
 
-	SIMPLEQ_INIT(&matched_ids);
+	STAILQ_INIT(&matched_ids);
 
 	packdir_fd = openat(got_repo_get_fd(repo),
 	    GOT_OBJECTS_PACK_DIR, O_DIRECTORY);
@@ -1293,7 +1293,7 @@ match_packed_object(struct got_object_id **unique_id,
 		if (err)
 			break;
 
-		SIMPLEQ_FOREACH(qid, &matched_ids, entry) {
+		STAILQ_FOREACH(qid, &matched_ids, entry) {
 			if (obj_type != GOT_OBJ_TYPE_ANY) {
 				int matched_type;
 				err = got_object_get_type(&matched_type, repo,
diff --git a/lib/worktree.c b/lib/worktree.c
index c6a9ee6..57631f3 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -2718,15 +2718,15 @@ got_worktree_checkout_files(struct got_worktree *worktree,
 	char *fileindex_path = NULL;
 	struct got_pathlist_entry *pe;
 	struct tree_path_data {
-		SIMPLEQ_ENTRY(tree_path_data) entry;
+		STAILQ_ENTRY(tree_path_data) entry;
 		struct got_object_id *tree_id;
 		int entry_type;
 		char *relpath;
 		char *entry_name;
 	} *tpd = NULL;
-	SIMPLEQ_HEAD(tree_paths, tree_path_data) tree_paths;
+	STAILQ_HEAD(tree_paths, tree_path_data) tree_paths;
 
-	SIMPLEQ_INIT(&tree_paths);
+	STAILQ_INIT(&tree_paths);
 
 	err = lock_worktree(worktree, LOCK_EX);
 	if (err)
@@ -2758,7 +2758,7 @@ got_worktree_checkout_files(struct got_worktree *worktree,
 		} else
 			tpd->entry_name = NULL;
 
-		SIMPLEQ_INSERT_TAIL(&tree_paths, tpd, entry);
+		STAILQ_INSERT_TAIL(&tree_paths, tpd, entry);
 	}
 
 	/*
@@ -2770,7 +2770,7 @@ got_worktree_checkout_files(struct got_worktree *worktree,
 	if (err)
 		goto done;
 
-	tpd = SIMPLEQ_FIRST(&tree_paths);
+	tpd = STAILQ_FIRST(&tree_paths);
 	TAILQ_FOREACH(pe, paths, entry) {
 		struct bump_base_commit_id_arg bbc_arg;
 
@@ -2791,7 +2791,7 @@ got_worktree_checkout_files(struct got_worktree *worktree,
 		if (err)
 			break;
 
-		tpd = SIMPLEQ_NEXT(tpd, entry);
+		tpd = STAILQ_NEXT(tpd, entry);
 	}
 	sync_err = sync_fileindex(fileindex, fileindex_path);
 	if (sync_err && err == NULL)
@@ -2804,9 +2804,9 @@ done:
 		got_object_commit_close(commit);
 	if (fileindex)
 		got_fileindex_free(fileindex);
-	while (!SIMPLEQ_EMPTY(&tree_paths)) {
-		tpd = SIMPLEQ_FIRST(&tree_paths);
-		SIMPLEQ_REMOVE_HEAD(&tree_paths, entry);
+	while (!STAILQ_EMPTY(&tree_paths)) {
+		tpd = STAILQ_FIRST(&tree_paths);
+		STAILQ_REMOVE_HEAD(&tree_paths, entry);
 		free(tpd->relpath);
 		free(tpd->tree_id);
 		free(tpd);
@@ -5552,7 +5552,7 @@ commit_worktree(struct got_object_id **new_commit_id,
 
 	*new_commit_id = NULL;
 
-	SIMPLEQ_INIT(&parent_ids);
+	STAILQ_INIT(&parent_ids);
 
 	err = got_object_open_as_commit(&head_commit, repo, head_commit_id);
 	if (err)
@@ -5608,7 +5608,7 @@ commit_worktree(struct got_object_id **new_commit_id,
 	err = got_object_qid_alloc(&pid, worktree->base_commit_id);
 	if (err)
 		goto done;
-	SIMPLEQ_INSERT_TAIL(&parent_ids, pid, entry);
+	STAILQ_INSERT_TAIL(&parent_ids, pid, entry);
 	err = got_object_commit_create(new_commit_id, new_tree_id, &parent_ids,
 	    1, author, time(NULL), committer, time(NULL), logmsg, repo);
 	got_object_qid_free(pid);
diff --git a/libexec/got-index-pack/got-index-pack.c b/libexec/got-index-pack/got-index-pack.c
index bcef095..aac58b1 100644
--- a/libexec/got-index-pack/got-index-pack.c
+++ b/libexec/got-index-pack/got-index-pack.c
@@ -386,7 +386,7 @@ resolve_deltified_object(struct got_pack *pack, struct got_packidx *packidx,
 	const char *obj_label;
 
 	deltas.nentries = 0;
-	SIMPLEQ_INIT(&deltas.entries);
+	STAILQ_INIT(&deltas.entries);
 
 	err = got_pack_resolve_delta_chain(&deltas, packidx, pack,
 	    obj->off, obj->tslen, obj->type, obj->size,
@@ -435,9 +435,9 @@ resolve_deltified_object(struct got_pack *pack, struct got_packidx *packidx,
 done:
 	free(buf);
 	free(header);
-	while (!SIMPLEQ_EMPTY(&deltas.entries)) {
-		delta = SIMPLEQ_FIRST(&deltas.entries);
-		SIMPLEQ_REMOVE_HEAD(&deltas.entries, entry);
+	while (!STAILQ_EMPTY(&deltas.entries)) {
+		delta = STAILQ_FIRST(&deltas.entries);
+		STAILQ_REMOVE_HEAD(&deltas.entries, entry);
 		free(delta);
 	}
 	return err;
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index 612026c..2013a7a 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -667,7 +667,7 @@ commit_traversal_request(struct imsg *imsg, struct imsgbuf *ibuf,
 		memcpy(commit_ids[ncommits - 1].sha1, id.sha1,
 		    SHA1_DIGEST_LENGTH);
 
-		pid = SIMPLEQ_FIRST(&commit->parent_ids);
+		pid = STAILQ_FIRST(&commit->parent_ids);
 		if (pid == NULL)
 			break;
 
diff --git a/tog/tog.c b/tog/tog.c
index b6840e9..a79424a 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -119,11 +119,11 @@ struct commit_queue {
 };
 
 struct tog_color {
-	SIMPLEQ_ENTRY(tog_color) entry;
+	STAILQ_ENTRY(tog_color) entry;
 	regex_t regex;
 	short colorpair;
 };
-SIMPLEQ_HEAD(tog_colors, tog_color);
+STAILQ_HEAD(tog_colors, tog_color);
 
 static struct got_reflist_head tog_refs = TAILQ_HEAD_INITIALIZER(tog_refs);
 static struct got_reflist_object_id_map *tog_refs_idmap;
@@ -181,7 +181,7 @@ add_color(struct tog_colors *colors, const char *pattern,
 		return err;
 	}
 	tc->colorpair = idx;
-	SIMPLEQ_INSERT_HEAD(colors, tc, entry);
+	STAILQ_INSERT_HEAD(colors, tc, entry);
 	return NULL;
 }
 
@@ -190,9 +190,9 @@ free_colors(struct tog_colors *colors)
 {
 	struct tog_color *tc;
 
-	while (!SIMPLEQ_EMPTY(colors)) {
-		tc = SIMPLEQ_FIRST(colors);
-		SIMPLEQ_REMOVE_HEAD(colors, entry);
+	while (!STAILQ_EMPTY(colors)) {
+		tc = STAILQ_FIRST(colors);
+		STAILQ_REMOVE_HEAD(colors, entry);
 		regfree(&tc->regex);
 		free(tc);
 	}
@@ -203,7 +203,7 @@ get_color(struct tog_colors *colors, int colorpair)
 {
 	struct tog_color *tc = NULL;
 
-	SIMPLEQ_FOREACH(tc, colors, entry) {
+	STAILQ_FOREACH(tc, colors, entry) {
 		if (tc->colorpair == colorpair)
 			return tc;
 	}
@@ -1852,7 +1852,7 @@ open_diff_view_for_commit(struct tog_view **new_view, int begin_x,
 	if (diff_view == NULL)
 		return got_error_from_errno("view_open");
 
-	parent_id = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	parent_id = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	err = open_diff_view(diff_view, parent_id ? parent_id->id : NULL,
 	    commit_id, NULL, NULL, 3, 0, 0, log_view, repo);
 	if (err == NULL)
@@ -2301,7 +2301,7 @@ open_log_view(struct tog_view *view, struct got_object_id *start_id,
 	}
 	s->log_branches = log_branches;
 
-	SIMPLEQ_INIT(&s->colors);
+	STAILQ_INIT(&s->colors);
 	if (has_colors() && getenv("TOG_COLORS") != NULL) {
 		err = add_color(&s->colors, "^$", TOG_COLOR_COMMIT,
 		    get_color_value("TOG_COLOR_COMMIT"));
@@ -2838,7 +2838,7 @@ match_color(struct tog_colors *colors, const char *line)
 {
 	struct tog_color *tc = NULL;
 
-	SIMPLEQ_FOREACH(tc, colors, entry) {
+	STAILQ_FOREACH(tc, colors, entry) {
 		if (match_line(line, &tc->regex, 0, NULL))
 			return tc;
 	}
@@ -3054,7 +3054,7 @@ get_changed_paths(struct got_pathlist_head *paths,
 	struct got_tree_object *tree1 = NULL, *tree2 = NULL;
 	struct got_object_qid *qid;
 
-	qid = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	qid = STAILQ_FIRST(got_object_commit_get_parent_ids(commit));
 	if (qid != NULL) {
 		struct got_commit_object *pcommit;
 		err = got_object_open_as_commit(&pcommit, repo,
@@ -3300,7 +3300,7 @@ create_diff(struct tog_diff_view_state *s)
 				goto done;
 		} else {
 			parent_ids = got_object_commit_get_parent_ids(commit2);
-			SIMPLEQ_FOREACH(pid, parent_ids, entry) {
+			STAILQ_FOREACH(pid, parent_ids, entry) {
 				if (got_object_id_cmp(s->id1, pid->id) == 0) {
 					err = write_commit_info(
 					    &s->line_offsets, &s->nlines,
@@ -3467,7 +3467,7 @@ open_diff_view(struct tog_view *view, struct got_object_id *id1,
 	s->log_view = log_view;
 	s->repo = repo;
 
-	SIMPLEQ_INIT(&s->colors);
+	STAILQ_INIT(&s->colors);
 	if (has_colors() && getenv("TOG_COLORS") != NULL) {
 		err = add_color(&s->colors,
 		    "^-", TOG_COLOR_DIFF_MINUS,
@@ -3611,7 +3611,7 @@ set_selected_commit(struct tog_diff_view_state *s,
 		return err;
 	parent_ids = got_object_commit_get_parent_ids(selected_commit);
 	free(s->id1);
-	pid = SIMPLEQ_FIRST(parent_ids);
+	pid = STAILQ_FIRST(parent_ids);
 	s->id1 = pid ? got_object_id_dup(pid->id) : NULL;
 	got_object_commit_close(selected_commit);
 	return NULL;
@@ -4312,7 +4312,7 @@ open_blame_view(struct tog_view *view, char *path,
 	const struct got_error *err = NULL;
 	struct tog_blame_view_state *s = &view->state.blame;
 
-	SIMPLEQ_INIT(&s->blamed_commits);
+	STAILQ_INIT(&s->blamed_commits);
 
 	s->path = strdup(path);
 	if (s->path == NULL)
@@ -4324,7 +4324,7 @@ open_blame_view(struct tog_view *view, char *path,
 		return err;
 	}
 
-	SIMPLEQ_INSERT_HEAD(&s->blamed_commits, s->blamed_commit, entry);
+	STAILQ_INSERT_HEAD(&s->blamed_commits, s->blamed_commit, entry);
 	s->first_displayed_line = 1;
 	s->last_displayed_line = view->nlines;
 	s->selected_line = 1;
@@ -4333,7 +4333,7 @@ open_blame_view(struct tog_view *view, char *path,
 	s->commit_id = commit_id;
 	memset(&s->blame, 0, sizeof(s->blame));
 
-	SIMPLEQ_INIT(&s->colors);
+	STAILQ_INIT(&s->colors);
 	if (has_colors() && getenv("TOG_COLORS") != NULL) {
 		err = add_color(&s->colors, "^", TOG_COLOR_COMMIT,
 		    get_color_value("TOG_COLOR_COMMIT"));
@@ -4359,10 +4359,10 @@ close_blame_view(struct tog_view *view)
 	if (s->blame.thread)
 		err = stop_blame(&s->blame);
 
-	while (!SIMPLEQ_EMPTY(&s->blamed_commits)) {
+	while (!STAILQ_EMPTY(&s->blamed_commits)) {
 		struct got_object_qid *blamed_commit;
-		blamed_commit = SIMPLEQ_FIRST(&s->blamed_commits);
-		SIMPLEQ_REMOVE_HEAD(&s->blamed_commits, entry);
+		blamed_commit = STAILQ_FIRST(&s->blamed_commits);
+		STAILQ_REMOVE_HEAD(&s->blamed_commits, entry);
 		got_object_qid_free(blamed_commit);
 	}
 
@@ -4532,7 +4532,7 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
 			    s->repo, id);
 			if (err)
 				break;
-			pid = SIMPLEQ_FIRST(
+			pid = STAILQ_FIRST(
 			    got_object_commit_get_parent_ids(commit));
 			if (pid == NULL) {
 				got_object_commit_close(commit);
@@ -4572,7 +4572,7 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
 		s->done = 0;
 		if (thread_err)
 			break;
-		SIMPLEQ_INSERT_HEAD(&s->blamed_commits,
+		STAILQ_INSERT_HEAD(&s->blamed_commits,
 		    s->blamed_commit, entry);
 		err = run_blame(view);
 		if (err)
@@ -4581,7 +4581,7 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
 	}
 	case 'B': {
 		struct got_object_qid *first;
-		first = SIMPLEQ_FIRST(&s->blamed_commits);
+		first = STAILQ_FIRST(&s->blamed_commits);
 		if (!got_object_id_cmp(first->id, s->commit_id))
 			break;
 		s->done = 1;
@@ -4589,10 +4589,10 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
 		s->done = 0;
 		if (thread_err)
 			break;
-		SIMPLEQ_REMOVE_HEAD(&s->blamed_commits, entry);
+		STAILQ_REMOVE_HEAD(&s->blamed_commits, entry);
 		got_object_qid_free(s->blamed_commit);
 		s->blamed_commit =
-		    SIMPLEQ_FIRST(&s->blamed_commits);
+		    STAILQ_FIRST(&s->blamed_commits);
 		err = run_blame(view);
 		if (err)
 			break;
@@ -4610,7 +4610,7 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
 		err = got_object_open_as_commit(&commit, s->repo, id);
 		if (err)
 			break;
-		pid = SIMPLEQ_FIRST(
+		pid = STAILQ_FIRST(
 		    got_object_commit_get_parent_ids(commit));
 		if (view_is_parent_view(view))
 		    begin_x = view_split_begin_x(view->begin_x);
@@ -5144,7 +5144,7 @@ open_tree_view(struct tog_view *view, struct got_tree_object *root,
 	}
 	s->repo = repo;
 
-	SIMPLEQ_INIT(&s->colors);
+	STAILQ_INIT(&s->colors);
 
 	if (has_colors() && getenv("TOG_COLORS") != NULL) {
 		err = add_color(&s->colors, "\\$$",
@@ -5685,7 +5685,7 @@ open_ref_view(struct tog_view *view, struct got_repository *repo)
 	s->repo = repo;
 
 	TAILQ_INIT(&s->refs);
-	SIMPLEQ_INIT(&s->colors);
+	STAILQ_INIT(&s->colors);
 
 	err = ref_view_load_refs(s);
 	if (err)