--- ermyth/src/conf.C 2007/09/16 18:54:44 1.9 +++ ermyth/src/conf.C 2007/09/22 14:27:30 1.10 @@ -10,7 +10,7 @@ * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) */ -static char const rcsid[] = "$Id: conf.C,v 1.9 2007/09/16 18:54:44 pippijn Exp $"; +static char const rcsid[] = "$Id: conf.C,v 1.10 2007/09/22 14:27:30 pippijn Exp $"; #include "atheme.h" #include "confparse.h" @@ -26,6 +26,8 @@ ConfTable::callbacks ConfTable::callback; +static void deinit_conf (void); + enum config_error { no_param, @@ -301,6 +303,22 @@ } void +conf_cleanup () +{ + me.cleanup (); + + if (config_options.chan) + sfree (config_options.chan); + if (config_options.global) + sfree (config_options.global); + + if (chansvs.trigger != NULL) + sfree (chansvs.trigger); + + deinit_conf (); +} + +void conf_init (void) { me.init (); @@ -310,8 +328,6 @@ sfree (config_options.chan); if (config_options.global) sfree (config_options.global); - if (config_options.languagefile) - sfree (config_options.languagefile); chansvs.nick = config_options.chan = config_options.global = config_options.languagefile = NULL; @@ -328,8 +344,6 @@ me.mdlimit = 30; chansvs.fantasy = false; - if (chansvs.me != NULL && fcmd_agent == chansvs.me) - fcmd_agent = NULL; chansvs.ca_vop = CA_VOP_DEF & ca_all; chansvs.ca_hop = CA_HOP_DEF & ca_all; chansvs.ca_aop = CA_AOP_DEF & ca_all; @@ -624,7 +638,7 @@ add_conf_item ("PORT", conf_db_table, c_db_port); } -void +static void deinit_conf (void) { #if 0 @@ -920,7 +934,7 @@ else if (isdigit (ce->vardata ()[0])) slog (LG_ERROR, "%s:%d: uplink's server name %s starts with a digit, probably invalid (continuing anyway)", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->vardata ()); - name = sstrdup (ce->vardata ()); + name = ce->vardata (); for (ce = ce->ce_entries; ce; ce = ce->ce_next) { @@ -929,21 +943,21 @@ if (ce->vardata () == NULL) return param_error (ce); - host = sstrdup (ce->vardata ()); + host = ce->vardata (); } else if (!strcasecmp ("VHOST", ce->ce_varname)) { if (ce->vardata () == NULL) return param_error (ce); - vhost = sstrdup (ce->vardata ()); + vhost = ce->vardata (); } else if (!strcasecmp ("PASSWORD", ce->ce_varname)) { if (ce->vardata () == NULL) return param_error (ce); - password = sstrdup (ce->vardata ()); + password = ce->vardata (); } else if (!strcasecmp ("PORT", ce->ce_varname)) { @@ -961,11 +975,6 @@ uplink_add (name, host, password, vhost, port); - sfree (name); - sfree (host); - sfree (password); - sfree (vhost); - return 0; } @@ -1414,9 +1423,6 @@ { chansvs.fantasy = true; - if (chansvs.me != NULL) - fcmd_agent = chansvs.me; - return 0; } @@ -2165,7 +2171,7 @@ /* freeing the new conf strings */ sfree (chansvs.nick); - me.fini (); + me.cleanup (); /* return everything to the way it was before */ me = hold_me;