* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
/*
* MT safe
*/
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];
}