diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-22 12:19:51 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-22 12:19:51 -0500 |
commit | 27848b41ab9552b7894bdd32c3cdaa490a864446 (patch) | |
tree | c4d102502cdf6cbab906acf1535f341ec188202b /common | |
parent | 8a22ac3966047353daffe88dd4b8c2910ef519f5 (diff) | |
parent | 8fefdb3c64d53a16bd400f97252c6887f5940af0 (diff) |
Merge pull request #394 from progandy/i3bar-json-protocol
swaybar: I3bar json protocol
Diffstat (limited to 'common')
-rw-r--r-- | common/list.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c index 850c8569..a7585a31 100644 --- a/common/list.c +++ b/common/list.c @@ -26,6 +26,15 @@ void list_free(list_t *list) { free(list); } +void list_foreach(list_t *list, void (*callback)(void *item)) { + if (list == NULL || callback == NULL) { + return; + } + for (int i = 0; i < list->length; i++) { + callback(list->items[i]); + } +} + void list_add(list_t *list, void *item) { list_resize(list); list->items[list->length++] = item; |