[gnome-db] gda-quark-list
- From: Laurent Sansonetti <laurent datarescue be>
- To: GDA <gnome-db-list gnome org>
- Subject: [gnome-db] gda-quark-list
- Date: Tue, 07 Oct 2003 16:28:41 +0000
Hi all,
While I was binding gda_quark_list in Ruby, I noticed that
gda_quark_list_add_from_string() did not care about the 'cleanup'
boolean parameter.
Here is a patch to fix this. The patch also introduces
gda_quark_list_clear(), which is used in both
gda_quark_list_add_from_string() and gda_quark_list_free().
Hope you will find it interesting. I'm ready to change it if it's not
appropriate.
Cheers,
--
{ "Laurent" => "http://lrz.samika.net" }
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgda/ChangeLog,v
retrieving revision 1.569
diff -u -r1.569 ChangeLog
--- ChangeLog 2 Oct 2003 21:02:19 -0000 1.569
+++ ChangeLog 7 Oct 2003 13:25:53 -0000
@@ -1,3 +1,10 @@
+2003-10-07 Laurent Sansonetti <laurent datarescue be>
+
+ * libgda/gda-quark-list.c:
+ * libgda/gda-quark-list.h: introduced gda_quark_list_clear() +
+ gda_quark_list_add_from_string() takes care of the 'cleanup'
+ boolean parameter.
+
2003-10-01 Murray Cumming <murrayc usa net>
* libgda/Makefile.am: Use glib-mkenums to generate
Index: libgda/gda-quark-list.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-quark-list.c,v
retrieving revision 1.6
diff -u -r1.6 gda-quark-list.c
--- libgda/gda-quark-list.c 1 Sep 2003 23:24:10 -0000 1.6
+++ libgda/gda-quark-list.c 7 Oct 2003 13:25:53 -0000
@@ -82,6 +82,22 @@
}
/**
+ * gda_quark_list_clear
+ * @qlist: a #GdaQuarkList.
+ *
+ * Remove all strings in the given #GdaQuarkList.
+ */
+void
+gda_quark_list_clear(GdaQuarkList *qlist)
+{
+ g_return_if_fail (qlist != NULL);
+
+ g_hash_table_foreach_remove (qlist->hash_table,
+ (GHRFunc) free_hash_pair,
+ g_free);
+}
+
+/**
* gda_quark_list_free
* @qlist: a #GdaQuarkList.
*
@@ -92,9 +108,7 @@
{
g_return_if_fail (qlist != NULL);
- g_hash_table_foreach_remove (qlist->hash_table,
- (GHRFunc) free_hash_pair,
- g_free);
+ gda_quark_list_clear(qlist);
g_hash_table_destroy (qlist->hash_table);
g_free (qlist);
@@ -104,7 +118,7 @@
* gda_quark_list_add_from_string
* @qlist: a #GdaQuarkList.
* @string: a connection string.
- * @cleanup: whther to cleanup the previous content or not.
+ * @cleanup: whether to cleanup the previous content or not.
*
* Add new key->value pairs from the given @string. If @cleanup is
* set to TRUE, the previous contents will be discarded before adding
@@ -120,7 +134,8 @@
g_return_if_fail (qlist != NULL);
g_return_if_fail (string != NULL);
- /* FIXME: remove all strings if cleanup != FALSE */
+ if (cleanup != FALSE)
+ gda_quark_list_clear(qlist);
arr = (gchar **) g_strsplit (string, ";", 0);
if (arr) {
Index: libgda/gda-quark-list.h
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-quark-list.h,v
retrieving revision 1.5
diff -u -r1.5 gda-quark-list.h
--- libgda/gda-quark-list.h 5 Jun 2002 10:58:21 -0000 1.5
+++ libgda/gda-quark-list.h 7 Oct 2003 13:25:53 -0000
@@ -39,6 +39,7 @@
gboolean cleanup);
const gchar *gda_quark_list_find (GdaQuarkList *qlist, const gchar *name);
void gda_quark_list_remove (GdaQuarkList *qlist, const gchar *name);
+void gda_quark_list_clear (GdaQuarkList *qlist);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]