[libgda/LIBGDA_4.2] Removed compilation warnings in test programs
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] Removed compilation warnings in test programs
- Date: Thu, 28 Apr 2011 20:15:20 +0000 (UTC)
commit 2c6572f244d580a76972c7292e9af5fa49bc389d
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu Apr 28 21:55:19 2011 +0200
Removed compilation warnings in test programs
tests/data-models/check_model_copy.c | 3 +-
tests/data-models/check_model_import.c | 3 +-
tests/data-models/check_pmodel.c | 43 ++++++++++++++++++-------------
tests/meta-store/common.c | 2 +-
tests/providers/prov-test-common.c | 2 +-
tests/value-holders/check_statement.c | 2 +-
6 files changed, 32 insertions(+), 23 deletions(-)
---
diff --git a/tests/data-models/check_model_copy.c b/tests/data-models/check_model_copy.c
index 756d5be..97ddc90 100644
--- a/tests/data-models/check_model_copy.c
+++ b/tests/data-models/check_model_copy.c
@@ -51,6 +51,7 @@ main (int argc, char **argv)
}
}
g_free (dirname);
+ g_dir_close (dir);
/* data models in the current dir */
dirname = g_build_filename (CHECK_FILES, "tests", "data-models", NULL);
@@ -72,8 +73,8 @@ main (int argc, char **argv)
}
}
g_free (dirname);
+ g_dir_close (dir);
}
- g_dir_close (dir);
if (number_failed == 0)
g_print ("Ok.\n");
diff --git a/tests/data-models/check_model_import.c b/tests/data-models/check_model_import.c
index be3d0ce..ee8ee12 100644
--- a/tests/data-models/check_model_import.c
+++ b/tests/data-models/check_model_import.c
@@ -49,6 +49,7 @@ main (int argc, char **argv)
}
}
g_free (dirname);
+ g_dir_close (dir);
/* data models in the current dir */
dirname = g_build_filename (CHECK_FILES, "tests", "data-models", NULL);
@@ -70,8 +71,8 @@ main (int argc, char **argv)
}
}
g_free (dirname);
+ g_dir_close (dir);
}
- g_dir_close (dir);
if (number_failed == 0)
g_print ("Ok.\n");
diff --git a/tests/data-models/check_pmodel.c b/tests/data-models/check_pmodel.c
index c343f59..a3260c5 100644
--- a/tests/data-models/check_pmodel.c
+++ b/tests/data-models/check_pmodel.c
@@ -300,7 +300,7 @@ static gint
test2 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *model;
+ GdaDataModel *model = NULL;
GdaStatement *stmt, *mod_stmt;
gint nfailed = 0;
GdaSet *params;
@@ -365,8 +365,9 @@ test2 (GdaConnection *cnc)
goto out;
}
- out:
- g_object_unref (model);
+ out:
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
return nfailed;
@@ -809,7 +810,7 @@ static gint
test7 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *model;
+ GdaDataModel *model = NULL;
GdaStatement *stmt;
gint nfailed = 0;
GdaSet *params;
@@ -865,8 +866,9 @@ test7 (GdaConnection *cnc)
}
gda_value_free (value);
- out:
- g_object_unref (model);
+ out:
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
g_object_unref (params);
@@ -945,7 +947,7 @@ static gint
test9 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *model;
+ GdaDataModel *model = NULL;
GdaStatement *stmt;
gint nfailed = 0;
GdaSet *params;
@@ -1013,8 +1015,9 @@ test9 (GdaConnection *cnc)
gda_value_free (value);
clear_signals ();
- out:
- g_object_unref (model);
+ out:
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
g_object_unref (params);
@@ -1031,7 +1034,7 @@ static gint
test10 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *model, *copy;
+ GdaDataModel *model = NULL, *copy;
GdaStatement *stmt;
gint nfailed = 0;
GdaSet *params;
@@ -1099,8 +1102,9 @@ test10 (GdaConnection *cnc)
g_object_unref (cmp);
g_object_unref (copy);
- out:
- g_object_unref (model);
+ out:
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
g_object_unref (params);
@@ -1116,7 +1120,7 @@ static gint
test11 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *ramodel, *model;
+ GdaDataModel *ramodel = NULL, *model = NULL;
GdaStatement *stmt;
gint nfailed = 0;
GdaSet *params;
@@ -1217,9 +1221,11 @@ test11 (GdaConnection *cnc)
}
g_object_unref (iter);
- out:
- g_object_unref (ramodel);
- g_object_unref (model);
+ out:
+ if (ramodel)
+ g_object_unref (ramodel);
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
g_object_unref (params);
@@ -1567,7 +1573,7 @@ static gint
test15 (GdaConnection *cnc)
{
GError *error = NULL;
- GdaDataModel *model, *rerun;
+ GdaDataModel *model = NULL, *rerun;
GdaStatement *stmt;
GdaSet *params;
gint nfailed = 0;
@@ -1628,7 +1634,8 @@ test15 (GdaConnection *cnc)
g_object_unref (rerun);
out:
- g_object_unref (model);
+ if (model)
+ g_object_unref (model);
g_object_unref (stmt);
return nfailed;
diff --git a/tests/meta-store/common.c b/tests/meta-store/common.c
index 4796d53..c3d0c84 100644
--- a/tests/meta-store/common.c
+++ b/tests/meta-store/common.c
@@ -97,7 +97,7 @@ find_expected_change (const gchar *change_as_str)
static void
meta_changed_cb (GdaMetaStore *store, GSList *changes, gpointer data)
{
- GSList *gl, *el;
+ GSList *gl;
gint i;
for (i = 0, gl = changes; gl; gl = gl->next) {
gchar *gstr = stringify_a_change ((GdaMetaStoreChange *) gl->data);
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 61fae18..ebb249e 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -93,7 +93,7 @@ int
prov_test_common_check_meta ()
{
int number_failed = 0;
- GSList *tables, *list;
+ GSList *tables = NULL, *list;
gboolean dump_ok = TRUE;
GdaMetaStore *store;
gchar **dump1 = NULL;
diff --git a/tests/value-holders/check_statement.c b/tests/value-holders/check_statement.c
index ad274f4..049b04d 100644
--- a/tests/value-holders/check_statement.c
+++ b/tests/value-holders/check_statement.c
@@ -119,7 +119,7 @@ test1 (GError **error)
static gboolean
test2 (GError **error)
{
- GdaSqlParser *parser;
+ GdaSqlParser *parser = NULL;
GHashTable *parsers_hash;
GdaDataModel *providers_model;
gint i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]