Commit 9b3577ed by Vicent Marti Committed by Andreas Ericsson

Fixed brace placement and converted spaces to tabs.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
parent 0cf02ff9
...@@ -50,8 +50,7 @@ void git_commit__mark_uninteresting(git_commit *commit) ...@@ -50,8 +50,7 @@ void git_commit__mark_uninteresting(git_commit *commit)
commit->uninteresting = 1; commit->uninteresting = 1;
while (parents) while (parents) {
{
parents->commit->uninteresting = 1; parents->commit->uninteresting = 1;
parents = parents->next; parents = parents->next;
} }
...@@ -230,12 +229,9 @@ void git_commit_list_push_back(git_commit_list *list, git_commit *commit) ...@@ -230,12 +229,9 @@ void git_commit_list_push_back(git_commit_list *list, git_commit *commit)
node->next = NULL; node->next = NULL;
node->prev = list->tail; node->prev = list->tail;
if (list->tail == NULL) if (list->tail == NULL) {
{
list->head = list->tail = node; list->head = list->tail = node;
} } else {
else
{
list->tail->next = node; list->tail->next = node;
list->tail = node; list->tail = node;
} }
...@@ -256,12 +252,9 @@ void git_commit_list_push_front(git_commit_list *list, git_commit *commit) ...@@ -256,12 +252,9 @@ void git_commit_list_push_front(git_commit_list *list, git_commit *commit)
node->next = list->head; node->next = list->head;
node->prev = NULL; node->prev = NULL;
if (list->head == NULL) if (list->head == NULL) {
{
list->head = list->tail = node; list->head = list->tail = node;
} } else {
else
{
list->head->prev = node; list->head->prev = node;
list->head = node; list->head = node;
} }
...@@ -317,8 +310,7 @@ void git_commit_list_clear(git_commit_list *list, int free_commits) ...@@ -317,8 +310,7 @@ void git_commit_list_clear(git_commit_list *list, int free_commits)
git_commit_node *node, *next_node; git_commit_node *node, *next_node;
node = list->head; node = list->head;
while (node) while (node) {
{
if (free_commits) if (free_commits)
free(node->commit); free(node->commit);
...@@ -341,14 +333,12 @@ void git_commit_list_timesort(git_commit_list *list) ...@@ -341,14 +333,12 @@ void git_commit_list_timesort(git_commit_list *list)
in_size = 1; in_size = 1;
do do {
{
p = list->head; p = list->head;
list->tail = NULL; list->tail = NULL;
merge_count = 0; merge_count = 0;
while (p != NULL) while (p != NULL) {
{
merge_count++; merge_count++;
q = p; q = p;
p_size = 0; p_size = 0;
...@@ -357,8 +347,8 @@ void git_commit_list_timesort(git_commit_list *list) ...@@ -357,8 +347,8 @@ void git_commit_list_timesort(git_commit_list *list)
for (i = 0; i < in_size && q; ++i, q = q->next) for (i = 0; i < in_size && q; ++i, q = q->next)
p_size++; p_size++;
while (p_size > 0 || (q_size > 0 && q)) while (p_size > 0 || (q_size > 0 && q)) {
{
if (p_size == 0) if (p_size == 0)
e = q, q = q->next, q_size--; e = q, q = q->next, q_size--;
...@@ -393,22 +383,18 @@ void git_commit_list_toposort(git_commit_list *list) ...@@ -393,22 +383,18 @@ void git_commit_list_toposort(git_commit_list *list)
git_commit_list topo; git_commit_list topo;
memset(&topo, 0x0, sizeof(git_commit_list)); memset(&topo, 0x0, sizeof(git_commit_list));
while ((commit = git_commit_list_pop_back(list)) != NULL) while ((commit = git_commit_list_pop_back(list)) != NULL) {
{
git_commit_node *p; git_commit_node *p;
if (commit->in_degree > 0) if (commit->in_degree > 0) {
{
commit->topo_delay = 1; commit->topo_delay = 1;
continue; continue;
} }
for (p = commit->parents.head; p != NULL; p = p->next) for (p = commit->parents.head; p != NULL; p = p->next) {
{
p->commit->in_degree--; p->commit->in_degree--;
if (p->commit->in_degree == 0 && p->commit->topo_delay) if (p->commit->in_degree == 0 && p->commit->topo_delay) {
{
p->commit->topo_delay = 0; p->commit->topo_delay = 0;
git_commit_list_push_back(list, p->commit); git_commit_list_push_back(list, p->commit);
} }
...@@ -421,3 +407,4 @@ void git_commit_list_toposort(git_commit_list *list) ...@@ -421,3 +407,4 @@ void git_commit_list_toposort(git_commit_list *list)
list->tail = topo.tail; list->tail = topo.tail;
list->size = topo.size; list->size = topo.size;
} }
...@@ -36,8 +36,7 @@ unsigned int git_revpool_table__hash(const git_oid *id) ...@@ -36,8 +36,7 @@ unsigned int git_revpool_table__hash(const git_oid *id)
unsigned int h = 0xA8A3D5; unsigned int h = 0xA8A3D5;
int i; int i;
for (i = 0; i < GIT_OID_RAWSZ / 4; ++i) for (i = 0; i < GIT_OID_RAWSZ / 4; ++i) {
{
unsigned int k = ((unsigned int *)id->id)[i]; unsigned int k = ((unsigned int *)id->id)[i];
k *= m; k *= m;
...@@ -78,8 +77,7 @@ git_revpool_table *git_revpool_table_create(unsigned int min_size) ...@@ -78,8 +77,7 @@ git_revpool_table *git_revpool_table_create(unsigned int min_size)
table->nodes = git__malloc((min_size + 1) * sizeof(git_revpool_node *)); table->nodes = git__malloc((min_size + 1) * sizeof(git_revpool_node *));
if (table->nodes == NULL) if (table->nodes == NULL) {
{
free(table); free(table);
return NULL; return NULL;
} }
...@@ -130,8 +128,7 @@ git_revpool_object *git_revpool_table_lookup(git_revpool_table *table, const git ...@@ -130,8 +128,7 @@ git_revpool_object *git_revpool_table_lookup(git_revpool_table *table, const git
index = (hash & table->size_mask); index = (hash & table->size_mask);
node = table->nodes[index]; node = table->nodes[index];
while (node != NULL) while (node != NULL) {
{
if (node->hash == hash && git_oid_cmp(id, &node->object->id) == 0) if (node->hash == hash && git_oid_cmp(id, &node->object->id) == 0)
return node->object; return node->object;
...@@ -154,13 +151,11 @@ void git_revpool_table_resize(git_revpool_table *table) ...@@ -154,13 +151,11 @@ void git_revpool_table_resize(git_revpool_table *table)
memset(new_nodes, 0x0, new_size * sizeof(git_revpool_node *)); memset(new_nodes, 0x0, new_size * sizeof(git_revpool_node *));
for (i = 0; i <= table->size_mask; ++i) for (i = 0; i <= table->size_mask; ++i) {
{
git_revpool_node *n; git_revpool_node *n;
unsigned int index; unsigned int index;
while ((n = table->nodes[i]) != NULL) while ((n = table->nodes[i]) != NULL) {
{
table->nodes[i] = n->next; table->nodes[i] = n->next;
index = n->hash & (new_size - 1); index = n->hash & (new_size - 1);
n->next = new_nodes[index]; n->next = new_nodes[index];
...@@ -179,13 +174,11 @@ void git_revpool_table_free(git_revpool_table *table) ...@@ -179,13 +174,11 @@ void git_revpool_table_free(git_revpool_table *table)
{ {
int index; int index;
for (index = 0; index <= table->size_mask; ++index) for (index = 0; index <= table->size_mask; ++index) {
{
git_revpool_node *node, *next_node; git_revpool_node *node, *next_node;
node = table->nodes[index]; node = table->nodes[index];
while (node != NULL) while (node != NULL) {
{
next_node = node->next; next_node = node->next;
free(node); free(node);
node = next_node; node = next_node;
...@@ -209,8 +202,7 @@ git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it) ...@@ -209,8 +202,7 @@ git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it)
{ {
git_revpool_node *next = NULL; git_revpool_node *next = NULL;
while (it->current_node == NULL) while (it->current_node == NULL) {
{
if (it->current_pos >= it->size) if (it->current_pos >= it->size)
return NULL; return NULL;
......
...@@ -4,21 +4,18 @@ ...@@ -4,21 +4,18 @@
#include "git/common.h" #include "git/common.h"
#include "git/oid.h" #include "git/oid.h"
struct git_revpool_object struct git_revpool_object {
{
git_oid id; git_oid id;
git_revpool *pool; git_revpool *pool;
}; };
struct git_revpool_node struct git_revpool_node {
{
struct git_revpool_object *object; struct git_revpool_object *object;
unsigned int hash; unsigned int hash;
struct git_revpool_node *next; struct git_revpool_node *next;
}; };
struct git_revpool_table struct git_revpool_table {
{
struct git_revpool_node **nodes; struct git_revpool_node **nodes;
unsigned int size_mask; unsigned int size_mask;
...@@ -26,8 +23,7 @@ struct git_revpool_table ...@@ -26,8 +23,7 @@ struct git_revpool_table
unsigned int max_count; unsigned int max_count;
}; };
struct git_revpool_tableit struct git_revpool_tableit {
{
struct git_revpool_node **nodes; struct git_revpool_node **nodes;
struct git_revpool_node *current_node; struct git_revpool_node *current_node;
unsigned int current_pos; unsigned int current_pos;
...@@ -50,5 +46,4 @@ void git_revpool_table_free(git_revpool_table *table); ...@@ -50,5 +46,4 @@ void git_revpool_table_free(git_revpool_table *table);
git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it); git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it);
void git_revpool_tableit_init(git_revpool_table *table, git_revpool_tableit *it); void git_revpool_tableit_init(git_revpool_table *table, git_revpool_tableit *it);
#endif #endif
...@@ -70,8 +70,7 @@ void gitrp_push(git_revpool *pool, git_commit *commit) ...@@ -70,8 +70,7 @@ void gitrp_push(git_revpool *pool, git_commit *commit)
if (commit->object.pool != pool || pool->walking) if (commit->object.pool != pool || pool->walking)
return; return;
if (!commit->parsed) if (!commit->parsed) {
{
if (git_commit_parse_existing(commit) < 0) if (git_commit_parse_existing(commit) < 0)
return; return;
} }
...@@ -106,8 +105,7 @@ void gitrp__enroot(git_revpool *pool, git_commit *commit) ...@@ -106,8 +105,7 @@ void gitrp__enroot(git_revpool *pool, git_commit *commit)
commit->seen = 1; commit->seen = 1;
for (parents = commit->parents.head; parents != NULL; parents = parents->next) for (parents = commit->parents.head; parents != NULL; parents = parents->next) {
{
parents->commit->in_degree++; parents->commit->in_degree++;
gitrp__enroot(pool, parents->commit); gitrp__enroot(pool, parents->commit);
} }
...@@ -143,8 +141,7 @@ git_commit *gitrp_next(git_revpool *pool) ...@@ -143,8 +141,7 @@ git_commit *gitrp_next(git_revpool *pool)
if (!pool->walking) if (!pool->walking)
gitrp__prepare_walk(pool); gitrp__prepare_walk(pool);
while ((next = pool->next_commit(&pool->iterator)) != NULL) while ((next = pool->next_commit(&pool->iterator)) != NULL) {
{
if (!next->uninteresting) if (!next->uninteresting)
return next; return next;
} }
...@@ -161,8 +158,7 @@ void gitrp_reset(git_revpool *pool) ...@@ -161,8 +158,7 @@ void gitrp_reset(git_revpool *pool)
git_revpool_tableit_init(pool->commits, &it); git_revpool_tableit_init(pool->commits, &it);
while ((commit = (git_commit *)git_revpool_tableit_next(&it)) != NULL) while ((commit = (git_commit *)git_revpool_tableit_next(&it)) != NULL) {
{
commit->seen = 0; commit->seen = 0;
commit->topo_delay = 0; commit->topo_delay = 0;
commit->in_degree = 0; commit->in_degree = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment