[libgda] GdaServerProvider: using just internal resources for specs



commit ee1172f0a933f661912c0feec3ca44d0bd38ea9c
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Apr 22 11:44:04 2019 -0500

    GdaServerProvider: using just internal resources for specs

 libgda/gda-server-provider-extra.h             |  1 -
 libgda/gda-server-provider.c                   | 43 --------------------------
 providers/mysql/libmain.c                      | 10 +-----
 providers/postgres/libmain.c                   | 10 +-----
 providers/skel-implementation/capi/libmain.c   | 10 +-----
 providers/skel-implementation/models/libmain.c | 10 +-----
 providers/sqlite/libmain.c                     | 10 +-----
 tests/meson.build                              |  2 ++
 8 files changed, 7 insertions(+), 89 deletions(-)
---
diff --git a/libgda/gda-server-provider-extra.h b/libgda/gda-server-provider-extra.h
index 936518735..904db5097 100644
--- a/libgda/gda-server-provider-extra.h
+++ b/libgda/gda-server-provider-extra.h
@@ -82,7 +82,6 @@ void            _gda_server_provider_handlers_clear_for_cnc (GdaServerProvider *
  * misc
  */
 gchar         *gda_server_provider_find_file                (GdaServerProvider *prov, const gchar *inst_dir, 
const gchar *filename);
-gchar         *gda_server_provider_load_file_contents       (const gchar *inst_dir, const gchar *data_dir, 
const gchar *filename);
 gchar         *gda_server_provider_load_resource_contents   (const gchar *prov_name, const gchar *resource);
 
 G_END_DECLS
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index c289f6929..3f42d71f8 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -4306,49 +4306,6 @@ gda_server_provider_find_file (GdaServerProvider *prov, const gchar *inst_dir, c
        return file;
 }
 
-/**
- * gda_server_provider_load_file_contents:
- * @inst_dir: directory where the database provider has been installed
- * @data_dir: DATA directory to look for ($prefix/share)
- * @filename: name of the file to load
- *
- * Loads and returns the contents of @filename, which is searched in several places
- * This function should only be used by database provider's
- * implementations
- *
- * Returns: (transfer full): a new string containing @filename's contents, or %NULL if not found or if an 
error occurred
- */
-gchar *
-gda_server_provider_load_file_contents (const gchar *inst_dir, const gchar *data_dir, const gchar *filename)
-{
-       gchar *contents, *file;
-
-       file = g_build_filename (inst_dir, filename, NULL);
-
-       if (g_file_get_contents (file, &contents, NULL, NULL))
-               goto theend;
-
-       g_free (file);
-       file = g_build_filename (inst_dir, "..", filename, NULL);
-       if (g_file_get_contents (file, &contents, NULL, NULL))
-               goto theend;
-
-       g_free (file);
-       file = g_build_filename (data_dir, filename, NULL);
-       if (g_file_get_contents (file, &contents, NULL, NULL))
-               goto theend;
-
-       g_free (file);
-       file = g_build_filename (inst_dir, "..", "..", "..", "share", "libgda-6.0", filename, NULL);
-       if (g_file_get_contents (file, &contents, NULL, NULL))
-               goto theend;
-       contents = NULL;
-
- theend:
-       g_free (file);
-       return contents;
-}
-
 /**
  * gda_server_provider_load_resource_contents:
  * @prov_name: the provider's name
diff --git a/providers/mysql/libmain.c b/providers/mysql/libmain.c
index fc27a00f2..c6842004e 100644
--- a/providers/mysql/libmain.c
+++ b/providers/mysql/libmain.c
@@ -78,15 +78,7 @@ plugin_get_description (void)
 gchar *
 plugin_get_dsn_spec (void)
 {
-       gchar *ret, *dir;
-
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-       ret = gda_server_provider_load_file_contents (module_path, dir, "mysql_specs_dsn.xml");
-       g_free (dir);
-       if (ret)
-               return ret;
-       else
-               return gda_server_provider_load_resource_contents ("mysql", "mysql_specs_dsn.raw.xml");
+       return gda_server_provider_load_resource_contents ("mysql", "mysql_specs_dsn.raw.xml");
 }
 
 GdaServerProvider *
diff --git a/providers/postgres/libmain.c b/providers/postgres/libmain.c
index 66c990bab..66168a22c 100644
--- a/providers/postgres/libmain.c
+++ b/providers/postgres/libmain.c
@@ -85,15 +85,7 @@ plugin_get_description (void)
 gchar *
 plugin_get_dsn_spec (void)
 {
-       gchar *ret, *dir;
-
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-       ret = gda_server_provider_load_file_contents (module_path, dir, "postgres_specs_dsn.xml");
-       g_free (dir);
-       if (ret)
-               return ret;
-       else
-               return gda_server_provider_load_resource_contents ("postgres", "postgres_specs_dsn.raw.xml");
+  return gda_server_provider_load_resource_contents ("postgres", "postgres_specs_dsn.raw.xml");
 }
 
 GdaServerProvider *
diff --git a/providers/skel-implementation/capi/libmain.c b/providers/skel-implementation/capi/libmain.c
index 3678695fe..785c4241d 100644
--- a/providers/skel-implementation/capi/libmain.c
+++ b/providers/skel-implementation/capi/libmain.c
@@ -75,15 +75,7 @@ plugin_get_description (void)
 gchar *
 plugin_get_dsn_spec (void)
 {
-       gchar *ret, *dir;
-
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-       ret = gda_server_provider_load_file_contents (module_path, dir, "capi_specs_dsn.xml");
-       g_free (dir);
-       if (ret)
-               return ret;
-       else
-               return gda_server_provider_load_resource_contents ("capi", "capi_specs_dsn.raw.xml");
+       return gda_server_provider_load_resource_contents ("capi", "capi_specs_dsn.raw.xml");
 }
 
 GdaServerProvider *
diff --git a/providers/skel-implementation/models/libmain.c b/providers/skel-implementation/models/libmain.c
index eacd888e8..49684c6f9 100644
--- a/providers/skel-implementation/models/libmain.c
+++ b/providers/skel-implementation/models/libmain.c
@@ -76,15 +76,7 @@ plugin_get_description (void)
 gchar *
 plugin_get_dsn_spec (void)
 {
-       gchar *ret, *dir;
-
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-       ret = gda_server_provider_load_file_contents (module_path, dir, "models_specs_dsn.xml");
-       g_free (dir);
-       if (ret)
-               return ret;
-       else
-               return gda_server_provider_load_resource_contents ("models", "models_specs_dsn.raw.xml");
+       return gda_server_provider_load_resource_contents ("models", "models_specs_dsn.raw.xml");
 }
 
 gchar *
diff --git a/providers/sqlite/libmain.c b/providers/sqlite/libmain.c
index fb6a911a0..991c629cc 100644
--- a/providers/sqlite/libmain.c
+++ b/providers/sqlite/libmain.c
@@ -78,15 +78,7 @@ plugin_get_description (void)
 gchar *
 plugin_get_dsn_spec (void)
 {
-       gchar *ret, *dir;
-
-       dir = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, NULL);
-       ret = gda_server_provider_load_file_contents (module_path, dir, "sqlite_specs_dsn.xml");
-       g_free (dir);
-       if (ret)
-               return ret;
-       else
-               return gda_server_provider_load_resource_contents ("sqlite", "sqlite_specs_dsn.raw.xml");
+  return gda_server_provider_load_resource_contents ("sqlite", "sqlite_specs_dsn.raw.xml");
 }
 
 gchar *
diff --git a/tests/meson.build b/tests/meson.build
index bc9c22a0b..e71763a02 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -5,6 +5,8 @@ add_test_setup('valgrind',
        '--tool=memcheck',
        '--leak-check=full',
        '--leak-resolution=high',
+       '--show-leak-kinds=definite',
+       '--trace-children=yes',
        '--num-callers=20',
        '--suppressions='+join_paths(meson.current_source_dir (), 'gtk.suppression'),
        '--log-file=vgdump'],


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