[Pkg-owncloud-commits] [owncloud-client] 42/332: CSync: Remove config dir setting

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 233450d850b71320db77aecc1a278f8659fa50c3
Author: Markus Goetz <markus at woboq.com>
Date:   Wed Jun 4 10:56:56 2014 +0200

    CSync: Remove config dir setting
---
 csync/src/csync.c                                  | 47 ----------------------
 csync/src/csync.h                                  | 29 -------------
 csync/src/csync_private.h                          |  1 -
 csync/tests/csync_tests/check_csync_commit.c       |  6 ---
 csync/tests/csync_tests/check_csync_create.c       |  3 --
 csync/tests/csync_tests/check_csync_exclude.c      |  8 ----
 csync/tests/csync_tests/check_csync_init.c         |  6 ---
 csync/tests/csync_tests/check_csync_log.c          |  3 --
 csync/tests/csync_tests/check_csync_statedb_load.c |  2 -
 .../tests/csync_tests/check_csync_statedb_query.c  |  2 -
 csync/tests/csync_tests/check_csync_update.c       |  4 --
 src/mirall/folder.cpp                              |  1 -
 12 files changed, 112 deletions(-)

diff --git a/csync/src/csync.c b/csync/src/csync.c
index 0d2db65..54d35e5 100644
--- a/csync/src/csync.c
+++ b/csync/src/csync.c
@@ -133,27 +133,6 @@ int csync_create(CSYNC **csync, const char *local, const char *remote) {
   ctx->pwd.uid = getuid();
   ctx->pwd.euid = geteuid();
 
-  home = csync_get_user_home_dir();
-  if (home == NULL) {
-    SAFE_FREE(ctx->local.uri);
-    SAFE_FREE(ctx->remote.uri);
-    SAFE_FREE(ctx);
-    errno = ENOMEM;
-    ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
-    return -1;
-  }
-
-  rc = asprintf(&ctx->options.config_dir, "%s/%s", home, CSYNC_CONF_DIR);
-  SAFE_FREE(home);
-  if (rc < 0) {
-    SAFE_FREE(ctx->local.uri);
-    SAFE_FREE(ctx->remote.uri);
-    SAFE_FREE(ctx);
-    errno = ENOMEM;
-    ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
-    return -1;
-  }
-
   ctx->local.list     = 0;
   ctx->remote.list    = 0;
   ctx->current_fs = NULL;
@@ -166,7 +145,6 @@ int csync_create(CSYNC **csync, const char *local, const char *remote) {
 
 int csync_init(CSYNC *ctx) {
   int rc;
-  char *config = NULL;
 
   if (ctx == NULL) {
     errno = EBADF;
@@ -212,7 +190,6 @@ int csync_init(CSYNC *ctx) {
   rc = 0;
 
 out:
-  SAFE_FREE(config);
   return rc;
 }
 
@@ -669,7 +646,6 @@ int csync_destroy(CSYNC *ctx) {
 
   SAFE_FREE(ctx->local.uri);
   SAFE_FREE(ctx->remote.uri);
-  SAFE_FREE(ctx->options.config_dir);
   SAFE_FREE(ctx->error_string);
 
   owncloud_destroy(ctx);
@@ -705,29 +681,6 @@ void csync_clear_exclude_list(CSYNC *ctx)
     csync_exclude_clear(ctx);
 }
 
-const char *csync_get_config_dir(CSYNC *ctx) {
-  if (ctx == NULL) {
-    return NULL;
-  }
-
-  return ctx->options.config_dir;
-}
-
-int csync_set_config_dir(CSYNC *ctx, const char *path) {
-  if (ctx == NULL || path == NULL) {
-    return -1;
-  }
-
-  SAFE_FREE(ctx->options.config_dir);
-  ctx->options.config_dir = c_strdup(path);
-  if (ctx->options.config_dir == NULL) {
-    ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
-    return -1;
-  }
-
-  return 0;
-}
-
 int csync_enable_statedb(CSYNC *ctx) {
   if (ctx == NULL) {
     return -1;
diff --git a/csync/src/csync.h b/csync/src/csync.h
index 3987b15..f4a1816 100644
--- a/csync/src/csync.h
+++ b/csync/src/csync.h
@@ -336,35 +336,6 @@ int csync_add_exclude_list(CSYNC *ctx, const char *path);
 void csync_clear_exclude_list(CSYNC *ctx);
 
 /**
- * @brief Get the config directory.
- *
- * @param ctx          The csync context.
- *
- * @return             The path of the config directory or NULL on error.
- */
-const char *csync_get_config_dir(CSYNC *ctx);
-
-/**
- * @brief Change the config directory.
- *
- * @param ctx           The csync context.
- *
- * @param path          The path to the new config directory.
- *
- * @return              0 on success, less than 0 if an error occured.
- */
-int csync_set_config_dir(CSYNC *ctx, const char *path);
-
-/**
- * @brief Remove the complete config directory.
- *
- * @param ctx           The csync context.
- *
- * @return              0 on success, less than 0 if an error occured.
- */
-int csync_remove_config_dir(CSYNC *ctx);
-
-/**
  * @brief Enable the usage of the statedb. It is enabled by default.
  *
  * @param ctx           The csync context.
diff --git a/csync/src/csync_private.h b/csync/src/csync_private.h
index cd6c79b..946a601 100644
--- a/csync/src/csync_private.h
+++ b/csync/src/csync_private.h
@@ -120,7 +120,6 @@ struct csync_s {
 
   struct {
     int sync_symbolic_links;
-    char *config_dir;
     int timeout;
 #if defined(HAVE_ICONV) && defined(WITH_ICONV)
     iconv_t iconv_cd;
diff --git a/csync/tests/csync_tests/check_csync_commit.c b/csync/tests/csync_tests/check_csync_commit.c
index f60c96b..adace42 100644
--- a/csync/tests/csync_tests/check_csync_commit.c
+++ b/csync/tests/csync_tests/check_csync_commit.c
@@ -36,9 +36,6 @@ static void setup(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
-
     *state = csync;
 }
 
@@ -55,9 +52,6 @@ static void setup_module(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
     assert_int_equal(rc, 0);
 
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
-
     rc = csync_init(csync);
     *state = csync;
 }
diff --git a/csync/tests/csync_tests/check_csync_create.c b/csync/tests/csync_tests/check_csync_create.c
index 37c82a8..bf4e5c8 100644
--- a/csync/tests/csync_tests/check_csync_create.c
+++ b/csync/tests/csync_tests/check_csync_create.c
@@ -46,9 +46,6 @@ static void check_csync_create(void **state)
     rc = csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
     assert_int_equal(rc, 0);
 
-    snprintf(confdir, sizeof(confdir), "%s/%s", getenv("HOME"), CSYNC_CONF_DIR);
-    assert_string_equal(csync->options.config_dir, confdir);
-
     rc = csync_destroy(csync);
     assert_int_equal(rc, 0);
 }
diff --git a/csync/tests/csync_tests/check_csync_exclude.c b/csync/tests/csync_tests/check_csync_exclude.c
index 575560e..f1fcb37 100644
--- a/csync/tests/csync_tests/check_csync_exclude.c
+++ b/csync/tests/csync_tests/check_csync_exclude.c
@@ -32,10 +32,6 @@ static void setup(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    free(csync->options.config_dir);
-    csync->options.config_dir = c_strdup("/tmp/check_csync1/");
-    assert_non_null(csync->options.config_dir);
-
     *state = csync;
 }
 
@@ -46,10 +42,6 @@ static void setup_init(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    free(csync->options.config_dir);
-    csync->options.config_dir = c_strdup("/tmp/check_csync1/");
-    assert_non_null(csync->options.config_dir);
-
     rc = csync_exclude_load(csync, SOURCEDIR "/../sync-exclude.lst");
     assert_int_equal(rc, 0);
 
diff --git a/csync/tests/csync_tests/check_csync_init.c b/csync/tests/csync_tests/check_csync_init.c
index a92121e..febf386 100644
--- a/csync/tests/csync_tests/check_csync_init.c
+++ b/csync/tests/csync_tests/check_csync_init.c
@@ -36,9 +36,6 @@ static void setup(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
-
     *state = csync;
 }
 
@@ -55,9 +52,6 @@ static void setup_module(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
     assert_int_equal(rc, 0);
 
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
-
     *state = csync;
 }
 
diff --git a/csync/tests/csync_tests/check_csync_log.c b/csync/tests/csync_tests/check_csync_log.c
index 954ad68..4c88c14 100644
--- a/csync/tests/csync_tests/check_csync_log.c
+++ b/csync/tests/csync_tests/check_csync_log.c
@@ -40,9 +40,6 @@ static void setup(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
-
     *state = csync;
 }
 
diff --git a/csync/tests/csync_tests/check_csync_statedb_load.c b/csync/tests/csync_tests/check_csync_statedb_load.c
index d2ff281..fd43ff6 100644
--- a/csync/tests/csync_tests/check_csync_statedb_load.c
+++ b/csync/tests/csync_tests/check_csync_statedb_load.c
@@ -40,8 +40,6 @@ static void setup(void **state) {
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    csync_set_config_dir(csync, "/tmp/check_csync1/");
-
     csync->statedb.file = c_strdup( TESTDB );
     *state = csync;
 }
diff --git a/csync/tests/csync_tests/check_csync_statedb_query.c b/csync/tests/csync_tests/check_csync_statedb_query.c
index 6e8e74f..2021686 100644
--- a/csync/tests/csync_tests/check_csync_statedb_query.c
+++ b/csync/tests/csync_tests/check_csync_statedb_query.c
@@ -44,8 +44,6 @@ static void setup(void **state)
     assert_int_equal(rc, 0);
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
-    rc = csync_set_config_dir(csync, "/tmp/check_csync/");
-    assert_int_equal(rc, 0);
     rc = csync_init(csync);
     assert_int_equal(rc, 0);
 
diff --git a/csync/tests/csync_tests/check_csync_update.c b/csync/tests/csync_tests/check_csync_update.c
index 3aa5ecd..79fc17f 100644
--- a/csync/tests/csync_tests/check_csync_update.c
+++ b/csync/tests/csync_tests/check_csync_update.c
@@ -36,8 +36,6 @@ static void setup(void **state)
     assert_int_equal(rc, 0);
     rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
     assert_int_equal(rc, 0);
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
     rc = csync_init(csync);
     assert_int_equal(rc, 0);
     rc = csync_statedb_load(csync, TESTDB, &csync->statedb.db);
@@ -60,8 +58,6 @@ static void setup_ftw(void **state)
     assert_int_equal(rc, 0);
     rc = csync_create(&csync, "/tmp", "/tmp");
     assert_int_equal(rc, 0);
-    rc = csync_set_config_dir(csync, "/tmp/check_csync");
-    assert_int_equal(rc, 0);
     rc = csync_init(csync);
     assert_int_equal(rc, 0);
     rc = csync_statedb_load(csync, TESTDB, &csync->statedb.db);
diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index bd59055..72c0223 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -122,7 +122,6 @@ bool Folder::init()
         csync_set_log_level( 11 );
 
         MirallConfigFile cfgFile;
-        csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() );
 
         setIgnoredFiles();
         if (Account *account = AccountManager::instance()->account()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list