summaryrefslogtreecommitdiff
path: root/src/lib-config
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-09-22 14:53:54 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-09-22 14:53:54 +0000
commit5976d82fa7f13e4fbad576e926459179aaa83f82 (patch)
tree9f58e65baf5713c6800c07ea694a2976eefd1ebd /src/lib-config
parentbb507a8b85aaa04a6f8861592c31ebad4ca30df8 (diff)
downloadirssi-5976d82fa7f13e4fbad576e926459179aaa83f82.zip
config_node_next() - Returns the next non-comment node in list. Use this
function when reading blocks/lists in config file. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1811 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/lib-config')
-rw-r--r--src/lib-config/get.c14
-rw-r--r--src/lib-config/iconfig.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/lib-config/get.c b/src/lib-config/get.c
index 98e2a30b..21b97251 100644
--- a/src/lib-config/get.c
+++ b/src/lib-config/get.c
@@ -308,3 +308,17 @@ CONFIG_NODE *config_node_index(CONFIG_NODE *node, int index)
return NULL;
}
+
+/* Returns the next non-comment node in list */
+GSList *config_node_next(GSList *list)
+{
+ list = list->next;
+ while (list != NULL) {
+ CONFIG_NODE *node = list->data;
+
+ if (node->type != NODE_TYPE_COMMENT)
+ break;
+ list = list->next;
+ }
+ return list;
+}
diff --git a/src/lib-config/iconfig.h b/src/lib-config/iconfig.h
index ea2e6c37..d63af031 100644
--- a/src/lib-config/iconfig.h
+++ b/src/lib-config/iconfig.h
@@ -99,6 +99,8 @@ const char *config_list_find(CONFIG_REC *rec, const char *section, const char *k
CONFIG_NODE *config_list_find_node(CONFIG_REC *rec, const char *section, const char *key, const char *value, const char *value_key);
/* Returns n'th node from list. */
CONFIG_NODE *config_node_index(CONFIG_NODE *node, int index);
+/* Returns the next non-comment node in list */
+GSList *config_node_next(GSList *list);
/* Setting values */
int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value);