diff -r 4d7ac67a1c14 -r 68e824ba4a4f src/server/webdav/webdav.c --- a/src/server/webdav/webdav.c Sun Dec 29 21:43:14 2019 +0100 +++ b/src/server/webdav/webdav.c Sun Dec 29 22:39:35 2019 +0100 @@ -654,6 +654,43 @@ return count; } +WebdavPListIterator webdav_plist_iterator(WebdavPList **list) { + WebdavPListIterator i; + i.list = list; + i.cur = NULL; + i.next = *list; + i.index; + return i; +} + +int webdav_plist_iterator_next(WebdavPListIterator *i, WebdavPList **cur) { + if(i->cur) { + i->index++; + } + + i->cur = i->next; + i->next = i->cur ? i->cur->next : NULL; + *cur = i->cur; + + return i->cur != NULL; +} + +void webdav_plist_iterator_remove_current(WebdavPListIterator *i) { + WebdavPList *cur = i->cur; + if(cur->prev) { + cur->prev = cur->next; + if(cur->next) { + cur->next->prev = cur->prev; + } + } else { + *i->list = cur->next; + if(cur->next) { + cur->next->prev = NULL; + } + } +} + + WSNamespace* webdav_dav_namespace(void) { return &dav_namespace; }