[PATCH 2/3] storage: Move provider name loading to a function of its own

patrik.flykt at linux.intel.com patrik.flykt at linux.intel.com
Fri Feb 24 06:16:34 PST 2012


From: Patrik Flykt <patrik.flykt at linux.intel.com>

---
 src/storage.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/storage.c b/src/storage.c
index fdf4c99..978c51c 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -328,7 +328,7 @@ void __connman_storage_save_provider(GKeyFile *keyfile, const char *identifier)
 	g_free(pathname);
 }
 
-gchar **__connman_storage_get_providers(void)
+static gchar **get_providers_from_dir(const char *dirname)
 {
 	GSList *list = NULL;
 	int num = 0, i = 0;
@@ -340,7 +340,7 @@ gchar **__connman_storage_get_providers(void)
 	char **providers;
 	GSList *iter;
 
-	dir = opendir(STORAGEDIR);
+	dir = opendir(dirname);
 	if (dir == NULL)
 		return NULL;
 
@@ -351,7 +351,7 @@ gchar **__connman_storage_get_providers(void)
 			continue;
 
 		if (d->d_type == DT_DIR) {
-			str = g_strdup_printf("%s/%s/settings", STORAGEDIR,
+			str = g_strdup_printf("%s/%s/settings", dirname,
 					d->d_name);
 			ret = stat(str, &buf);
 			g_free(str);
@@ -377,6 +377,11 @@ gchar **__connman_storage_get_providers(void)
 	return providers;
 }
 
+gchar **__connman_storage_get_providers(void)
+{
+	return get_providers_from_dir(STORAGEDIR);
+}
+
 /*
  * This function migrates keys from default.profile to settings file.
  * This can be removed once the migration is over.
-- 
1.7.9




More information about the connman mailing list