Whitespace cleanup

This commit is contained in:
Matthias Clasen 2011-04-26 23:57:17 -04:00
parent 70a1981532
commit 4832289bc0

View File

@ -172,7 +172,8 @@ static void crcinit(void)
int i, j;
guint sum;
for (i = 0; i < 128; ++i) {
for (i = 0; i < 128; ++i)
{
sum = 0L;
for (j = 7 - 1; j >= 0; --j)
if (i & (1 << j))
@ -184,7 +185,8 @@ static void crcinit(void)
/*
- hash - Honeyman's nice hashing function
*/
static guint honeyman_hash(gconstpointer key)
static guint
honeyman_hash (gconstpointer key)
{
const gchar *name = (const gchar *) key;
gint size;
@ -193,30 +195,32 @@ static guint honeyman_hash(gconstpointer key)
g_assert (name != NULL);
g_assert (*name != 0);
size = strlen(name);
size = strlen (name);
while (size--) {
while (size--)
sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
}
return(sum);
return sum;
}
static gboolean second_hash_cmp (gconstpointer a, gconstpointer b)
static gboolean
second_hash_cmp (gconstpointer a, gconstpointer b)
{
return (strcmp (a, b) == 0);
return strcmp (a, b) == 0;
}
static guint one_hash(gconstpointer key)
static guint
one_hash (gconstpointer key)
{
return 1;
}
static void not_even_foreach (gpointer key,
static void
not_even_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
@ -240,7 +244,8 @@ static void not_even_foreach (gpointer key,
}
static gboolean remove_even_foreach (gpointer key,
static gboolean
remove_even_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
@ -265,7 +270,8 @@ static gboolean remove_even_foreach (gpointer key,
static void second_hash_test (gconstpointer d)
static void
second_hash_test (gconstpointer d)
{
gboolean simple_hash = GPOINTER_TO_INT (d);
@ -280,7 +286,7 @@ static void second_hash_test (gconstpointer d)
second_hash_cmp,
g_free, g_free);
g_assert (h != NULL);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
sprintf (key, "%d", i);
g_assert (atoi (key) == i);
@ -293,7 +299,7 @@ static void second_hash_test (gconstpointer d)
g_assert (g_hash_table_size (h) == 20);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
sprintf (key, "%d", i);
g_assert (atoi(key) == i);
@ -312,7 +318,7 @@ static void second_hash_test (gconstpointer d)
g_assert (g_hash_table_size (h) == 9);
g_hash_table_foreach (h, not_even_foreach, NULL);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
sprintf (key, "%d", i);
g_assert (atoi(key) == i);
@ -342,7 +348,8 @@ static void second_hash_test (gconstpointer d)
g_hash_table_destroy (h);
}
static gboolean find_first (gpointer key,
static gboolean
find_first (gpointer key,
gpointer value,
gpointer user_data)
{
@ -352,25 +359,23 @@ static gboolean find_first (gpointer key,
}
static void direct_hash_test (void)
static void
direct_hash_test (void)
{
gint i, rc;
GHashTable *h;
h = g_hash_table_new (NULL, NULL);
g_assert (h != NULL);
for (i=1; i<=20; i++)
{
for (i = 1; i <= 20; i++)
g_hash_table_insert (h, GINT_TO_POINTER (i),
GINT_TO_POINTER (i + 42));
}
g_assert (g_hash_table_size (h) == 20);
for (i=1; i<=20; i++)
for (i = 1; i <= 20; i++)
{
rc = GPOINTER_TO_INT (
g_hash_table_lookup (h, GINT_TO_POINTER (i)));
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, GINT_TO_POINTER (i)));
g_assert (rc != 0);
g_assert ((rc - 42) == i);
@ -379,7 +384,8 @@ static void direct_hash_test (void)
g_hash_table_destroy (h);
}
static void int64_hash_test (void)
static void
int64_hash_test (void)
{
gint i, rc;
GHashTable *h;
@ -388,7 +394,7 @@ static void int64_hash_test (void)
h = g_hash_table_new (g_int64_hash, g_int64_equal);
g_assert (h != NULL);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
values[i] = i + 42;
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
@ -396,7 +402,7 @@ static void int64_hash_test (void)
g_assert (g_hash_table_size (h) == 20);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
key = i + 42;
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
@ -407,7 +413,8 @@ static void int64_hash_test (void)
g_hash_table_destroy (h);
}
static void double_hash_test (void)
static void
double_hash_test (void)
{
gint i, rc;
GHashTable *h;
@ -416,7 +423,7 @@ static void double_hash_test (void)
h = g_hash_table_new (g_double_hash, g_double_equal);
g_assert (h != NULL);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
values[i] = i + 42.5;
g_hash_table_insert (h, &values[i], GINT_TO_POINTER (i + 42));
@ -424,7 +431,7 @@ static void double_hash_test (void)
g_assert (g_hash_table_size (h) == 20);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
key = i + 42.5;
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, &key));
@ -443,7 +450,8 @@ string_free (gpointer data)
g_string_free (s, TRUE);
}
static void string_hash_test (void)
static void
string_hash_test (void)
{
gint i, rc;
GHashTable *h;
@ -451,7 +459,7 @@ static void string_hash_test (void)
h = g_hash_table_new_full ((GHashFunc)g_string_hash, (GEqualFunc)g_string_equal, string_free, NULL);
g_assert (h != NULL);
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
s = g_string_new ("");
g_string_append_printf (s, "%d", i + 42);
@ -463,7 +471,7 @@ static void string_hash_test (void)
g_assert (g_hash_table_size (h) == 20);
s = g_string_new ("");
for (i=0; i<20; i++)
for (i = 0; i < 20; i++)
{
g_string_assign (s, "");
g_string_append_printf (s, "%d", i + 42);