diff options
Diffstat (limited to 'conf')
-rw-r--r-- | conf/conf.c | 17 | ||||
-rw-r--r-- | conf/conf.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/conf/conf.c b/conf/conf.c index f27147e5..fc8e3c46 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -199,6 +199,23 @@ config_free(struct config *c) rfree(c->pool); } +/** + * config_free_old - free stored old configuration + * + * This function frees the old configuration (%old_config) that is saved for the + * purpose of undo. It is useful before parsing a new config when reconfig is + * requested, to avoid keeping three (perhaps memory-heavy) configs together. + */ +void +config_free_old(void) +{ + tm_stop(config_timer); + undo_available = 0; + + config_free(old_config); + old_config = NULL; +} + void config_add_obstacle(struct config *c) { diff --git a/conf/conf.h b/conf/conf.h index 9f011ef7..b30914c1 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -71,6 +71,7 @@ struct config *config_alloc(const char *name); int config_parse(struct config *); int cli_parse(struct config *); void config_free(struct config *); +void config_free_old(void); int config_commit(struct config *, int type, uint timeout); int config_confirm(void); int config_undo(void); |