Commit c639350d authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor
Browse files

app/brushes.c app/drawable.c app/patterns.c app/procedural_db.c

Tue Jun  9 19:47:19 1998  Owen Taylor  <otaylor@gtk.org>

	* app/brushes.c app/drawable.c app/patterns.c
	  app/procedural_db.c plug-ins/script-fu/script_fu_server.c

	Fixes for warnings generated by changing GCompareFunc
	and GHashFunc to take const arguments.
parent 74913fd5
Tue Jun 9 19:47:19 1998 Owen Taylor <otaylor@gtk.org>
* app/brushes.c app/drawable.c app/patterns.c
app/procedural_db.c plug-ins/script-fu/script_fu_server.c
Fixes for warnings generated by changing GCompareFunc
and GHashFunc to take const arguments.
Tue Jun 9 16:08:20 EDT 1998 Adrian Likins <adrain@gimp.org>
*app/file_new_dialog.c: more fiddling with file_new.
......
......@@ -59,7 +59,8 @@ static void create_default_brush (void);
static void load_brush (char *filename);
static void free_brush (GBrushP);
static void brushes_free_one (gpointer, gpointer);
static gint brush_compare_func (gpointer, gpointer);
static gint brush_compare_func (gconstpointer,
gconstpointer);
/* function declarations */
void
......@@ -130,9 +131,10 @@ brushes_free_one (gpointer data, gpointer dummy)
static gint
brush_compare_func (gpointer first, gpointer second)
brush_compare_func (gconstpointer first, gconstpointer second)
{
return strcmp (((GBrushP)first)->name, ((GBrushP)second)->name);
return strcmp (((const GBrushP)first)->name,
((const GBrushP)second)->name);
}
......
......@@ -103,18 +103,6 @@ static GHashTable *drawable_table = NULL;
/**************************/
/* Function definitions */
static guint
drawable_hash (gpointer v)
{
return (guint) v;
}
static gint
drawable_hash_compare (gpointer v1, gpointer v2)
{
return ((guint) v1) == ((guint) v2);
}
GimpDrawable*
drawable_get_ID (int drawable_id)
{
......@@ -575,8 +563,7 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->ID = global_drawable_ID++;
if (drawable_table == NULL)
drawable_table = g_hash_table_new (drawable_hash,
drawable_hash_compare);
drawable_table = g_hash_table_new (g_direct_hash, NULL);
g_hash_table_insert (drawable_table, (gpointer) drawable->ID,
(gpointer) drawable);
}
......
......@@ -53,7 +53,8 @@ static GSList * insert_pattern_in_list (GSList *, GPatternP);
static void load_pattern (char *filename);
static void free_pattern (GPatternP);
static void pattern_free_one (gpointer, gpointer);
static gint pattern_compare_func (gpointer, gpointer);
static gint pattern_compare_func (gconstpointer,
gconstpointer);
/* function declarations */
......@@ -92,9 +93,10 @@ pattern_free_one (gpointer data, gpointer dummy)
}
static gint
pattern_compare_func(gpointer first, gpointer second)
pattern_compare_func(gconstpointer first, gconstpointer second)
{
return strcmp (((GPatternP)first)->name, ((GPatternP)second)->name);
return strcmp (((const GPatternP)first)->name,
((const GPatternP)second)->name);
}
void
......
......@@ -66,8 +66,7 @@ static Argument * procedural_db_set_data (Argument *);
static Argument * procedural_db_query (Argument *);
static void procedural_db_query_entry (gpointer, gpointer, gpointer);
static int match_strings (regex_t *, char *);
static guint procedural_db_hash_func (gpointer key);
static gint procedural_db_compare_func (gpointer a, gpointer b);
static guint procedural_db_hash_func (gconstpointer key);
/* Local data */
......@@ -485,7 +484,7 @@ procedural_db_init ()
app_init_update_status("Procedural Database", NULL, -1);
if (!procedural_ht)
procedural_ht = g_hash_table_new (procedural_db_hash_func,
procedural_db_compare_func);
g_str_equal);
}
void
......@@ -1127,10 +1126,14 @@ match_strings (regex_t * preg,
return regexec (preg, a, 0, NULL, 0);
}
/* We could just use g_str_hash() here ... that uses a different
* hash function, though
*/
static guint
procedural_db_hash_func (gpointer key)
procedural_db_hash_func (gconstpointer key)
{
gchar *string;
const gchar *string;
guint result;
int c;
......@@ -1158,7 +1161,7 @@ procedural_db_hash_func (gpointer key)
* Copyright (c) 1994 Sun Microsystems, Inc.
*/
string = (gchar *) key;
string = (const gchar *) key;
result = 0;
while (1)
{
......@@ -1171,10 +1174,3 @@ procedural_db_hash_func (gpointer key)
return result;
}
static gint
procedural_db_compare_func (gpointer a,
gpointer b)
{
return (strcmp ((char *) a, (char *) b) == 0);
}
......@@ -296,7 +296,7 @@ server_start (gint port,
SFCommand *cmd;
/* Set up the clientname hash table */
clientname_ht = g_hash_table_new (clientname_hash, NULL);
clientname_ht = g_hash_table_new (g_direct_hash, NULL);
/* Setup up the server log file */
if (logfile)
......@@ -502,12 +502,6 @@ make_socket (guint port)
return sock;
}
static guint
clientname_hash (gpointer key)
{
return (int) key;
}
static void
server_log (gchar *format, ...)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment