libcharon: Remove unused charon->name
authorTobias Brunner <tobias@strongswan.org>
Wed, 22 Jan 2014 14:19:44 +0000 (15:19 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 12 Feb 2014 13:34:33 +0000 (14:34 +0100)
src/charon-cmd/charon-cmd.c
src/charon-nm/charon-nm.c
src/charon-tkm/src/charon-tkm.c
src/charon-tkm/tests/tests.c
src/charon/charon.c
src/conftest/conftest.c
src/frontends/android/jni/libandroidbridge/charonservice.c
src/frontends/osx/charon-xpc/charon-xpc.c
src/libcharon/daemon.c
src/libcharon/daemon.h

index e7e0c9d..a70d314 100644 (file)
@@ -339,7 +339,7 @@ int main(int argc, char *argv[])
                exit(SS_RC_INITIALIZATION_FAILED);
        }
        atexit(libcharon_deinit);
-       if (!libcharon_init("charon-cmd"))
+       if (!libcharon_init())
        {
                exit(SS_RC_INITIALIZATION_FAILED);
        }
index 830d44b..32cec36 100644 (file)
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
                exit(SS_RC_INITIALIZATION_FAILED);
        }
 
-       if (!libcharon_init("charon-nm"))
+       if (!libcharon_init())
        {
                dbg_syslog(DBG_DMN, 1, "initialization failed - aborting charon-nm");
                goto deinit;
index 1b9fc1c..9a22f9a 100644 (file)
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
                exit(status);
        }
 
-       if (!libcharon_init(dmn_name))
+       if (!libcharon_init())
        {
                dbg_syslog(DBG_DMN, 1, "initialization failed - aborting %s", dmn_name);
                goto deinit;
index e6e3f30..18754c7 100644 (file)
@@ -51,7 +51,7 @@ static bool test_runner_init(bool init)
        if (init)
        {
                libhydra_init();
-               libcharon_init("test_runner");
+               libcharon_init();
                lib->settings->set_int(lib->settings,
                                                           "test_runner.filelog.stdout.default", 0);
                charon->load_loggers(charon, NULL, FALSE);
index 8a89c76..089ac45 100644 (file)
@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
                exit(SS_RC_INITIALIZATION_FAILED);
        }
 
-       if (!libcharon_init("charon"))
+       if (!libcharon_init())
        {
                dbg_stderr(DBG_DMN, 1, "initialization failed - aborting charon");
                goto deinit;
index d26991f..ac6d697 100644 (file)
@@ -446,7 +446,7 @@ int main(int argc, char *argv[])
                library_deinit();
                return SS_RC_INITIALIZATION_FAILED;
        }
-       if (!libcharon_init("conftest"))
+       if (!libcharon_init())
        {
                libcharon_deinit();
                libhydra_deinit();
index b50d5ac..03351b7 100644 (file)
@@ -626,7 +626,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, jboolean,
                return FALSE;
        }
 
-       if (!libcharon_init("charon"))
+       if (!libcharon_init())
        {
                libcharon_deinit();
                libipsec_deinit();
index 4b7cd3a..2235be1 100644 (file)
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
                exit(SS_RC_INITIALIZATION_FAILED);
        }
        atexit(libcharon_deinit);
-       if (!libcharon_init("charon-xpc"))
+       if (!libcharon_init())
        {
                exit(SS_RC_INITIALIZATION_FAILED);
        }
index 682b0ee..0cecd1d 100644 (file)
@@ -473,7 +473,6 @@ static void destroy(private_daemon_t *this)
        DESTROY_IF(this->public.bus);
        this->loggers->destroy_function(this->loggers, (void*)logger_entry_destroy);
        this->mutex->destroy(this->mutex);
-       free((void*)this->public.name);
        free(this);
 }
 
@@ -558,7 +557,7 @@ METHOD(daemon_t, initialize, bool,
 /**
  * Create the daemon.
  */
-private_daemon_t *daemon_create(const char *name)
+private_daemon_t *daemon_create()
 {
        private_daemon_t *this;
 
@@ -569,7 +568,6 @@ private_daemon_t *daemon_create(const char *name)
                        .load_loggers = _load_loggers,
                        .set_level = _set_level,
                        .bus = bus_create(),
-                       .name = strdup(name ?: "libcharon"),
                },
                .loggers = linked_list_create(),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
@@ -607,7 +605,7 @@ void libcharon_deinit()
 /**
  * Described in header.
  */
-bool libcharon_init(const char *name)
+bool libcharon_init()
 {
        private_daemon_t *this;
 
@@ -618,7 +616,7 @@ bool libcharon_init(const char *name)
                return !this->integrity_failed;
        }
 
-       this = daemon_create(name);
+       this = daemon_create();
 
        /* for uncritical pseudo random numbers */
        srandom(time(NULL) + getpid());
index 24e623c..36242bb 100644 (file)
@@ -272,11 +272,6 @@ struct daemon_t {
 #endif /* ME */
 
        /**
-        * Name of the binary that uses the library (used for settings etc.)
-        */
-       const char *name;
-
-       /**
         * Initialize the daemon.
         *
         * @param plugins       list of plugins to load
@@ -324,12 +319,11 @@ extern daemon_t *charon;
  * calling initialize().
  *
  * libcharon_init() may be called multiple times in a single process, but each
- * caller should call libcharon_deinit() for each call to libcharon_init().
+ * caller must call libcharon_deinit() for each call to libcharon_init().
  *
- * @param name name of the binary that uses the library
  * @return             FALSE if integrity check failed
  */
-bool libcharon_init(const char *name);
+bool libcharon_init();
 
 /**
  * Deinitialize libcharon and destroy the "charon" instance of daemon_t.