dav/scfg.c

branch
ucx-3.1
changeset 816
839fefbdedc7
parent 783
36a7f2ea7d12
equal deleted inserted replaced
815:1f40ca07ae1b 816:839fefbdedc7
167 Filter* parse_filter(xmlNode *node) { 167 Filter* parse_filter(xmlNode *node) {
168 CxList *include = cxLinkedListCreate(cxDefaultAllocator, NULL, sizeof(regex_t)); 168 CxList *include = cxLinkedListCreate(cxDefaultAllocator, NULL, sizeof(regex_t));
169 CxList *exclude = cxLinkedListCreate(cxDefaultAllocator, NULL, sizeof(regex_t)); 169 CxList *exclude = cxLinkedListCreate(cxDefaultAllocator, NULL, sizeof(regex_t));
170 CxList *tags = cxLinkedListCreate(cxDefaultAllocator, NULL, CX_STORE_POINTERS); 170 CxList *tags = cxLinkedListCreate(cxDefaultAllocator, NULL, CX_STORE_POINTERS);
171 171
172 include->simple_destructor = (cx_destructor_func)regfree; 172 cxDefineDestructor(include, regfree);
173 exclude->simple_destructor = (cx_destructor_func)regfree; 173 cxDefineDestructor(exclude, regfree);
174 // TODO: set tags destructor 174 // TODO: set tags destructor
175 175
176 if(scfg_load_filter(node, include, exclude, tags)) { 176 if(scfg_load_filter(node, include, exclude, tags)) {
177 return NULL; 177 return NULL;
178 } 178 }
183 filter->tags = tags; 183 filter->tags = tags;
184 return filter; 184 return filter;
185 } 185 }
186 186
187 void init_default_filter(Filter *filter) { 187 void init_default_filter(Filter *filter) {
188 if(filter->include->size == 0) { 188 if(cxListSize(filter->include) == 0) {
189 regex_t matchall; 189 regex_t matchall;
190 regcomp(&matchall, ".*", REG_NOSUB); 190 regcomp(&matchall, ".*", REG_NOSUB);
191 cxListAdd(filter->include, &matchall); 191 cxListAdd(filter->include, &matchall);
192 } 192 }
193 /* 193 /*

mercurial