+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
+Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
+
+ * merges from glib-1-2:
+
+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.
+
+Tue Mar 9 23:25:50 1999 Tim Janik <timj@gtk.org>
+
+ * configure.in: check for working realloc (NULL,).
+ * gmem.c (g_realloc): use malloc() for initial allocation on systems
+ where realloc(NULL,) will not work (this is the case on SunOS, reported
+ by Tom Geiger).
+
+Mon Mar 8 07:42:08 1999 Tim Janik <timj@gtk.org>
+
+ * ghook.c (g_hook_unref): when !hook_list->is_setup, wrap the
+ flag around the call to g_hook_free() to avoid spurious
+ warnings (happens during destruction phase).
+
+1999-03-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gmem.c: Fixed a stupid cut'n'paste error of mine. Thanks to
+ Friedrich Dominicus <Friedrich.Dominicus@inka.de>
+
1999-03-16 Timur Bakeyev <mc@bat.ru>
* configure.in: Fix problem with pthread_create in libc, as running
#undef ENABLE_MEM_CHECK
#undef ENABLE_MEM_PROFILE
+#undef REALLOC_0_WORKS
+
#undef G_COMPILED_WITH_DEBUGGING
#undef G_THREADS_ENABLED
#undef HAVE_LIMITS_H
#undef HAVE_LONG_DOUBLE
#undef HAVE_POLL
+#undef HAVE_PTHREAD_COND_TIMEDWAIT_POSIX
#undef HAVE_PTHREAD_GETSPECIFIC_POSIX
+#undef HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX
#undef HAVE_PWD_H
#undef HAVE_SYS_PARAM_H
#undef HAVE_SYS_POLL_H
fi
fi
+dnl *** check for sane realloc() ***
+AC_MSG_CHECKING(whether realloc (NULL,) will work)
+AC_CACHE_VAL(glib_cv_sane_realloc,[
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ int main() {
+ return realloc (0, sizeof (int)) == 0;
+ }],
+ glib_cv_sane_realloc=yes
+ AC_DEFINE(REALLOC_0_WORKS)
+ ,
+ glib_cv_sane_realloc=no
+ ,)
+])
+AC_MSG_RESULT($glib_cv_sane_realloc)
+
dnl **********************
dnl *** va_copy checks ***
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
+ g_return_if_fail (hook_list->hook_memchunk != NULL);
g_return_if_fail (hook != NULL);
g_return_if_fail (hook->ref_count > 0);
hook->next = NULL;
}
hook->prev = NULL;
-
- g_hook_free (hook_list, hook);
-
- if (!hook_list->hooks &&
- !hook_list->is_setup)
+
+ if (!hook_list->is_setup)
{
- g_mem_chunk_destroy (hook_list->hook_memchunk);
- hook_list->hook_memchunk = NULL;
+ hook_list->is_setup = TRUE;
+ g_hook_free (hook_list, hook);
+ hook_list->is_setup = FALSE;
+
+ if (!hook_list->hooks)
+ {
+ g_mem_chunk_destroy (hook_list->hook_memchunk);
+ hook_list->hook_memchunk = NULL;
+ }
}
+ else
+ g_hook_free (hook_list, hook);
}
}
GHook *hook)
{
g_return_if_fail (hook_list != NULL);
+ g_return_if_fail (hook_list->hook_memchunk != NULL);
g_return_if_fail (hook != NULL);
g_return_if_fail (hook->ref_count > 0);
hook->next = NULL;
}
hook->prev = NULL;
-
- g_hook_free (hook_list, hook);
-
- if (!hook_list->hooks &&
- !hook_list->is_setup)
+
+ if (!hook_list->is_setup)
{
- g_mem_chunk_destroy (hook_list->hook_memchunk);
- hook_list->hook_memchunk = NULL;
+ hook_list->is_setup = TRUE;
+ g_hook_free (hook_list, hook);
+ hook_list->is_setup = FALSE;
+
+ if (!hook_list->hooks)
+ {
+ g_mem_chunk_destroy (hook_list->hook_memchunk);
+ hook_list->hook_memchunk = NULL;
+ }
}
+ else
+ g_hook_free (hook_list, hook);
}
}
#define ENTER_MEM_CHUNK_ROUTINE() \
g_static_set (allocating_for_mem_chunk, \
g_static_get (allocating_for_mem_chunk) + 1)
-#define ENTER_MEM_CHUNK_ROUTINE() \
+#define LEAVE_MEM_CHUNK_ROUTINE() \
g_static_set (allocating_for_mem_chunk, \
g_static_get (allocating_for_mem_chunk) - 1)
#else
if (!mem)
- p = (gpointer) realloc (NULL, size);
+ {
+#ifdef REALLOC_0_WORKS
+ p = (gpointer) realloc (NULL, size);
+#else /* !REALLOC_0_WORKS */
+ p = (gpointer) malloc (size);
+#endif /* !REALLOC_0_WORKS */
+ }
else
{
#if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
if (local_allocations[i] > 0)
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)
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);
- 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 freed\n", 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 allocated", local_allocated_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", local_allocated_mem - local_freed_mem);
#endif /* ENABLE_MEM_PROFILE */
}
GMemArea *mem_areas;
GMemArea *temp_area;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
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;
GMemArea *temp_area;
GFreeAtom *free_atom;
- g_assert (mem_chunk != NULL);
- g_assert (mem != NULL);
+ g_return_if_fail (mem_chunk != NULL);
+ g_return_if_fail (mem != NULL);
ENTER_MEM_CHUNK_ROUTINE();
GFreeAtom *temp_free_atom;
gpointer mem;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
GMemArea *mem_areas;
GMemArea *temp_area;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
GMemArea *mem_areas;
gulong mem;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
mem_areas = rmem_chunk->mem_areas;
}
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);
}
}
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);
mem_chunk = mem_chunks;
GCompareFunc key_compare_func)
{
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);
}
}
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;
GRealRelation *rel = (GRealRelation *) user_data;
}
gint
-g_relation_delete (GRelation *relation,
+g_relation_delete (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GHashTable *key_table;
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);
}
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;
GRealTuples *tuples = (GRealTuples*) user_data;
}
GTuples*
-g_relation_select (GRelation *relation,
+g_relation_select (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GRealTuples *tuples = g_new0 (GRealTuples, 1);
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);
}
gint
-g_relation_count (GRelation *relation,
+g_relation_count (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
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);
{
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];
}
void
g_timer_destroy (GTimer *timer)
{
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
g_free (timer);
}
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = TRUE;
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = FALSE;
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
#define ENTER_MEM_CHUNK_ROUTINE() \
g_static_set (allocating_for_mem_chunk, \
g_static_get (allocating_for_mem_chunk) + 1)
-#define ENTER_MEM_CHUNK_ROUTINE() \
+#define LEAVE_MEM_CHUNK_ROUTINE() \
g_static_set (allocating_for_mem_chunk, \
g_static_get (allocating_for_mem_chunk) - 1)
#else
if (!mem)
- p = (gpointer) realloc (NULL, size);
+ {
+#ifdef REALLOC_0_WORKS
+ p = (gpointer) realloc (NULL, size);
+#else /* !REALLOC_0_WORKS */
+ p = (gpointer) malloc (size);
+#endif /* !REALLOC_0_WORKS */
+ }
else
{
#if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)
for (i = 0; i < (MEM_PROFILE_TABLE_SIZE - 1); i++)
if (local_allocations[i] > 0)
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)
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);
- 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 freed\n", 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 allocated", local_allocated_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", local_allocated_mem - local_freed_mem);
#endif /* ENABLE_MEM_PROFILE */
}
GMemArea *mem_areas;
GMemArea *temp_area;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
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;
GMemArea *temp_area;
GFreeAtom *free_atom;
- g_assert (mem_chunk != NULL);
- g_assert (mem != NULL);
+ g_return_if_fail (mem_chunk != NULL);
+ g_return_if_fail (mem != NULL);
ENTER_MEM_CHUNK_ROUTINE();
GFreeAtom *temp_free_atom;
gpointer mem;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
GMemArea *mem_areas;
GMemArea *temp_area;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
GMemArea *mem_areas;
gulong mem;
- g_assert (mem_chunk != NULL);
+ g_return_if_fail (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
mem_areas = rmem_chunk->mem_areas;
}
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);
}
}
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);
mem_chunk = mem_chunks;
GCompareFunc key_compare_func)
{
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);
}
}
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;
GRealRelation *rel = (GRealRelation *) user_data;
}
gint
-g_relation_delete (GRelation *relation,
+g_relation_delete (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GHashTable *key_table;
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);
}
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;
GRealTuples *tuples = (GRealTuples*) user_data;
}
GTuples*
-g_relation_select (GRelation *relation,
+g_relation_select (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
GRealTuples *tuples = g_new0 (GRealTuples, 1);
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);
}
gint
-g_relation_count (GRelation *relation,
+g_relation_count (GRelation *relation,
gconstpointer key,
- gint field)
+ gint field)
{
GRealRelation *rel = (GRealRelation *) relation;
GHashTable *table = rel->hashed_tuple_tables[field];
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);
{
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];
}
void
g_timer_destroy (GTimer *timer)
{
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
g_free (timer);
}
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = TRUE;
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;
rtimer->active = FALSE;
{
GRealTimer *rtimer;
- g_assert (timer != NULL);
+ g_return_if_fail (timer != NULL);
rtimer = (GRealTimer*) timer;