mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 11:14:05 +02:00
Whitespace cleanup
This commit is contained in:
@@ -172,7 +172,8 @@ static void crcinit(void)
|
|||||||
int i, j;
|
int i, j;
|
||||||
guint sum;
|
guint sum;
|
||||||
|
|
||||||
for (i = 0; i < 128; ++i) {
|
for (i = 0; i < 128; ++i)
|
||||||
|
{
|
||||||
sum = 0L;
|
sum = 0L;
|
||||||
for (j = 7 - 1; j >= 0; --j)
|
for (j = 7 - 1; j >= 0; --j)
|
||||||
if (i & (1 << j))
|
if (i & (1 << j))
|
||||||
@@ -184,7 +185,8 @@ static void crcinit(void)
|
|||||||
/*
|
/*
|
||||||
- hash - Honeyman's nice hashing function
|
- hash - Honeyman's nice hashing function
|
||||||
*/
|
*/
|
||||||
static guint honeyman_hash(gconstpointer key)
|
static guint
|
||||||
|
honeyman_hash (gconstpointer key)
|
||||||
{
|
{
|
||||||
const gchar *name = (const gchar *) key;
|
const gchar *name = (const gchar *) key;
|
||||||
gint size;
|
gint size;
|
||||||
@@ -195,28 +197,30 @@ static guint honeyman_hash(gconstpointer key)
|
|||||||
|
|
||||||
size = strlen (name);
|
size = strlen (name);
|
||||||
|
|
||||||
while (size--) {
|
while (size--)
|
||||||
sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void not_even_foreach (gpointer key,
|
static void
|
||||||
|
not_even_foreach (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
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 value,
|
||||||
gpointer user_data)
|
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);
|
gboolean simple_hash = GPOINTER_TO_INT (d);
|
||||||
|
|
||||||
@@ -342,7 +348,8 @@ static void second_hash_test (gconstpointer d)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean find_first (gpointer key,
|
static gboolean
|
||||||
|
find_first (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -352,7 +359,8 @@ static gboolean find_first (gpointer key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void direct_hash_test (void)
|
static void
|
||||||
|
direct_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -360,17 +368,14 @@ static void direct_hash_test (void)
|
|||||||
h = g_hash_table_new (NULL, NULL);
|
h = g_hash_table_new (NULL, NULL);
|
||||||
g_assert (h != 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),
|
g_hash_table_insert (h, GINT_TO_POINTER (i),
|
||||||
GINT_TO_POINTER (i + 42));
|
GINT_TO_POINTER (i + 42));
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (g_hash_table_size (h) == 20);
|
g_assert (g_hash_table_size (h) == 20);
|
||||||
|
|
||||||
for (i = 1; i <= 20; i++)
|
for (i = 1; i <= 20; i++)
|
||||||
{
|
{
|
||||||
rc = GPOINTER_TO_INT (
|
rc = GPOINTER_TO_INT (g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
||||||
g_hash_table_lookup (h, GINT_TO_POINTER (i)));
|
|
||||||
|
|
||||||
g_assert (rc != 0);
|
g_assert (rc != 0);
|
||||||
g_assert ((rc - 42) == i);
|
g_assert ((rc - 42) == i);
|
||||||
@@ -379,7 +384,8 @@ static void direct_hash_test (void)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void int64_hash_test (void)
|
static void
|
||||||
|
int64_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -407,7 +413,8 @@ static void int64_hash_test (void)
|
|||||||
g_hash_table_destroy (h);
|
g_hash_table_destroy (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void double_hash_test (void)
|
static void
|
||||||
|
double_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
@@ -443,7 +450,8 @@ string_free (gpointer data)
|
|||||||
g_string_free (s, TRUE);
|
g_string_free (s, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void string_hash_test (void)
|
static void
|
||||||
|
string_hash_test (void)
|
||||||
{
|
{
|
||||||
gint i, rc;
|
gint i, rc;
|
||||||
GHashTable *h;
|
GHashTable *h;
|
||||||
|
Reference in New Issue
Block a user