[libgda: 1/2] Control Center: Fix bug in comparing dsn strings
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda: 1/2] Control Center: Fix bug in comparing dsn strings
- Date: Sun, 24 May 2020 00:32:22 +0000 (UTC)
commit 178b751c98acc1b3308ef500246703ce47f8d10c
Author: Pavlo Solntsev <p sun fun gmail com>
Date: Tue May 12 13:26:49 2020 -0500
Control Center: Fix bug in comparing dsn strings
The current implementation contains bug that doesn't allow
for loop execution. Tho pointers passed to the for loop
are NULL.
libgda/gda-config.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index 7e0415320..1ec424899 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -183,6 +183,18 @@ gboolean string_equal (const gchar *s1, const gchar *s2)
return s2 ? FALSE : TRUE;
}
+static void gda_quark_process (gpointer key,
+ gpointer value,
+ gpointer string)
+{
+ gchar *evalue;
+
+ g_string_append_c ((GString *)string, ',');
+ evalue = gda_rfc1738_encode ((const gchar *)value);
+ g_string_append_printf ((GString *)string, ",%s=%s", (gchar *)key, evalue);
+ g_free (evalue);
+}
+
static gchar *
make_cmp_string (const gchar *key_values_string)
{
@@ -191,22 +203,9 @@ make_cmp_string (const gchar *key_values_string)
GdaQuarkList *ql;
GSList *list, *sorted_list = NULL;
- GString *string = NULL;
+ GString *string = g_string_new("");
ql = gda_quark_list_new_from_string (key_values_string);
- for (list = sorted_list; list; list = list->next) {
- const gchar *value;
- gchar *evalue;
-
- if (!string)
- string = g_string_new ("");
- else
- g_string_append_c (string, ',');
-
- value = gda_quark_list_find (ql, (gchar *) list->data);
- evalue = gda_rfc1738_encode (value);
- g_string_append_printf (string, ",%s=%s", (gchar *) list->data, evalue);
- g_free (evalue);
- }
+ gda_quark_list_foreach (ql, gda_quark_process, string);
gda_quark_list_free (ql);
if (string)
return g_string_free (string, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]