summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/conf.c b/conf.c
index 7054431..b8ecc40 100644
--- a/conf.c
+++ b/conf.c
@@ -160,6 +160,48 @@ conf_init(struct conf *c)
 }
 
 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)
 {
 	struct stat	 sb;