Remove redundant header inclusions

and some whitespace cleanup.
This commit is contained in:
Matthias Clasen 2010-09-03 20:27:45 -04:00
parent 8f81ee86ee
commit 3e2f1e3825

View File

@ -20,8 +20,10 @@
#include "config.h" #include "config.h"
#include "glib.h" #include "gsequence.h"
#include "gmem.h"
#include "gtestutils.h"
/** /**
* SECTION: sequence * SECTION: sequence
* @title: Sequences * @title: Sequences
@ -106,7 +108,7 @@ struct _GSequence
* sort/sort_changed/search_iter() functions call out to the application * sort/sort_changed/search_iter() functions call out to the application
* g_sequence_iter_get_sequence() will return the correct sequence. * g_sequence_iter_get_sequence() will return the correct sequence.
*/ */
GSequence * real_sequence; GSequence * real_sequence;
}; };
struct _GSequenceNode struct _GSequenceNode
@ -144,7 +146,7 @@ static void node_insert_before (GSequenceNode *node,
GSequenceNode *new); GSequenceNode *new);
static void node_unlink (GSequenceNode *node); static void node_unlink (GSequenceNode *node);
static void node_join (GSequenceNode *left, static void node_join (GSequenceNode *left,
GSequenceNode *right); GSequenceNode *right);
static void node_insert_sorted (GSequenceNode *node, static void node_insert_sorted (GSequenceNode *node,
GSequenceNode *new, GSequenceNode *new,
GSequenceNode *end, GSequenceNode *end,
@ -631,7 +633,7 @@ g_sequence_move_range (GSequenceIter *dest,
node_join (begin, dest); node_join (begin, dest);
if (dest != first) if (dest != first)
node_join (first, begin); node_join (first, begin);
} }
else else
{ {
@ -821,7 +823,7 @@ g_sequence_sort_iter (GSequence *seq,
GSequenceNode *node = g_sequence_get_begin_iter (tmp); GSequenceNode *node = g_sequence_get_begin_iter (tmp);
node_insert_sorted (seq->end_node, node, seq->end_node, node_insert_sorted (seq->end_node, node, seq->end_node,
cmp_func, cmp_data); cmp_func, cmp_data);
} }
tmp->access_prohibited = FALSE; tmp->access_prohibited = FALSE;
@ -912,9 +914,9 @@ g_sequence_sort_changed_iter (GSequenceIter *iter,
**/ **/
GSequenceIter * GSequenceIter *
g_sequence_insert_sorted_iter (GSequence *seq, g_sequence_insert_sorted_iter (GSequence *seq,
gpointer data, gpointer data,
GSequenceIterCompareFunc iter_cmp, GSequenceIterCompareFunc iter_cmp,
gpointer cmp_data) gpointer cmp_data)
{ {
GSequenceNode *new_node; GSequenceNode *new_node;
GSequence *tmp_seq; GSequence *tmp_seq;
@ -1460,17 +1462,17 @@ node_get_next (GSequenceNode *node)
{ {
n = n->right; n = n->right;
while (n->left) while (n->left)
n = n->left; n = n->left;
} }
else else
{ {
while (NODE_RIGHT_CHILD (n)) while (NODE_RIGHT_CHILD (n))
n = n->parent; n = n->parent;
if (n->parent) if (n->parent)
n = n->parent; n = n->parent;
else else
n = node; n = node;
} }
return n; return n;
@ -1485,17 +1487,17 @@ node_get_prev (GSequenceNode *node)
{ {
n = n->left; n = n->left;
while (n->right) while (n->right)
n = n->right; n = n->right;
} }
else else
{ {
while (NODE_LEFT_CHILD (n)) while (NODE_LEFT_CHILD (n))
n = n->parent; n = n->parent;
if (n->parent) if (n->parent)
n = n->parent; n = n->parent;
else else
n = node; n = node;
} }
return n; return n;
@ -1514,7 +1516,7 @@ node_get_pos (GSequenceNode *node)
while (node) while (node)
{ {
if (NODE_RIGHT_CHILD (node)) if (NODE_RIGHT_CHILD (node))
n_smaller += N_NODES (node->parent->left) + 1; n_smaller += N_NODES (node->parent->left) + 1;
node = node->parent; node = node->parent;
} }
@ -1524,7 +1526,7 @@ node_get_pos (GSequenceNode *node)
static GSequenceNode * static GSequenceNode *
node_get_by_pos (GSequenceNode *node, node_get_by_pos (GSequenceNode *node,
gint pos) gint pos)
{ {
int i; int i;
@ -1534,13 +1536,13 @@ node_get_by_pos (GSequenceNode *node,
{ {
if (i < pos) if (i < pos)
{ {
node = node->right; node = node->right;
pos -= (i + 1); pos -= (i + 1);
} }
else else
{ {
node = node->left; node = node->left;
} }
} }
return node; return node;
@ -1600,7 +1602,7 @@ node_get_length (GSequenceNode *node)
static void static void
real_node_free (GSequenceNode *node, real_node_free (GSequenceNode *node,
GSequence *seq) GSequence *seq)
{ {
if (node) if (node)
{ {
@ -1608,7 +1610,7 @@ real_node_free (GSequenceNode *node,
real_node_free (node->right, seq); real_node_free (node->right, seq);
if (seq && seq->data_destroy_notify && node != seq->end_node) if (seq && seq->data_destroy_notify && node != seq->end_node)
seq->data_destroy_notify (node->data); seq->data_destroy_notify (node->data);
g_slice_free (GSequenceNode, node); g_slice_free (GSequenceNode, node);
} }
@ -1616,7 +1618,7 @@ real_node_free (GSequenceNode *node,
static void static void
node_free (GSequenceNode *node, node_free (GSequenceNode *node,
GSequence *seq) GSequence *seq)
{ {
node = find_root (node); node = find_root (node);
@ -1675,7 +1677,7 @@ node_rotate (GSequenceNode *node)
node->left = node->parent; node->left = node->parent;
node->parent = node->parent->parent; node->parent = node->parent->parent;
if (node->parent) if (node->parent)
{ {
if (node->parent->right == node->left) if (node->parent->right == node->left)
node->parent->right = node; node->parent->right = node;
else else
@ -1710,7 +1712,7 @@ node_update_fields_deep (GSequenceNode *node)
static void static void
rotate_down (GSequenceNode *node, rotate_down (GSequenceNode *node,
guint priority) guint priority)
{ {
guint left, right; guint left, right;
@ -1720,9 +1722,9 @@ rotate_down (GSequenceNode *node,
while (priority < left || priority < right) while (priority < left || priority < right)
{ {
if (left > right) if (left > right)
node_rotate (node->left); node_rotate (node->left);
else else
node_rotate (node->right); node_rotate (node->right);
left = node->left ? get_priority (node->left) : 0; left = node->left ? get_priority (node->left) : 0;
right = node->right ? get_priority (node->right) : 0; right = node->right ? get_priority (node->right) : 0;
@ -1746,7 +1748,7 @@ node_cut (GSequenceNode *node)
static void static void
node_join (GSequenceNode *left, node_join (GSequenceNode *left,
GSequenceNode *right) GSequenceNode *right)
{ {
GSequenceNode *fake = node_new (NULL); GSequenceNode *fake = node_new (NULL);
@ -1764,7 +1766,7 @@ node_join (GSequenceNode *left,
static void static void
node_insert_before (GSequenceNode *node, node_insert_before (GSequenceNode *node,
GSequenceNode *new) GSequenceNode *new)
{ {
new->left = node->left; new->left = node->left;
if (new->left) if (new->left)