#include "object-name.h"
#include "pager.h"
#include "parse-options.h"
-#include "prio-queue.h"
#include "hash-lookup.h"
#include "commit-slab.h"
#include "commit-graph.h"
const char *tip_name, timestamp_t taggerdate,
int from_tag, int deref, struct mem_pool *string_pool)
{
- struct prio_queue queue;
+ struct commit_stack stack = COMMIT_STACK_INIT;
struct commit *commit;
struct commit_stack parents_to_queue = COMMIT_STACK_INIT;
struct rev_name *start_name;
else
start_name->tip_name = mem_pool_strdup(string_pool, tip_name);
- memset(&queue, 0, sizeof(queue)); /* Use the prio_queue as LIFO */
- prio_queue_put(&queue, start_commit);
+ commit_stack_push(&stack, start_commit);
- while ((commit = prio_queue_get(&queue))) {
+ while ((commit = commit_stack_pop(&stack))) {
struct rev_name *name = get_commit_rev_name(commit);
struct commit_list *parents;
int parent_number = 1;
}
}
- /* The first parent must come out first from the prio_queue */
+ /* The first parent must come out first from the stack */
while (parents_to_queue.nr)
- prio_queue_put(&queue,
- commit_stack_pop(&parents_to_queue));
+ commit_stack_push(&stack,
+ commit_stack_pop(&parents_to_queue));
}
- clear_prio_queue(&queue);
+ commit_stack_clear(&stack);
commit_stack_clear(&parents_to_queue);
}
static void mark_common(struct negotiation_state *ns, struct commit *commit,
int ancestors_only, int dont_parse)
{
- struct prio_queue queue = { NULL };
+ struct commit_stack stack = COMMIT_STACK_INIT;
if (!commit || (commit->object.flags & COMMON))
return;
- prio_queue_put(&queue, commit);
+ commit_stack_push(&stack, commit);
if (!ancestors_only) {
commit->object.flags |= COMMON;
if ((commit->object.flags & SEEN) && !(commit->object.flags & POPPED))
ns->non_common_revs--;
}
- while ((commit = prio_queue_get(&queue))) {
+ while ((commit = commit_stack_pop(&stack))) {
struct object *o = (struct object *)commit;
if (!(o->flags & SEEN))
if ((p->object.flags & SEEN) && !(p->object.flags & POPPED))
ns->non_common_revs--;
- prio_queue_put(&queue, parents->item);
+ commit_stack_push(&stack, parents->item);
}
}
}
- clear_prio_queue(&queue);
+ commit_stack_clear(&stack);
}
/*
*/
static void mark_common(struct data *data, struct commit *seen_commit)
{
- struct prio_queue queue = { NULL };
+ struct commit_stack stack = COMMIT_STACK_INIT;
struct commit *c;
if (seen_commit->object.flags & COMMON)
return;
- prio_queue_put(&queue, seen_commit);
+ commit_stack_push(&stack, seen_commit);
seen_commit->object.flags |= COMMON;
- while ((c = prio_queue_get(&queue))) {
+ while ((c = commit_stack_pop(&stack))) {
struct commit_list *p;
if (!(c->object.flags & POPPED))
continue;
p->item->object.flags |= COMMON;
- prio_queue_put(&queue, p->item);
+ commit_stack_push(&stack, p->item);
}
}
- clear_prio_queue(&queue);
+ commit_stack_clear(&stack);
}
/*