commit dbdddfee1482b50ca8c4a0be06e4fec6a59fb9f4 from: Christian Weisgerber date: Wed Jun 23 20:48:35 2021 UTC 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 commit - c8d1f14f1e61d39a694137303080847e4b269797 commit + dbdddfee1482b50ca8c4a0be06e4fec6a59fb9f4 blob - 3af8d5f635cb8536c5f4a4f0f2466edb846ae896 blob + dfb71f8e038399997f268b6da9d7314b9fdb0669 --- got/got.c +++ 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 g 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 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 go 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(®ex, search_pattern, @@ -3780,7 +3780,7 @@ print_commits(struct got_object_id *root_id, struct go 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 go 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 go } } 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_ 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_ 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 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 *histed 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 *histed } } - 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_reposi 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) blob - 2244e2870234448a6294a739c5963caf99c88f80 blob + b353c9af64234baf5645bd6432ce861bc9e627e2 --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -3635,7 +3635,7 @@ gw_get_commit(struct gw_trans *gw_trans, struct gw_hea 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); blob - 33d4fabb70af7fc3afa0db3fb351ca550a129529 blob + f0f73917f7b7ea9ee69014ce63be92ae9ad0b705 --- include/got_object.h +++ 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 *); blob - 8c1e08c465eace7793b3aec1bcd4841063476335 blob + 783c434b33577727fafbf7589d751e7601a9dcf7 --- lib/blame.c +++ lib/blame.c @@ -213,7 +213,7 @@ blame_commit(struct got_blame *blame, struct got_objec 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; blob - 29a4d2fb492f107dfe0f7c24c53f0e54de0dda9c blob + 02b48fae94b68b2e73ce447027d7d94d3be3b6c5 --- lib/commit_graph.c +++ lib/commit_graph.c @@ -109,7 +109,7 @@ detect_changed_path(int *changed, struct got_commit_ob *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 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 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 * 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 } } - 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)) blob - e3ee8c6f3ea1981934a38c2f4bd9e01e43d62c15 blob + 13058972edf12022d3cb9a2b3ab0bd2c60c0ede9 --- lib/delta.c +++ lib/delta.c @@ -63,7 +63,7 @@ got_delta_chain_get_base_type(int *type, struct got_de 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 || blob - 4a95b0e905ba9cd4de20bfb2bb5cfea429f63b7d blob + b78f710ab010a69d3bf18af1d685ad979c6469ef --- lib/got_lib_delta.h +++ 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 blob - 7ebffb4ae32b0d4e6842a6fa0787caa8ad38dfcb blob + 4dff06d265c9aca4dc4216121372ec79495fcd96 --- lib/object.c +++ lib/object.c @@ -906,7 +906,7 @@ got_object_id_queue_copy(const struct got_object_id_qu 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_qu got_object_id_queue_free(dest); return err; } - SIMPLEQ_INSERT_TAIL(dest, new, entry); + STAILQ_INSERT_TAIL(dest, new, entry); } return NULL; blob - adc0e664003a4f5feb61676517c02a3063685c16 blob + 4ef1c3c68734fcfaa46bc785e8d103a58b652d01 --- lib/object_cache.c +++ 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; blob - 15982183420ae0e8f9de354180b64dc52689b58b blob + 38484be4282a8429eade676e2b71bcbb96196be8 --- lib/object_create.c +++ 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); blob - 0b0c5c0789a60b52fbd0e7f18073f05dbf59c989 blob + 011bee15a8060f553f213c02b686ba3734dcbeca --- lib/object_parse.c +++ 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 *i { 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 return err; } - SIMPLEQ_INSERT_TAIL(&commit->parent_ids, qid, entry); + STAILQ_INSERT_TAIL(&commit->parent_ids, qid, entry); commit->nparents++; return NULL; blob - 1b917035bd5fcddb3547066f98679b2ba7a6c567 blob + 5f8dfb856fa6b279f5a7d058b7334047642919af --- lib/pack.c +++ lib/pack.c @@ -496,7 +496,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_q 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_q 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_ 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_ 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, 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, siz *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, siz 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; blob - f8ee356d48c9238a0edda7b7eb1bd5077fd643a1 blob + b850ce5f22966a3ccbc122c9b002eaad1de24ce6 --- lib/pack_create.c +++ lib/pack_create.c @@ -378,7 +378,7 @@ load_tree_entries(struct got_object_id_queue *ids, str 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_objec 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, struc 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_ 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); } blob - ebbe86bd40a3407e2166b0cfbe3a8490c353f30c blob + acb20d28e5fa0d935383503926b1be70789b9e42 --- lib/privsep.c +++ lib/privsep.c @@ -1053,7 +1053,7 @@ got_privsep_send_commit(struct imsgbuf *ibuf, struct g 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_o 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) { blob - 2f1abf58087e2648591e03485c907e2b79bb7baa blob + a8727af0dda8619fc955177c35f9183919571c0c --- lib/repository.c +++ 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, blob - c6a9ee611f39f7106cbf6b33215f75f9f7a5c715 blob + 57631f318cb2eb1b8a1bfc2cbe610407f87d90da --- lib/worktree.c +++ lib/worktree.c @@ -2718,15 +2718,15 @@ got_worktree_checkout_files(struct got_worktree *workt 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 *workt } 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 *workt 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 *workt 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); blob - bcef0951dbb771b4b70ab05125138f52e08c7b7a blob + aac58b1e8c9fc029985629a172044af08fa045df --- libexec/got-index-pack/got-index-pack.c +++ libexec/got-index-pack/got-index-pack.c @@ -386,7 +386,7 @@ resolve_deltified_object(struct got_pack *pack, struct 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 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; blob - 612026c469e1b0b43b39ffebdb8592d4b22c474f blob + 2013a7ab842fd854267c057defa8cbe437fa7bc4 --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -667,7 +667,7 @@ commit_traversal_request(struct imsg *imsg, struct ims 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; blob - b6840e939dec6d2d98e812c0a0ca34d74e03eee1 blob + a79424ab0bfcca1e5f2241c26300b9cea521b99d --- tog/tog.c +++ 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 *patte 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, 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 } 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 *lin { 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_objec 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 to 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 to 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 to } 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 to 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 to 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_ } 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_reposi s->repo = repo; TAILQ_INIT(&s->refs); - SIMPLEQ_INIT(&s->colors); + STAILQ_INIT(&s->colors); err = ref_view_load_refs(s); if (err)