commit - 87670572d0f25fb0137be54add50dd728195bb0d
commit + d9dff0e5c658f1bef8647522dcb5b851b3f4734e
blob - 5ae8df4581b3c8b1b606407a8243cf633db3b443
blob + 56ec3c84e79de939eeb6430d0588bfc77ac7d25d
--- got/got.c
+++ got/got.c
char *remote_namespace = NULL;
char *local_refname = NULL;
- SIMPLEQ_INIT(&my_refs);
+ TAILQ_INIT(&my_refs);
if (asprintf(&remote_namespace, "refs/remotes/%s/", remote->name)
== -1)
if (err)
goto done;
- SIMPLEQ_FOREACH(re, &my_refs, entry) {
+ TAILQ_FOREACH(re, &my_refs, entry) {
const char *refname = got_ref_get_name(re->ref);
if (!remote->mirror_references) {
if (commit_id_str) {
struct got_object_id *commit_id;
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
NULL);
if (error)
goto done;
} else {
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
NULL);
if (error)
char *refs_str = NULL;
struct got_reflist_entry *re;
- SIMPLEQ_FOREACH(re, refs, entry) {
+ TAILQ_FOREACH(re, refs, entry) {
char *s;
const char *name;
struct got_tag_object *tag = NULL;
const char *errstr;
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
#ifndef PROFILE
if (pledge("stdio rpath wpath cpath flock proc exec sendfd unveil",
char *path = NULL;
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
#ifndef PROFILE
if (pledge("stdio rpath wpath cpath flock proc exec sendfd unveil",
goto done;
} else {
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
NULL);
if (error)
goto done;
} else {
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
NULL);
if (error)
struct got_reflist_head refs;
struct got_reflist_entry *re;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
err = got_ref_list(&refs, repo, refname, got_ref_cmp_by_name, NULL);
if (err)
return err;
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
char *refstr;
refstr = got_ref_to_str(re->ref);
if (refstr == NULL)
struct got_reference *temp_ref = NULL;
int rebase_in_progress, histedit_in_progress;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
if (worktree) {
err = got_worktree_rebase_in_progress(&rebase_in_progress,
if (err)
return err;
- SIMPLEQ_FOREACH(re, &refs, entry)
+ TAILQ_FOREACH(re, &refs, entry)
list_branch(repo, worktree, re->ref);
got_ref_list_free(&refs);
error = delete_branch(repo, worktree, delref);
else {
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name,
NULL);
if (error)
struct got_reflist_head refs;
struct got_reflist_entry *re;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
err = got_ref_list(&refs, repo, "refs/tags", got_ref_cmp_tags, repo);
if (err)
return err;
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
const char *refname;
char *refstr, *tagmsg0, *tagmsg, *line, *id_str, *datestr;
char datebuf[26];
int preserve_tagmsg = 0;
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
/*
* Don't let the user create a tag name with a leading '-'.
int ch, obj_type, i, force_path = 0;
struct got_reflist_head refs;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
#ifndef PROFILE
if (pledge("stdio rpath wpath cpath flock proc exec sendfd unveil",
blob - 53ce046986e836dd5050f4b5ede182d2d14a06e0
blob + b657ec5ba42677b92a8726bc24022c48ee71e23e
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
time_t committer_time = 0, cmp_time = 0;
*repo_age = NULL;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
if (gw_trans->gw_conf->got_show_repo_age == 0)
return NULL;
* Find the youngest branch tip in the repository, or the age of
* the a specific branch tip if a name was provided by the caller.
*/
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
struct got_object_id *id = NULL;
if (refname && strcmp(got_ref_get_name(re->ref), refname) != 0)
int summary_header_displayed = 0, start_tag = 0, chk_next = 0;
int prev_set = 0, tag_count = 0;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, gw_trans->repo, "refs/tags",
got_ref_cmp_tags, gw_trans->repo);
if (error)
goto done;
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
const char *refname;
const char *tagger;
const char *tag_commit;
return NULL;
header->path = NULL;
- SIMPLEQ_INIT(&header->refs);
+ TAILQ_INIT(&header->refs);
header->refs_str = NULL;
header->commit_id = NULL;
char *commit_msg = NULL, *commit_msg0;
/*print commit*/
- SIMPLEQ_FOREACH(re, &header->refs, entry) {
+ TAILQ_FOREACH(re, &header->refs, entry) {
char *s;
const char *name;
struct got_tag_object *tag = NULL;
char *href_commits = NULL;
enum kcgi_err kerr = KCGI_OK;
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
error = got_ref_list(&refs, gw_trans->repo, "refs/heads",
got_ref_cmp_by_name, NULL);
if (kerr != KCGI_OK)
goto done;
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
const char *refname;
if (got_ref_is_symbolic(re->ref))
blob - 8a7ddd1fed280c5ace7be5e759d1b7ef2c6cc784
blob + eeeea20b67e66db6ea18f137afc56636198d5de4
--- include/got_reference.h
+++ include/got_reference.h
/* List of references. */
struct got_reflist_entry {
- SIMPLEQ_ENTRY(got_reflist_entry) entry;
+ TAILQ_ENTRY(got_reflist_entry) entry;
struct got_reference *ref;
};
-SIMPLEQ_HEAD(got_reflist_head, got_reflist_entry);
+TAILQ_HEAD(got_reflist_head, got_reflist_entry);
/* Duplicate a reference list entry. Caller must dispose of it with free(3). */
const struct got_error *got_reflist_entry_dup(struct got_reflist_entry **,
blob - 0aab76f5fc3a5dc2a5b75368480b9f3e9e512f59
blob + 134a933494056e53673c29dc390c0621d0fdb1c2
--- lib/fetch.c
+++ lib/fetch.c
tmpfds[i] = -1;
TAILQ_INIT(&have_refs);
- SIMPLEQ_INIT(&my_refs);
+ TAILQ_INIT(&my_refs);
if (!mirror_references) {
if (asprintf(&ref_prefix, "refs/remotes/%s/",
goto done;
}
- SIMPLEQ_FOREACH(re, &my_refs, entry) {
+ TAILQ_FOREACH(re, &my_refs, entry) {
struct got_object_id *id;
const char *refname;
blob - d9f1596591be3332b0a51e1ec4e6c77a90720fae
blob + 6dba390bae34718cc3dd29ba41787375e56e54da
--- lib/reference.c
+++ lib/reference.c
got_ref_cmp_cb cmp_cb, void *cmp_arg)
{
const struct got_error *err;
- struct got_reflist_entry *new, *re, *prev = NULL;
+ struct got_reflist_entry *new, *re;
int cmp;
*newp = NULL;
* contain redundant entries. On-disk refs take precedence.
* This code assumes that on-disk revs are read before packed-refs.
* We're iterating the list anyway, so insert elements sorted by name.
+ *
+ * Many callers will provide paths in a somewhat sorted order.
+ * Iterating backwards from the tail of the list should be more
+ * efficient than traversing through the entire list each time
+ * an element is inserted.
*/
- re = SIMPLEQ_FIRST(refs);
+ re = TAILQ_LAST(refs, got_reflist_head);
while (re) {
err = (*cmp_cb)(cmp_arg, &cmp, re->ref, new->ref);
if (err)
free(new);
*newp = NULL;
return NULL;
- } else if (cmp > 0) {
- if (prev)
- SIMPLEQ_INSERT_AFTER(refs, prev, new, entry);
- else
- SIMPLEQ_INSERT_HEAD(refs, new, entry);
+ } else if (cmp < 0) {
+ TAILQ_INSERT_AFTER(refs, re, new, entry);
return NULL;
- } else {
- prev = re;
- re = SIMPLEQ_NEXT(re, entry);
}
+ re = TAILQ_PREV(re, got_reflist_head, entry);
}
- SIMPLEQ_INSERT_TAIL(refs, new, entry);
+ TAILQ_INSERT_HEAD(refs, new, entry);
return NULL;
}
{
struct got_reflist_entry *re;
- while (!SIMPLEQ_EMPTY(refs)) {
- re = SIMPLEQ_FIRST(refs);
- SIMPLEQ_REMOVE_HEAD(refs, entry);
- got_ref_close(re->ref);
+ while ((re = TAILQ_FIRST(refs))) {
+ TAILQ_REMOVE(refs, re, entry);
free(re);
}
if (delref->flags & GOT_REF_IS_SYMBOLIC)
return got_error(GOT_ERR_BAD_REF_DATA);
- SIMPLEQ_INIT(&refs);
+ TAILQ_INIT(&refs);
packed_refs_path = got_repo_get_path_packed_refs(repo);
if (packed_refs_path == NULL)
goto done;
}
- SIMPLEQ_FOREACH(re, &refs, entry) {
+ TAILQ_FOREACH(re, &refs, entry) {
uint8_t hex[SHA1_DIGEST_STRING_LENGTH];
if (got_sha1_digest_to_str(re->ref->ref.ref.sha1, hex,
}
(*map)->idset = idset;
- SIMPLEQ_FOREACH(re, refs, entry) {
+ TAILQ_FOREACH(re, refs, entry) {
struct got_reflist_entry *new;
struct got_reflist_object_id_map_entry *ent;
err = got_error_from_errno("malloc");
goto done;
}
- SIMPLEQ_INIT(&ent->refs);
+ TAILQ_INIT(&ent->refs);
err = got_object_idset_add(idset, id, ent);
if (err)
goto done;
err = got_reflist_entry_dup(&new, re);
if (err)
goto done;
- SIMPLEQ_INSERT_TAIL(&ent->refs, new, entry);
+ TAILQ_INSERT_TAIL(&ent->refs, new, entry);
free(id);
id = NULL;
}
blob - bfbd39aabab2179cdbf0100c7d1b2534617f140e
blob + 4a6e13fd0afc2e6e9bb7a10467c39500a78a8734
--- lib/repository.c
+++ lib/repository.c
*tag = NULL;
- SIMPLEQ_FOREACH(re, refs, entry) {
+ TAILQ_FOREACH(re, refs, entry) {
const char *refname;
refname = got_ref_get_name(re->ref);
if (got_ref_is_symbolic(re->ref))
blob - 34ef25995f16190305230ec2b631d168e4ff50fd
blob + 2e23ae5edc382c67c6fbdef723418d445a2a24d3
--- tog/tog.c
+++ tog/tog.c
};
SIMPLEQ_HEAD(tog_colors, tog_color);
-static struct got_reflist_head tog_refs = SIMPLEQ_HEAD_INITIALIZER(tog_refs);
+static struct got_reflist_head tog_refs = TAILQ_HEAD_INITIALIZER(tog_refs);
static struct got_reflist_object_id_map *tog_refs_idmap;
static const struct got_error *
*refs_str = NULL;
- SIMPLEQ_FOREACH(re, refs, entry) {
+ TAILQ_FOREACH(re, refs, entry) {
struct got_tag_object *tag = NULL;
struct got_object_id *ref_id;
int cmp;
goto done;
/* already loaded by tog_log_with_path()? */
- if (SIMPLEQ_EMPTY(&tog_refs)) {
+ if (TAILQ_EMPTY(&tog_refs)) {
error = tog_load_refs(repo);
if (error)
goto done;
struct tog_reflist_entry *re;
s->nrefs = 0;
- SIMPLEQ_FOREACH(sre, &tog_refs, entry) {
+ TAILQ_FOREACH(sre, &tog_refs, entry) {
if (strncmp(got_ref_get_name(sre->ref), "refs/got/", 9) == 0)
continue;