config-parser: Add section iterator API

The X backend needs to iterate through all outputs.
diff --git a/shared/config-parser-test.c b/shared/config-parser-test.c
index 11eb9aa..86843a0 100644
--- a/shared/config-parser-test.c
+++ b/shared/config-parser-test.c
@@ -75,6 +75,10 @@
 	"color=red\n"
 	"contents=sand\n";
 
+static const char *section_names[] = {
+	"foo", "bar", "stuff", "bucket", "bucket"
+};
+
 static const char t2[] =
 	"# invalid section...\n"
 	"[this bracket isn't closed\n";
@@ -93,8 +97,9 @@
 {
 	struct weston_config *config;
 	struct weston_config_section *section;
+	const char *name;
 	char *s;
-	int r, b;
+	int r, b, i;
 	int32_t n;
 	uint32_t u;
 
@@ -170,6 +175,12 @@
 	assert(r == -1 && errno == ENOENT && strcmp(s, "eels") == 0);
 	free(s);
 
+	section = NULL;
+	i = 0;
+	while (weston_config_next_section(config, &section, &name))
+		assert(strcmp(section_names[i++], name) == 0);
+	assert(i == 5);
+
 	weston_config_destroy(config);
 
 	config = run_test(t2);