[Libosinfo] [libosinfo 2/2] Use g_getenv() instead of getenv()

Christophe Fergeau cfergeau at redhat.com
Thu Mar 28 11:06:47 UTC 2013


It's likely to be more portable
---
 osinfo/osinfo_loader.c | 2 +-
 test/test-mediauris.c  | 6 +++---
 test/test-treeuris.c   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index e4dbef7..89bea31 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1788,7 +1788,7 @@ void osinfo_loader_process_system_path(OsinfoLoader *loader,
 {
     GFile *file;
     gchar *dbdir;
-    const gchar *path = getenv("OSINFO_DATA_DIR");
+    const gchar *path = g_getenv("OSINFO_DATA_DIR");
     if (!path)
         path = PKG_DATA_DIR;
 
diff --git a/test/test-mediauris.c b/test/test-mediauris.c
index 191e8c6..cb876be 100644
--- a/test/test-mediauris.c
+++ b/test/test-mediauris.c
@@ -66,7 +66,7 @@ START_TEST(test_uris)
     GError *error = NULL;
     OsinfoOsList *oslist = NULL;
     GList *osel = NULL, *tmp;
-    gchar *debugstr;
+    const gchar *debugstr;
 
     session = soup_session_async_new_with_options(
 #ifdef HAVE_LIBSOUP_GNOME
@@ -74,7 +74,7 @@ START_TEST(test_uris)
                                                   SOUP_TYPE_PROXY_RESOLVER_GNOME,
 #endif
                                                   NULL);
-    if ((debugstr = getenv("LIBOSINFO_TEST_DEBUG"))) {
+    if ((debugstr = g_getenv("LIBOSINFO_TEST_DEBUG"))) {
         SoupLogger *logger;
         int debug_level = atoi(debugstr);
 
@@ -131,7 +131,7 @@ int main(void)
     Suite *s = list_suite ();
     SRunner *sr = srunner_create (s);
 
-    if (!getenv("LIBOSINFO_NETWORK_TESTS"))
+    if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
         return 77; /* Skip */
 
 #if !GLIB_CHECK_VERSION(2,35,1)
diff --git a/test/test-treeuris.c b/test/test-treeuris.c
index 07f14bf..d257004 100644
--- a/test/test-treeuris.c
+++ b/test/test-treeuris.c
@@ -66,7 +66,7 @@ START_TEST(test_uris)
     GError *error = NULL;
     OsinfoOsList *oslist = NULL;
     GList *osel = NULL, *tmp;
-    gchar *debugstr;
+    const gchar *debugstr;
 
     session = soup_session_async_new_with_options(
 #ifdef HAVE_LIBSOUP_GNOME
@@ -74,7 +74,7 @@ START_TEST(test_uris)
                                                   SOUP_TYPE_PROXY_RESOLVER_GNOME,
 #endif
                                                   NULL);
-    if ((debugstr = getenv("LIBOSINFO_TEST_DEBUG"))) {
+    if ((debugstr = g_getenv("LIBOSINFO_TEST_DEBUG"))) {
         SoupLogger *logger;
         int debug_level = atoi(debugstr);
 
@@ -131,7 +131,7 @@ int main(void)
     Suite *s = list_suite ();
     SRunner *sr = srunner_create (s);
 
-    if (!getenv("LIBOSINFO_NETWORK_TESTS"))
+    if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
         return 77; /* Skip */
 
 #if !GLIB_CHECK_VERSION(2,35,1)
-- 
1.8.1.4




More information about the Libosinfo mailing list