From 484eb0cd0ae7117fa56f6d4094580128209981a4 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 23 Jan 2009 19:00:59 +0000 Subject: move conf_clear() and add proto. ok todd@ oga@ --- conf.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 7c075c1..22e6605 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.54 2009/01/23 18:58:40 oga Exp $ + * $Id: conf.c,v 1.55 2009/01/23 19:00:59 okan Exp $ */ #include "headers.h" @@ -159,6 +159,48 @@ conf_init(struct conf *c) c->DefaultFontName = xstrdup(DEFAULTFONTNAME); } +void +conf_clear(struct conf *c) +{ + struct autogroupwin *ag; + struct keybinding *kb; + struct winmatch *wm; + struct cmd *cmd; + struct mousebinding *mb; + + while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) { + TAILQ_REMOVE(&c->cmdq, cmd, entry); + free(cmd); + } + + while ((kb = TAILQ_FIRST(&c->keybindingq)) != NULL) { + TAILQ_REMOVE(&c->keybindingq, kb, entry); + free(kb); + } + + while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) { + TAILQ_REMOVE(&c->autogroupq, ag, entry); + free(ag->class); + if (ag->name) + free(ag->name); + free(ag->group); + free(ag); + } + + while ((wm = TAILQ_FIRST(&c->ignoreq)) != NULL) { + TAILQ_REMOVE(&c->ignoreq, wm, entry); + free(wm); + } + + while ((mb = TAILQ_FIRST(&c->mousebindingq)) != NULL) { + TAILQ_REMOVE(&c->mousebindingq, mb, entry); + free(mb); + } + + if (c->DefaultFontName != NULL) + free(c->DefaultFontName); +} + void conf_setup(struct conf *c, const char *conf_file) { -- cgit v1.2.3-2-gb3c3