Re: [gnome-db] Use of hash table improvement in gda-data-model.c



On Thu, 2002-05-09 at 08:07, Gonzalo Paniagua Javier wrote:
> 	Hi!
> 
> 	Attached is a patch that uses the number of column as the key
> 	for the hash table in gda-data-model.c
> 
> 	It works fine and avoid memory allocation/freeing for the keys
> 	in the hash table.
> 
looks ok, except this:
>  
>  static void
> -free_hash_string (gpointer key, gpointer value, gpointer user_data)
> -{
> -	g_free (key);
> -	g_free (value);
> -}
> -
why are you removing this function? The key does not need to be freed
anymore, but the value is g_strdup'ed, so it needs to be freed.

> -static void
>  gda_data_model_finalize (GObject *object)
>  {
>  	GdaDataModel *model = (GdaDataModel *) object;
> @@ -134,7 +144,6 @@
>  	g_return_if_fail (GDA_IS_DATA_MODEL (model));
>  
>  	/* free memory */
> -	g_hash_table_foreach (model->priv->column_titles, (GHFunc) free_hash_string, NULL);
>
here, you should keep this line.

fix this and commit please.

cheers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]