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)
commit->uninteresting = 1;
while (parents)
{
while (parents) {
parents->commit->uninteresting = 1;
parents = parents->next;
}
......@@ -230,12 +229,9 @@ void git_commit_list_push_back(git_commit_list *list, git_commit *commit)
node->next = NULL;
node->prev = list->tail;
if (list->tail == NULL)
{
if (list->tail == NULL) {
list->head = list->tail = node;
}
else
{
} else {
list->tail->next = node;
list->tail = node;
}
......@@ -256,12 +252,9 @@ void git_commit_list_push_front(git_commit_list *list, git_commit *commit)
node->next = list->head;
node->prev = NULL;
if (list->head == NULL)
{
if (list->head == NULL) {
list->head = list->tail = node;
}
else
{
} else {
list->head->prev = node;
list->head = node;
}
......@@ -317,8 +310,7 @@ void git_commit_list_clear(git_commit_list *list, int free_commits)
git_commit_node *node, *next_node;
node = list->head;
while (node)
{
while (node) {
if (free_commits)
free(node->commit);
......@@ -341,14 +333,12 @@ void git_commit_list_timesort(git_commit_list *list)
in_size = 1;
do
{
do {
p = list->head;
list->tail = NULL;
merge_count = 0;
while (p != NULL)
{
while (p != NULL) {
merge_count++;
q = p;
p_size = 0;
......@@ -357,8 +347,8 @@ void git_commit_list_timesort(git_commit_list *list)
for (i = 0; i < in_size && q; ++i, q = q->next)
p_size++;
while (p_size > 0 || (q_size > 0 && q))
{
while (p_size > 0 || (q_size > 0 && q)) {
if (p_size == 0)
e = q, q = q->next, q_size--;
......@@ -393,22 +383,18 @@ void git_commit_list_toposort(git_commit_list *list)
git_commit_list topo;
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;
if (commit->in_degree > 0)
{
if (commit->in_degree > 0) {
commit->topo_delay = 1;
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--;
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;
git_commit_list_push_back(list, p->commit);
}
......@@ -421,3 +407,4 @@ void git_commit_list_toposort(git_commit_list *list)
list->tail = topo.tail;
list->size = topo.size;
}
......@@ -36,8 +36,7 @@ unsigned int git_revpool_table__hash(const git_oid *id)
unsigned int h = 0xA8A3D5;
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];
k *= m;
......@@ -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 *));
if (table->nodes == NULL)
{
if (table->nodes == NULL) {
free(table);
return NULL;
}
......@@ -130,8 +128,7 @@ git_revpool_object *git_revpool_table_lookup(git_revpool_table *table, const git
index = (hash & table->size_mask);
node = table->nodes[index];
while (node != NULL)
{
while (node != NULL) {
if (node->hash == hash && git_oid_cmp(id, &node->object->id) == 0)
return node->object;
......@@ -154,13 +151,11 @@ void git_revpool_table_resize(git_revpool_table *table)
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;
unsigned int index;
while ((n = table->nodes[i]) != NULL)
{
while ((n = table->nodes[i]) != NULL) {
table->nodes[i] = n->next;
index = n->hash & (new_size - 1);
n->next = new_nodes[index];
......@@ -179,13 +174,11 @@ void git_revpool_table_free(git_revpool_table *table)
{
int index;
for (index = 0; index <= table->size_mask; ++index)
{
for (index = 0; index <= table->size_mask; ++index) {
git_revpool_node *node, *next_node;
node = table->nodes[index];
while (node != NULL)
{
while (node != NULL) {
next_node = node->next;
free(node);
node = next_node;
......@@ -209,8 +202,7 @@ git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it)
{
git_revpool_node *next = NULL;
while (it->current_node == NULL)
{
while (it->current_node == NULL) {
if (it->current_pos >= it->size)
return NULL;
......
......@@ -4,21 +4,18 @@
#include "git/common.h"
#include "git/oid.h"
struct git_revpool_object
{
struct git_revpool_object {
git_oid id;
git_revpool *pool;
};
struct git_revpool_node
{
struct git_revpool_node {
struct git_revpool_object *object;
unsigned int hash;
struct git_revpool_node *next;
};
struct git_revpool_table
{
struct git_revpool_table {
struct git_revpool_node **nodes;
unsigned int size_mask;
......@@ -26,8 +23,7 @@ struct git_revpool_table
unsigned int max_count;
};
struct git_revpool_tableit
{
struct git_revpool_tableit {
struct git_revpool_node **nodes;
struct git_revpool_node *current_node;
unsigned int current_pos;
......@@ -50,5 +46,4 @@ void git_revpool_table_free(git_revpool_table *table);
git_revpool_object *git_revpool_tableit_next(git_revpool_tableit *it);
void git_revpool_tableit_init(git_revpool_table *table, git_revpool_tableit *it);
#endif
......@@ -70,8 +70,7 @@ void gitrp_push(git_revpool *pool, git_commit *commit)
if (commit->object.pool != pool || pool->walking)
return;
if (!commit->parsed)
{
if (!commit->parsed) {
if (git_commit_parse_existing(commit) < 0)
return;
}
......@@ -106,8 +105,7 @@ void gitrp__enroot(git_revpool *pool, git_commit *commit)
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++;
gitrp__enroot(pool, parents->commit);
}
......@@ -143,8 +141,7 @@ git_commit *gitrp_next(git_revpool *pool)
if (!pool->walking)
gitrp__prepare_walk(pool);
while ((next = pool->next_commit(&pool->iterator)) != NULL)
{
while ((next = pool->next_commit(&pool->iterator)) != NULL) {
if (!next->uninteresting)
return next;
}
......@@ -161,8 +158,7 @@ void gitrp_reset(git_revpool *pool)
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->topo_delay = 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