mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-06 11:08:56 +01:00
changed a bunch of g_assert() statements to g_return_if_fail().
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org> * gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements to g_return_if_fail(). (g_mem_profile): (g_mem_chunk_print): (g_mem_chunk_info): removed some extraneous "\n"s at the end of the log messages. * gtimer.c (g_timer_*): changed a bunch of g_assert() statements to g_return_if_fail(). * grel.c (g_*): changed a bunch of g_assert() statements to g_return_if_fail() and added some extra ones to check relation != NULL.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
Sun Mar 14 17:50:35 1999 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gmem.c (g_mem_chunk_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
(g_mem_profile):
|
||||||
|
(g_mem_chunk_print):
|
||||||
|
(g_mem_chunk_info): removed some extraneous "\n"s at the end of the log
|
||||||
|
messages.
|
||||||
|
|
||||||
|
* gtimer.c (g_timer_*): changed a bunch of g_assert() statements
|
||||||
|
to g_return_if_fail().
|
||||||
|
* grel.c (g_*): changed a bunch of g_assert() statements to
|
||||||
|
g_return_if_fail() and added some extra ones to check relation != NULL.
|
||||||
|
|
||||||
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-03-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
* configure.in: Also accept _Pctime_r instead of ctime_r, while
|
||||||
|
|||||||
28
glib/gmem.c
28
glib/gmem.c
@@ -435,15 +435,15 @@ g_mem_profile (void)
|
|||||||
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
|
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
|
||||||
if (local_allocations[i] > 0)
|
if (local_allocations[i] > 0)
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%lu allocations of %d bytes\n", local_allocations[i], i + 1);
|
"%lu allocations of %d bytes", local_allocations[i], i + 1);
|
||||||
|
|
||||||
if (local_allocations[MEM_PROFILE_TABLE_SIZE - 1] > 0)
|
if (local_allocations[MEM_PROFILE_TABLE_SIZE - 1] > 0)
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%lu allocations of greater than %d bytes\n",
|
"%lu allocations of greater than %d bytes",
|
||||||
local_allocations[MEM_PROFILE_TABLE_SIZE - 1], MEM_PROFILE_TABLE_SIZE - 1);
|
local_allocations[MEM_PROFILE_TABLE_SIZE - 1], MEM_PROFILE_TABLE_SIZE - 1);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes allocated\n", local_allocated_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes allocated", local_allocated_mem);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes freed\n", local_freed_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes freed", local_freed_mem);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes in use\n", local_allocated_mem - local_freed_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes in use", local_allocated_mem - local_freed_mem);
|
||||||
#endif /* ENABLE_MEM_PROFILE */
|
#endif /* ENABLE_MEM_PROFILE */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +531,7 @@ g_mem_chunk_destroy (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
@@ -572,7 +572,7 @@ g_mem_chunk_alloc (GMemChunk *mem_chunk)
|
|||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_val_if_fail (mem_chunk != NULL, NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -720,8 +720,8 @@ g_mem_chunk_free (GMemChunk *mem_chunk,
|
|||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
GFreeAtom *free_atom;
|
GFreeAtom *free_atom;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
g_assert (mem != NULL);
|
g_return_if_fail (mem != NULL);
|
||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
@@ -763,7 +763,7 @@ g_mem_chunk_clean (GMemChunk *mem_chunk)
|
|||||||
GFreeAtom *temp_free_atom;
|
GFreeAtom *temp_free_atom;
|
||||||
gpointer mem;
|
gpointer mem;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -827,7 +827,7 @@ g_mem_chunk_reset (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -857,7 +857,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
gulong mem;
|
gulong mem;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
mem_areas = rmem_chunk->mem_areas;
|
mem_areas = rmem_chunk->mem_areas;
|
||||||
@@ -870,7 +870,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%s: %ld bytes using %d mem areas\n",
|
"%s: %ld bytes using %d mem areas",
|
||||||
rmem_chunk->name, mem, rmem_chunk->num_mem_areas);
|
rmem_chunk->name, mem, rmem_chunk->num_mem_areas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ g_mem_chunk_info (void)
|
|||||||
}
|
}
|
||||||
g_mutex_unlock (mem_chunks_lock);
|
g_mutex_unlock (mem_chunks_lock);
|
||||||
|
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%d mem chunks\n", count);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%d mem chunks", count);
|
||||||
|
|
||||||
g_mutex_lock (mem_chunks_lock);
|
g_mutex_lock (mem_chunks_lock);
|
||||||
mem_chunk = mem_chunks;
|
mem_chunk = mem_chunks;
|
||||||
|
|||||||
36
glib/grel.c
36
glib/grel.c
@@ -153,8 +153,10 @@ g_relation_index (GRelation *relation,
|
|||||||
GCompareFunc key_compare_func)
|
GCompareFunc key_compare_func)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
|
|
||||||
|
g_return_if_fail (relation != NULL);
|
||||||
|
|
||||||
g_assert (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
|
g_return_if_fail (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
|
||||||
|
|
||||||
rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
|
rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
|
||||||
}
|
}
|
||||||
@@ -204,7 +206,9 @@ g_relation_insert (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_relation_delete_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user_data)
|
g_relation_delete_tuple (gpointer tuple_key,
|
||||||
|
gpointer tuple_value,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gpointer *tuple = (gpointer*) tuple_value;
|
gpointer *tuple = (gpointer*) tuple_value;
|
||||||
GRealRelation *rel = (GRealRelation *) user_data;
|
GRealRelation *rel = (GRealRelation *) user_data;
|
||||||
@@ -238,16 +242,17 @@ g_relation_delete_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_relation_delete (GRelation *relation,
|
g_relation_delete (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
GHashTable *key_table;
|
GHashTable *key_table;
|
||||||
gint count = rel->count;
|
gint count = rel->count;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, 0);
|
||||||
|
g_return_val_if_fail (table != NULL, 0);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -268,7 +273,9 @@ g_relation_delete (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_relation_select_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user_data)
|
g_relation_select_tuple (gpointer tuple_key,
|
||||||
|
gpointer tuple_value,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gpointer *tuple = (gpointer*) tuple_value;
|
gpointer *tuple = (gpointer*) tuple_value;
|
||||||
GRealTuples *tuples = (GRealTuples*) user_data;
|
GRealTuples *tuples = (GRealTuples*) user_data;
|
||||||
@@ -284,9 +291,9 @@ g_relation_select_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
GTuples*
|
GTuples*
|
||||||
g_relation_select (GRelation *relation,
|
g_relation_select (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
@@ -294,7 +301,8 @@ g_relation_select (GRelation *relation,
|
|||||||
GRealTuples *tuples = g_new0 (GRealTuples, 1);
|
GRealTuples *tuples = g_new0 (GRealTuples, 1);
|
||||||
gint count;
|
gint count;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, NULL);
|
||||||
|
g_return_val_if_fail (table != NULL, NULL);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -314,15 +322,16 @@ g_relation_select (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_relation_count (GRelation *relation,
|
g_relation_count (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
GHashTable *key_table;
|
GHashTable *key_table;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, 0);
|
||||||
|
g_return_val_if_fail (table != NULL, 0);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -374,7 +383,8 @@ g_tuples_index (GTuples *tuples0,
|
|||||||
{
|
{
|
||||||
GRealTuples *tuples = (GRealTuples*) tuples0;
|
GRealTuples *tuples = (GRealTuples*) tuples0;
|
||||||
|
|
||||||
g_assert (field < tuples->width);
|
g_return_val_if_fail (tuples0 != NULL, NULL);
|
||||||
|
g_return_val_if_fail (field < tuples->width, NULL);
|
||||||
|
|
||||||
return tuples->data[index * tuples->width + field];
|
return tuples->data[index * tuples->width + field];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ g_timer_new (void)
|
|||||||
void
|
void
|
||||||
g_timer_destroy (GTimer *timer)
|
g_timer_destroy (GTimer *timer)
|
||||||
{
|
{
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
g_free (timer);
|
g_free (timer);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ g_timer_start (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
rtimer->active = TRUE;
|
rtimer->active = TRUE;
|
||||||
@@ -106,7 +106,7 @@ g_timer_stop (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
rtimer->active = FALSE;
|
rtimer->active = FALSE;
|
||||||
@@ -123,7 +123,7 @@ g_timer_reset (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
|
|
||||||
|
|||||||
28
gmem.c
28
gmem.c
@@ -435,15 +435,15 @@ g_mem_profile (void)
|
|||||||
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
|
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
|
||||||
if (local_allocations[i] > 0)
|
if (local_allocations[i] > 0)
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%lu allocations of %d bytes\n", local_allocations[i], i + 1);
|
"%lu allocations of %d bytes", local_allocations[i], i + 1);
|
||||||
|
|
||||||
if (local_allocations[MEM_PROFILE_TABLE_SIZE - 1] > 0)
|
if (local_allocations[MEM_PROFILE_TABLE_SIZE - 1] > 0)
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%lu allocations of greater than %d bytes\n",
|
"%lu allocations of greater than %d bytes",
|
||||||
local_allocations[MEM_PROFILE_TABLE_SIZE - 1], MEM_PROFILE_TABLE_SIZE - 1);
|
local_allocations[MEM_PROFILE_TABLE_SIZE - 1], MEM_PROFILE_TABLE_SIZE - 1);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes allocated\n", local_allocated_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes allocated", local_allocated_mem);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes freed\n", local_freed_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes freed", local_freed_mem);
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes in use\n", local_allocated_mem - local_freed_mem);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%lu bytes in use", local_allocated_mem - local_freed_mem);
|
||||||
#endif /* ENABLE_MEM_PROFILE */
|
#endif /* ENABLE_MEM_PROFILE */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +531,7 @@ g_mem_chunk_destroy (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
@@ -572,7 +572,7 @@ g_mem_chunk_alloc (GMemChunk *mem_chunk)
|
|||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_val_if_fail (mem_chunk != NULL, NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -720,8 +720,8 @@ g_mem_chunk_free (GMemChunk *mem_chunk,
|
|||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
GFreeAtom *free_atom;
|
GFreeAtom *free_atom;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
g_assert (mem != NULL);
|
g_return_if_fail (mem != NULL);
|
||||||
|
|
||||||
ENTER_MEM_CHUNK_ROUTINE();
|
ENTER_MEM_CHUNK_ROUTINE();
|
||||||
|
|
||||||
@@ -763,7 +763,7 @@ g_mem_chunk_clean (GMemChunk *mem_chunk)
|
|||||||
GFreeAtom *temp_free_atom;
|
GFreeAtom *temp_free_atom;
|
||||||
gpointer mem;
|
gpointer mem;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -827,7 +827,7 @@ g_mem_chunk_reset (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
GMemArea *temp_area;
|
GMemArea *temp_area;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
|
|
||||||
@@ -857,7 +857,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk)
|
|||||||
GMemArea *mem_areas;
|
GMemArea *mem_areas;
|
||||||
gulong mem;
|
gulong mem;
|
||||||
|
|
||||||
g_assert (mem_chunk != NULL);
|
g_return_if_fail (mem_chunk != NULL);
|
||||||
|
|
||||||
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
rmem_chunk = (GRealMemChunk*) mem_chunk;
|
||||||
mem_areas = rmem_chunk->mem_areas;
|
mem_areas = rmem_chunk->mem_areas;
|
||||||
@@ -870,7 +870,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO,
|
||||||
"%s: %ld bytes using %d mem areas\n",
|
"%s: %ld bytes using %d mem areas",
|
||||||
rmem_chunk->name, mem, rmem_chunk->num_mem_areas);
|
rmem_chunk->name, mem, rmem_chunk->num_mem_areas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ g_mem_chunk_info (void)
|
|||||||
}
|
}
|
||||||
g_mutex_unlock (mem_chunks_lock);
|
g_mutex_unlock (mem_chunks_lock);
|
||||||
|
|
||||||
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%d mem chunks\n", count);
|
g_log (g_log_domain_glib, G_LOG_LEVEL_INFO, "%d mem chunks", count);
|
||||||
|
|
||||||
g_mutex_lock (mem_chunks_lock);
|
g_mutex_lock (mem_chunks_lock);
|
||||||
mem_chunk = mem_chunks;
|
mem_chunk = mem_chunks;
|
||||||
|
|||||||
36
grel.c
36
grel.c
@@ -153,8 +153,10 @@ g_relation_index (GRelation *relation,
|
|||||||
GCompareFunc key_compare_func)
|
GCompareFunc key_compare_func)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
|
|
||||||
|
g_return_if_fail (relation != NULL);
|
||||||
|
|
||||||
g_assert (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
|
g_return_if_fail (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
|
||||||
|
|
||||||
rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
|
rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
|
||||||
}
|
}
|
||||||
@@ -204,7 +206,9 @@ g_relation_insert (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_relation_delete_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user_data)
|
g_relation_delete_tuple (gpointer tuple_key,
|
||||||
|
gpointer tuple_value,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gpointer *tuple = (gpointer*) tuple_value;
|
gpointer *tuple = (gpointer*) tuple_value;
|
||||||
GRealRelation *rel = (GRealRelation *) user_data;
|
GRealRelation *rel = (GRealRelation *) user_data;
|
||||||
@@ -238,16 +242,17 @@ g_relation_delete_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_relation_delete (GRelation *relation,
|
g_relation_delete (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
GHashTable *key_table;
|
GHashTable *key_table;
|
||||||
gint count = rel->count;
|
gint count = rel->count;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, 0);
|
||||||
|
g_return_val_if_fail (table != NULL, 0);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -268,7 +273,9 @@ g_relation_delete (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_relation_select_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user_data)
|
g_relation_select_tuple (gpointer tuple_key,
|
||||||
|
gpointer tuple_value,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gpointer *tuple = (gpointer*) tuple_value;
|
gpointer *tuple = (gpointer*) tuple_value;
|
||||||
GRealTuples *tuples = (GRealTuples*) user_data;
|
GRealTuples *tuples = (GRealTuples*) user_data;
|
||||||
@@ -284,9 +291,9 @@ g_relation_select_tuple (gpointer tuple_key, gpointer tuple_value, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
GTuples*
|
GTuples*
|
||||||
g_relation_select (GRelation *relation,
|
g_relation_select (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
@@ -294,7 +301,8 @@ g_relation_select (GRelation *relation,
|
|||||||
GRealTuples *tuples = g_new0 (GRealTuples, 1);
|
GRealTuples *tuples = g_new0 (GRealTuples, 1);
|
||||||
gint count;
|
gint count;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, NULL);
|
||||||
|
g_return_val_if_fail (table != NULL, NULL);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -314,15 +322,16 @@ g_relation_select (GRelation *relation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_relation_count (GRelation *relation,
|
g_relation_count (GRelation *relation,
|
||||||
gconstpointer key,
|
gconstpointer key,
|
||||||
gint field)
|
gint field)
|
||||||
{
|
{
|
||||||
GRealRelation *rel = (GRealRelation *) relation;
|
GRealRelation *rel = (GRealRelation *) relation;
|
||||||
GHashTable *table = rel->hashed_tuple_tables[field];
|
GHashTable *table = rel->hashed_tuple_tables[field];
|
||||||
GHashTable *key_table;
|
GHashTable *key_table;
|
||||||
|
|
||||||
g_assert (table);
|
g_return_val_if_fail (relation != NULL, 0);
|
||||||
|
g_return_val_if_fail (table != NULL, 0);
|
||||||
|
|
||||||
key_table = g_hash_table_lookup (table, key);
|
key_table = g_hash_table_lookup (table, key);
|
||||||
|
|
||||||
@@ -374,7 +383,8 @@ g_tuples_index (GTuples *tuples0,
|
|||||||
{
|
{
|
||||||
GRealTuples *tuples = (GRealTuples*) tuples0;
|
GRealTuples *tuples = (GRealTuples*) tuples0;
|
||||||
|
|
||||||
g_assert (field < tuples->width);
|
g_return_val_if_fail (tuples0 != NULL, NULL);
|
||||||
|
g_return_val_if_fail (field < tuples->width, NULL);
|
||||||
|
|
||||||
return tuples->data[index * tuples->width + field];
|
return tuples->data[index * tuples->width + field];
|
||||||
}
|
}
|
||||||
|
|||||||
8
gtimer.c
8
gtimer.c
@@ -79,7 +79,7 @@ g_timer_new (void)
|
|||||||
void
|
void
|
||||||
g_timer_destroy (GTimer *timer)
|
g_timer_destroy (GTimer *timer)
|
||||||
{
|
{
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
g_free (timer);
|
g_free (timer);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ g_timer_start (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
rtimer->active = TRUE;
|
rtimer->active = TRUE;
|
||||||
@@ -106,7 +106,7 @@ g_timer_stop (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
rtimer->active = FALSE;
|
rtimer->active = FALSE;
|
||||||
@@ -123,7 +123,7 @@ g_timer_reset (GTimer *timer)
|
|||||||
{
|
{
|
||||||
GRealTimer *rtimer;
|
GRealTimer *rtimer;
|
||||||
|
|
||||||
g_assert (timer != NULL);
|
g_return_if_fail (timer != NULL);
|
||||||
|
|
||||||
rtimer = (GRealTimer*) timer;
|
rtimer = (GRealTimer*) timer;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user