dav/sync.c

changeset 750
4d7a2238c5ac
parent 749
bbadf84cfc2d
child 759
a3e35cae098b
equal deleted inserted replaced
749:bbadf84cfc2d 750:4d7a2238c5ac
34 #include <signal.h> 34 #include <signal.h>
35 #include <time.h> 35 #include <time.h>
36 #include <utime.h> 36 #include <utime.h>
37 #include <libxml/xmlerror.h> 37 #include <libxml/xmlerror.h>
38 #include <sys/types.h> 38 #include <sys/types.h>
39 #include <cx/map.h>
39 #include <cx/string.h> 40 #include <cx/string.h>
40 #include <cx/utils.h> 41 #include <cx/utils.h>
42 #include <cx/list.h>
41 #include <cx/hash_map.h> 43 #include <cx/hash_map.h>
42 #include <cx/printf.h> 44 #include <cx/printf.h>
43 #include <dirent.h> 45 #include <dirent.h>
44 46
45 #include <math.h> 47 #include <math.h>
113 } 115 }
114 } 116 }
115 117
116 118
117 119
118
119 static bool nulliter_valid(void const *d) {
120 return false;
121 }
122
123 static void * nulliter_current(void const *d) {
124 return NULL;
125 }
126
127 void * nulliter_current_impl(void const *d) {
128 return NULL;
129 }
130
131 void nulliter_next(void *d) {
132 // noop
133 }
134
135 bool nulliter_flag_removal(void *d) {
136 return false;
137 }
138
139
140 static CxIterator nullIterator(void) {
141 CxIterator iter;
142 memset(&iter, 0, sizeof(CxIterator));
143 iter.base.valid = nulliter_valid;
144 iter.base.current = nulliter_current;
145 iter.base.current_impl = nulliter_current_impl;
146 iter.base.next = nulliter_next;
147 iter.base.flag_removal = nulliter_flag_removal;
148 return iter;
149 }
150
151 static CxIterator mapIteratorValues(CxMap *map) { 120 static CxIterator mapIteratorValues(CxMap *map) {
152 return map ? cxMapIteratorValues(map) : nullIterator(); 121 return cxMapIteratorValues(map ? map : cxEmptyMap);
153 } 122 }
154 123
155 static CxIterator listIterator(CxList *list) { 124 static CxIterator listIterator(CxList *list) {
156 return list ? cxListIterator(list) : nullIterator(); 125 return cxListIterator(list ? list : cxEmptyList);
157 } 126 }
158 127
159 typedef void*(*clonefunc)(void *elm, void *userdata); 128 typedef void*(*clonefunc)(void *elm, void *userdata);
160 129
161 static CxMap* mapClone(const CxAllocator *a, CxMap *map, clonefunc clone, void *userdata) { 130 static CxMap* mapClone(const CxAllocator *a, CxMap *map, clonefunc clone, void *userdata) {

mercurial